From d29ed143027a2bee920f5f63dadbac8bc23c4a54 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Mon, 31 Aug 2020 15:01:07 +0800 Subject: [PATCH 01/10] deprecated go client generator --- ' | 244 ++++++++++ .../go-experimental-go-petstore-oas2.yaml | 6 - bin/configs/go-experimental-go-petstore.yaml | 8 - bin/configs/go-petstore-withXml.yaml | 8 - bin/configs/go-petstore.yaml | 3 +- .../codegen/languages/AbstractGoCodegen.java | 4 +- .../codegen/languages/GoClientCodegen.java | 448 ++++++++++++++---- .../GoClientExperimentalCodegen.java | 403 ---------------- .../languages/GoDeprecatedClientCodegen.java | 244 ++++++++++ .../org.openapitools.codegen.CodegenConfig | 2 +- .../.travis.yml | 0 .../resources/go-deprecated/README.mustache | 148 ++++++ .../api.mustache | 211 +++++---- .../resources/go-deprecated/api_doc.mustache | 59 +++ .../client.mustache | 66 ++- .../go-deprecated/configuration.mustache | 161 +++++++ .../git_push.sh.mustache | 0 .../gitignore.mustache | 0 .../go.mod.mustache | 4 +- .../{go-experimental => go-deprecated}/go.sum | 2 + .../resources/go-deprecated/model.mustache | 43 ++ .../go-deprecated/model_doc.mustache | 12 + .../openapi.mustache | 0 .../partial_header.mustache | 0 .../response.mustache | 0 .../resources/go-experimental/README.mustache | 215 --------- .../go-experimental/api_doc.mustache | 89 ---- .../go-experimental/configuration.mustache | 289 ----------- .../resources/go-experimental/model.mustache | 20 - .../go-experimental/model_doc.mustache | 90 ---- .../src/main/resources/go/README.mustache | 139 ++++-- .../src/main/resources/go/api.mustache | 211 ++++----- .../src/main/resources/go/api_doc.mustache | 54 ++- .../src/main/resources/go/client.mustache | 66 +-- .../main/resources/go/configuration.mustache | 200 ++++++-- .../src/main/resources/go/go.mod.mustache | 4 +- .../src/main/resources/go/go.sum | 2 - .../src/main/resources/go/model.mustache | 37 +- .../model_anyof.mustache | 0 .../src/main/resources/go/model_doc.mustache | 82 +++- .../model_enum.mustache | 0 .../model_oneof.mustache | 0 .../model_simple.mustache | 0 .../nullable_model.mustache | 0 .../{go-experimental => go}/signing.mustache | 0 .../{go-experimental => go}/utils.mustache | 0 .../OneOfImplementorAdditionalDataTest.java | 4 +- 47 files changed, 1949 insertions(+), 1629 deletions(-) create mode 100644 ' delete mode 100644 bin/configs/go-experimental-go-petstore-oas2.yaml delete mode 100644 bin/configs/go-experimental-go-petstore.yaml delete mode 100644 bin/configs/go-petstore-withXml.yaml delete mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java create mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoDeprecatedClientCodegen.java rename modules/openapi-generator/src/main/resources/{go-experimental => go-deprecated}/.travis.yml (100%) create mode 100644 modules/openapi-generator/src/main/resources/go-deprecated/README.mustache rename modules/openapi-generator/src/main/resources/{go-experimental => go-deprecated}/api.mustache (51%) create mode 100644 modules/openapi-generator/src/main/resources/go-deprecated/api_doc.mustache rename modules/openapi-generator/src/main/resources/{go-experimental => go-deprecated}/client.mustache (91%) create mode 100644 modules/openapi-generator/src/main/resources/go-deprecated/configuration.mustache rename modules/openapi-generator/src/main/resources/{go-experimental => go-deprecated}/git_push.sh.mustache (100%) rename modules/openapi-generator/src/main/resources/{go-experimental => go-deprecated}/gitignore.mustache (100%) rename modules/openapi-generator/src/main/resources/{go-experimental => go-deprecated}/go.mod.mustache (58%) rename modules/openapi-generator/src/main/resources/{go-experimental => go-deprecated}/go.sum (89%) create mode 100644 modules/openapi-generator/src/main/resources/go-deprecated/model.mustache create mode 100644 modules/openapi-generator/src/main/resources/go-deprecated/model_doc.mustache rename modules/openapi-generator/src/main/resources/{go-experimental => go-deprecated}/openapi.mustache (100%) rename modules/openapi-generator/src/main/resources/{go-experimental => go-deprecated}/partial_header.mustache (100%) rename modules/openapi-generator/src/main/resources/{go-experimental => go-deprecated}/response.mustache (100%) delete mode 100644 modules/openapi-generator/src/main/resources/go-experimental/README.mustache delete mode 100644 modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache delete mode 100644 modules/openapi-generator/src/main/resources/go-experimental/configuration.mustache delete mode 100644 modules/openapi-generator/src/main/resources/go-experimental/model.mustache delete mode 100644 modules/openapi-generator/src/main/resources/go-experimental/model_doc.mustache rename modules/openapi-generator/src/main/resources/{go-experimental => go}/model_anyof.mustache (100%) rename modules/openapi-generator/src/main/resources/{go-experimental => go}/model_enum.mustache (100%) rename modules/openapi-generator/src/main/resources/{go-experimental => go}/model_oneof.mustache (100%) rename modules/openapi-generator/src/main/resources/{go-experimental => go}/model_simple.mustache (100%) rename modules/openapi-generator/src/main/resources/{go-experimental => go}/nullable_model.mustache (100%) rename modules/openapi-generator/src/main/resources/{go-experimental => go}/signing.mustache (100%) rename modules/openapi-generator/src/main/resources/{go-experimental => go}/utils.mustache (100%) diff --git a/' b/' new file mode 100644 index 00000000000..46392c1aad6 --- /dev/null +++ b/' @@ -0,0 +1,244 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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.languages; + +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenType; +import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.meta.features.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.util.EnumSet; + +public class GoDeprecatedClientCodegen extends AbstractGoCodegen { + + private static final Logger LOGGER = LoggerFactory.getLogger(GoDeprecatedClientCodegen.class); + + protected String packageVersion = "1.0.0"; + protected String apiDocPath = "docs/"; + protected String modelDocPath = "docs/"; + protected boolean isGoSubmodule = false; + public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment"; + public static final String WITH_XML = "withXml"; + public static final String STRUCT_PREFIX = "structPrefix"; + public static final String WITH_AWSV4_SIGNATURE = "withAWSV4Signature"; + + public GoDeprecatedClientCodegen() { + super(); + + modifyFeatureSet(features -> features + .includeDocumentationFeatures(DocumentationFeature.Readme) + .wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML)) + .securityFeatures(EnumSet.of( + SecurityFeature.BasicAuth, + SecurityFeature.ApiKey, + SecurityFeature.OAuth2_Implicit + )) + .includeGlobalFeatures( + GlobalFeature.ParameterizedServer + ) + .excludeGlobalFeatures( + GlobalFeature.XMLStructureDefinitions, + GlobalFeature.Callbacks, + GlobalFeature.LinkObjects, + GlobalFeature.ParameterStyling + ) + .excludeSchemaSupportFeatures( + SchemaSupportFeature.Polymorphism + ) + .includeParameterFeatures( + ParameterFeature.Cookie + ) + .includeClientModificationFeatures( + ClientModificationFeature.BasePath, + ClientModificationFeature.UserAgent + ) + ); + + outputFolder = "generated-code/go-deprecated"; + modelTemplateFiles.put("model.mustache", ".go"); + apiTemplateFiles.put("api.mustache", ".go"); + + modelDocTemplateFiles.put("model_doc.mustache", ".md"); + apiDocTemplateFiles.put("api_doc.mustache", ".md"); + + embeddedTemplateDir = templateDir = "go-deprecated"; + + // default HIDE_GENERATION_TIMESTAMP to true + hideGenerationTimestamp = Boolean.TRUE; + + cliOptions.add(CliOption.newBoolean(CodegenConstants.IS_GO_SUBMODULE, CodegenConstants.IS_GO_SUBMODULE_DESC)); + cliOptions.add(CliOption.newBoolean(WITH_GO_CODEGEN_COMMENT, "whether to include Go codegen comment to disable Go Lint and collapse by default in GitHub PRs and diffs")); + cliOptions.add(CliOption.newBoolean(WITH_XML, "whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)")); + cliOptions.add(CliOption.newBoolean(CodegenConstants.ENUM_CLASS_PREFIX, CodegenConstants.ENUM_CLASS_PREFIX_DESC)); + cliOptions.add(CliOption.newBoolean(STRUCT_PREFIX, "whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts")); + cliOptions.add(CliOption.newBoolean(WITH_AWSV4_SIGNATURE, "whether to include AWS v4 signature support")); + + // option to change the order of form/body parameter + cliOptions.add(CliOption.newBoolean( + CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, + CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS_DESC) + .defaultValue(Boolean.FALSE.toString())); + } + + @Override + public void processOpts() { + super.processOpts(); + + if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { + setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); + } else { + setPackageName("openapi"); + } + + if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) { + setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION)); + } else { + setPackageVersion("1.0.0"); + } + + additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); + additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion); + + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); + + modelPackage = packageName; + apiPackage = packageName; + + supportingFiles.add(new SupportingFile("openapi.mustache", "api", "openapi.yaml")); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); + supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.go")); + supportingFiles.add(new SupportingFile("client.mustache", "", "client.go")); + supportingFiles.add(new SupportingFile("response.mustache", "", "response.go")); + supportingFiles.add(new SupportingFile("go.mod.mustache", "", "go.mod")); + supportingFiles.add(new SupportingFile("go.sum", "", "go.sum")); + supportingFiles.add(new SupportingFile(".travis.yml", "", ".travis.yml")); + + if (additionalProperties.containsKey(WITH_GO_CODEGEN_COMMENT)) { + setWithGoCodegenComment(Boolean.parseBoolean(additionalProperties.get(WITH_GO_CODEGEN_COMMENT).toString())); + additionalProperties.put(WITH_GO_CODEGEN_COMMENT, withGoCodegenComment); + } + + if (additionalProperties.containsKey(WITH_AWSV4_SIGNATURE)) { + setWithAWSV4Signature(Boolean.parseBoolean(additionalProperties.get(WITH_AWSV4_SIGNATURE).toString())); + additionalProperties.put(WITH_AWSV4_SIGNATURE, withAWSV4Signature); + } + + if (additionalProperties.containsKey(WITH_XML)) { + setWithXml(Boolean.parseBoolean(additionalProperties.get(WITH_XML).toString())); + additionalProperties.put(WITH_XML, withXml); + } + + if (additionalProperties.containsKey(CodegenConstants.ENUM_CLASS_PREFIX)) { + setEnumClassPrefix(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.ENUM_CLASS_PREFIX).toString())); + additionalProperties.put(CodegenConstants.ENUM_CLASS_PREFIX, enumClassPrefix); + } + + if (additionalProperties.containsKey(CodegenConstants.IS_GO_SUBMODULE)) { + setIsGoSubmodule(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.IS_GO_SUBMODULE).toString())); + additionalProperties.put(CodegenConstants.IS_GO_SUBMODULE, isGoSubmodule); + } + + if (additionalProperties.containsKey(STRUCT_PREFIX)) { + setStructPrefix(Boolean.parseBoolean(additionalProperties.get(STRUCT_PREFIX).toString())); + additionalProperties.put(STRUCT_PREFIX, structPrefix); + } + } + + /** + * Configures the type of generator. + * + * @return the CodegenType for this generator + * @see org.openapitools.codegen.CodegenType + */ + @Override + public CodegenType getTag() { + return CodegenType.CLIENT; + } + + /** + * Configures a friendly name for the generator. This will be used by the generator + * to select the library with the -g flag. + * + * @return the friendly name for the generator + */ + @Override + public String getName() { + return "go-deprecated"; + } + + /** + * Returns human-friendly help for the generator. Provide the consumer with help + * tips, parameters here + * + * @return A string value for the help message + */ + @Override + public String getHelp() { + return "Generates a Go client library (beta). NOTE: this generator has been dprecated. Please switch to `go` client generator instead."; + } + + /** + * Location to write api files. You can use the apiPackage() as defined when the class is + * instantiated + */ + @Override + public String apiFileFolder() { + return outputFolder + File.separator; + } + + @Override + public String modelFileFolder() { + return outputFolder + File.separator; + } + + @Override + public String apiDocFileFolder() { + return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); + } + + @Override + public String modelDocFileFolder() { + return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); + } + + @Override + public String toModelDocFilename(String name) { + return toModelName(name); + } + + @Override + public String toApiDocFilename(String name) { + return toApiName(name); + } + + public void setPackageVersion(String packageVersion) { + this.packageVersion = packageVersion; + } + + public void setIsGoSubmodule(boolean isGoSubmodule) { + this.isGoSubmodule = isGoSubmodule; + } + +} diff --git a/bin/configs/go-experimental-go-petstore-oas2.yaml b/bin/configs/go-experimental-go-petstore-oas2.yaml deleted file mode 100644 index 64c6bfbebc3..00000000000 --- a/bin/configs/go-experimental-go-petstore-oas2.yaml +++ /dev/null @@ -1,6 +0,0 @@ -generatorName: go-experimental -outputDir: samples/client/petstore/go-experimental/go-petstore -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -templateDir: modules/openapi-generator/src/main/resources/go-experimental -additionalProperties: - packageName: petstore diff --git a/bin/configs/go-experimental-go-petstore.yaml b/bin/configs/go-experimental-go-petstore.yaml deleted file mode 100644 index 5b81f347ca5..00000000000 --- a/bin/configs/go-experimental-go-petstore.yaml +++ /dev/null @@ -1,8 +0,0 @@ -generatorName: go-experimental -outputDir: samples/openapi3/client/petstore/go-experimental/go-petstore -inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml -templateDir: modules/openapi-generator/src/main/resources/go-experimental -additionalProperties: - enumClassPrefix: "true" - packageName: petstore - disallowAdditionalPropertiesIfNotPresent: false diff --git a/bin/configs/go-petstore-withXml.yaml b/bin/configs/go-petstore-withXml.yaml deleted file mode 100644 index f80df1e7681..00000000000 --- a/bin/configs/go-petstore-withXml.yaml +++ /dev/null @@ -1,8 +0,0 @@ -generatorName: go -outputDir: samples/client/petstore/go/go-petstore-withXml -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -templateDir: modules/openapi-generator/src/main/resources/go -additionalProperties: - packageName: petstore - withXml: "true" - withGoCodegenComment: "true" diff --git a/bin/configs/go-petstore.yaml b/bin/configs/go-petstore.yaml index aefc71b9011..7cae43d0bda 100644 --- a/bin/configs/go-petstore.yaml +++ b/bin/configs/go-petstore.yaml @@ -1,7 +1,8 @@ generatorName: go outputDir: samples/openapi3/client/petstore/go/go-petstore -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/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml templateDir: modules/openapi-generator/src/main/resources/go additionalProperties: enumClassPrefix: "true" packageName: petstore + disallowAdditionalPropertiesIfNotPresent: false diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java index c9cb8987777..34ecf24a301 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java @@ -590,7 +590,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege @Override public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { - // The 'go-experimental/model.mustache' template conditionally generates accessor methods. + // The 'go/model.mustache' template conditionally generates accessor methods. // For primitive types and custom types (e.g. interface{}, map[string]interface{}...), // the generated code has a wrapper type and a Get() function to access the underlying type. // For containers (e.g. Array, Map), the generated code returns the type directly. @@ -630,7 +630,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege } } - if (this instanceof GoClientExperimentalCodegen && model.isEnum) { + if (this instanceof GoClientCodegen && model.isEnum) { imports.add(createMapping("import", "fmt")); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java index 33dda391ee5..820f82e658e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java @@ -1,6 +1,5 @@ /* * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) - * Copyright 2018 SmartBear Software * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,29 +16,32 @@ package org.openapitools.codegen.languages; -import org.openapitools.codegen.CliOption; -import org.openapitools.codegen.CodegenConstants; -import org.openapitools.codegen.CodegenType; -import org.openapitools.codegen.SupportingFile; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.security.SecurityScheme; +import org.apache.commons.lang3.StringUtils; +import org.openapitools.codegen.*; +import org.openapitools.codegen.meta.GeneratorMetadata; +import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.meta.features.*; +import org.openapitools.codegen.utils.ModelUtils; +import org.openapitools.codegen.utils.ProcessUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; -import java.util.EnumSet; +import java.util.*; + +import static org.openapitools.codegen.utils.StringUtils.camelize; public class GoClientCodegen extends AbstractGoCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(GoClientCodegen.class); - + protected String goImportAlias = "openapiclient"; + protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup protected String packageVersion = "1.0.0"; protected String apiDocPath = "docs/"; protected String modelDocPath = "docs/"; protected boolean isGoSubmodule = false; public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment"; - public static final String WITH_XML = "withXml"; - public static final String STRUCT_PREFIX = "structPrefix"; - public static final String WITH_AWSV4_SIGNATURE = "withAWSV4Signature"; public GoClientCodegen() { super(); @@ -56,10 +58,10 @@ public class GoClientCodegen extends AbstractGoCodegen { GlobalFeature.ParameterizedServer ) .excludeGlobalFeatures( - GlobalFeature.XMLStructureDefinitions, GlobalFeature.Callbacks, GlobalFeature.LinkObjects, - GlobalFeature.ParameterStyling + GlobalFeature.ParameterStyling, + GlobalFeature.XMLStructureDefinitions ) .excludeSchemaSupportFeatures( SchemaSupportFeature.Polymorphism @@ -76,32 +78,66 @@ public class GoClientCodegen extends AbstractGoCodegen { outputFolder = "generated-code/go"; modelTemplateFiles.put("model.mustache", ".go"); apiTemplateFiles.put("api.mustache", ".go"); - modelDocTemplateFiles.put("model_doc.mustache", ".md"); apiDocTemplateFiles.put("api_doc.mustache", ".md"); - embeddedTemplateDir = templateDir = "go"; - // default HIDE_GENERATION_TIMESTAMP to true - hideGenerationTimestamp = Boolean.TRUE; - cliOptions.add(CliOption.newBoolean(CodegenConstants.IS_GO_SUBMODULE, CodegenConstants.IS_GO_SUBMODULE_DESC)); cliOptions.add(CliOption.newBoolean(WITH_GO_CODEGEN_COMMENT, "whether to include Go codegen comment to disable Go Lint and collapse by default in GitHub PRs and diffs")); - cliOptions.add(CliOption.newBoolean(WITH_XML, "whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)")); cliOptions.add(CliOption.newBoolean(CodegenConstants.ENUM_CLASS_PREFIX, CodegenConstants.ENUM_CLASS_PREFIX_DESC)); - cliOptions.add(CliOption.newBoolean(STRUCT_PREFIX, "whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts")); - cliOptions.add(CliOption.newBoolean(WITH_AWSV4_SIGNATURE, "whether to include AWS v4 signature support")); - // option to change the order of form/body parameter - cliOptions.add(CliOption.newBoolean( - CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, - CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS_DESC) - .defaultValue(Boolean.FALSE.toString())); + usesOptionals = false; + + generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata).stability(Stability.EXPERIMENTAL).build(); + + cliOptions.add(new CliOption(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC).defaultValue("false")); + // option to change how we process + set the data in the 'additionalProperties' keyword. + CliOption disallowAdditionalPropertiesIfNotPresentOpt = CliOption.newBoolean( + CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, + CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_DESC).defaultValue(Boolean.TRUE.toString()); + Map<String, String> disallowAdditionalPropertiesIfNotPresentOpts = new HashMap<>(); + disallowAdditionalPropertiesIfNotPresentOpts.put("false", + "The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications."); + disallowAdditionalPropertiesIfNotPresentOpts.put("true", + "when the 'additionalProperties' keyword is not present in a schema, " + + "the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. " + + "Note: this mode is not compliant with the JSON schema specification. " + + "This is the original openapi-generator behavior."); + disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts); + cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt); + this.setDisallowAdditionalPropertiesIfNotPresent(true); + } + + /** + * Configures a friendly name for the generator. This will be used by the + * generator to select the library with the -g flag. + * + * @return the friendly name for the generator + */ + @Override + public String getName() { + return "go"; + } + + @Override + public String toGetter(String name) { + return "Get" + getterAndSetterCapitalize(name); + } + + /** + * Returns human-friendly help for the generator. Provide the consumer with help + * tips, parameters here + * + * @return A string value for the help message + */ + @Override + public String getHelp() { + return "Generates a Go client library."; } @Override public void processOpts() { - super.processOpts(); + this.setLegacyDiscriminatorBehavior(false); if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); @@ -124,6 +160,39 @@ public class GoClientCodegen extends AbstractGoCodegen { modelPackage = packageName; apiPackage = packageName; + if (additionalProperties.containsKey(WITH_GO_CODEGEN_COMMENT)) { + setWithGoCodegenComment(Boolean.parseBoolean(additionalProperties.get(WITH_GO_CODEGEN_COMMENT).toString())); + additionalProperties.put(WITH_GO_CODEGEN_COMMENT, withGoCodegenComment); + } + + if (additionalProperties.containsKey(CodegenConstants.ENUM_CLASS_PREFIX)) { + setEnumClassPrefix(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.ENUM_CLASS_PREFIX).toString())); + additionalProperties.put(CodegenConstants.ENUM_CLASS_PREFIX, enumClassPrefix); + } + + if (additionalProperties.containsKey(CodegenConstants.IS_GO_SUBMODULE)) { + setIsGoSubmodule(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.IS_GO_SUBMODULE).toString())); + additionalProperties.put(CodegenConstants.IS_GO_SUBMODULE, isGoSubmodule); + } + + if (additionalProperties.containsKey("goImportAlias")) { + setGoImportAlias(additionalProperties.get("goImportAlias").toString()); + } else { + additionalProperties.put("goImportAlias", goImportAlias); + } + + if (additionalProperties.containsKey(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP)) { + setUseOneOfDiscriminatorLookup(convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP)); + } else { + additionalProperties.put(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, getUseOneOfDiscriminatorLookup()); + } + + if (additionalProperties.containsKey(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT)) { + this.setDisallowAdditionalPropertiesIfNotPresent(Boolean.valueOf(additionalProperties + .get(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT).toString())); + } + + supportingFiles.add(new SupportingFile("utils.mustache", "", "utils.go")); supportingFiles.add(new SupportingFile("openapi.mustache", "api", "openapi.yaml")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); @@ -135,110 +204,297 @@ public class GoClientCodegen extends AbstractGoCodegen { supportingFiles.add(new SupportingFile("go.sum", "", "go.sum")); supportingFiles.add(new SupportingFile(".travis.yml", "", ".travis.yml")); - if (additionalProperties.containsKey(WITH_GO_CODEGEN_COMMENT)) { - setWithGoCodegenComment(Boolean.parseBoolean(additionalProperties.get(WITH_GO_CODEGEN_COMMENT).toString())); - additionalProperties.put(WITH_GO_CODEGEN_COMMENT, withGoCodegenComment); + // Generate the 'signing.py' module, but only if the 'HTTP signature' security scheme is specified in the OAS. + Map<String, SecurityScheme> securitySchemeMap = openAPI != null ? + (openAPI.getComponents() != null ? openAPI.getComponents().getSecuritySchemes() : null) : null; + List<CodegenSecurity> authMethods = fromSecurity(securitySchemeMap); + if (ProcessUtils.hasHttpSignatureMethods(authMethods)) { + supportingFiles.add(new SupportingFile("signing.mustache", "", "signing.go")); } + } - if (additionalProperties.containsKey(WITH_AWSV4_SIGNATURE)) { - setWithAWSV4Signature(Boolean.parseBoolean(additionalProperties.get(WITH_AWSV4_SIGNATURE).toString())); - additionalProperties.put(WITH_AWSV4_SIGNATURE, withAWSV4Signature); - } + public void setUseOneOfDiscriminatorLookup(boolean useOneOfDiscriminatorLookup) { + this.useOneOfDiscriminatorLookup = useOneOfDiscriminatorLookup; + } - if (additionalProperties.containsKey(WITH_XML)) { - setWithXml(Boolean.parseBoolean(additionalProperties.get(WITH_XML).toString())); - additionalProperties.put(WITH_XML, withXml); - } + public boolean getUseOneOfDiscriminatorLookup() { + return this.useOneOfDiscriminatorLookup; + } - if (additionalProperties.containsKey(CodegenConstants.ENUM_CLASS_PREFIX)) { - setEnumClassPrefix(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.ENUM_CLASS_PREFIX).toString())); - additionalProperties.put(CodegenConstants.ENUM_CLASS_PREFIX, enumClassPrefix); - } + public void setGoImportAlias(String goImportAlias) { + this.goImportAlias = goImportAlias; + } - if (additionalProperties.containsKey(CodegenConstants.IS_GO_SUBMODULE)) { - setIsGoSubmodule(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.IS_GO_SUBMODULE).toString())); - additionalProperties.put(CodegenConstants.IS_GO_SUBMODULE, isGoSubmodule); - } + public void setPackageVersion(String packageVersion) { + this.packageVersion = packageVersion; + } - if (additionalProperties.containsKey(STRUCT_PREFIX)) { - setStructPrefix(Boolean.parseBoolean(additionalProperties.get(STRUCT_PREFIX).toString())); - additionalProperties.put(STRUCT_PREFIX, structPrefix); - } + public void setIsGoSubmodule(boolean isGoSubmodule) { + this.isGoSubmodule = isGoSubmodule; } - /** - * Configures the type of generator. - * - * @return the CodegenType for this generator - * @see org.openapitools.codegen.CodegenType - */ @Override - public CodegenType getTag() { - return CodegenType.CLIENT; + public String toModelName(String name) { + // underscoring would also lowercase the whole name, thus losing acronyms which are in capitals + return camelize(toModel(name, false)); } - /** - * Configures a friendly name for the generator. This will be used by the generator - * to select the library with the -g flag. - * - * @return the friendly name for the generator - */ - @Override - public String getName() { - return "go"; + public String escapeReservedWord(String name) { + if (this.reservedWordsMappings().containsKey(name)) { + return this.reservedWordsMappings().get(name); + } + return name + '_'; } - /** - * Returns human-friendly help for the generator. Provide the consumer with help - * tips, parameters here - * - * @return A string value for the help message - */ @Override - public String getHelp() { - return "Generates a Go client library (beta)."; + public String toEnumDefaultValue(String value, String datatype) { + String prefix = ""; + if (enumClassPrefix) { + prefix = datatype.toUpperCase(Locale.ROOT) + "_"; + } + return prefix + value; } - /** - * Location to write api files. You can use the apiPackage() as defined when the class is - * instantiated - */ @Override - public String apiFileFolder() { - return outputFolder + File.separator; + public void updateCodegenPropertyEnum(CodegenProperty var) { + // make sure the inline enums have plain defaults (e.g. string, int, float) + String enumDefault = null; + if (var.isEnum && var.defaultValue != null) { + enumDefault = var.defaultValue; + } + super.updateCodegenPropertyEnum(var); + if (var.isEnum && enumDefault != null) { + var.defaultValue = enumDefault; + } } @Override - public String modelFileFolder() { - return outputFolder + File.separator; + public String toDefaultValue(Schema p) { + p = ModelUtils.getReferencedSchema(this.openAPI, p); + if (ModelUtils.isStringSchema(p)) { + if (p.getDefault() != null) { + return "\"" + escapeText((String) p.getDefault()) + "\""; + } + return null; + } + + return super.toDefaultValue(p); } @Override - public String apiDocFileFolder() { - return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); + public CodegenProperty fromProperty(String name, Schema p) { + CodegenProperty prop = super.fromProperty(name, p); + String cc = camelize(prop.name, true); + if (isReservedWord(cc)) { + cc = escapeReservedWord(cc); + } + prop.nameInCamelCase = cc; + return prop; } @Override - public String modelDocFileFolder() { - return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); + public Map<String, Object> postProcessModels(Map<String, Object> objs) { + // The superclass determines the list of required golang imports. The actual list of imports + // depends on which types are used, some of which are changed in the code below (but then preserved + // and used through x-go-base-type in templates). So super.postProcessModels + // must be invoked at the beginning of this method. + objs = super.postProcessModels(objs); + + List<Map<String, String>> imports = (List<Map<String, String>>) objs.get("imports"); + + List<Map<String, Object>> models = (List<Map<String, Object>>) objs.get("models"); + for (Map<String, Object> m : models) { + Object v = m.get("model"); + if (v instanceof CodegenModel) { + CodegenModel model = (CodegenModel) v; + if (model.isEnum) { + continue; + } + + for (CodegenProperty param : model.vars) { + param.vendorExtensions.put("x-go-base-type", param.dataType); + if (!param.isNullable || param.isMapContainer || param.isListContainer || + param.isFreeFormObject || param.isAnyType) { + continue; + } + if (param.isDateTime) { + // Note this could have been done by adding the following line in processOpts(), + // however, we only want to represent the DateTime object as NullableTime if + // it's marked as nullable in the spec. + // typeMapping.put("DateTime", "NullableTime"); + param.dataType = "NullableTime"; + } else { + param.dataType = "Nullable" + Character.toUpperCase(param.dataType.charAt(0)) + + param.dataType.substring(1); + } + } + + // additional import for different cases + // oneOf + if (model.oneOf != null && !model.oneOf.isEmpty()) { + imports.add(createMapping("import", "fmt")); + } + + // anyOf + if (model.anyOf != null && !model.anyOf.isEmpty()) { + imports.add(createMapping("import", "fmt")); + } + + // additionalProperties: true and parent + if (model.isAdditionalPropertiesTrue && model.parent != null && Boolean.FALSE.equals(model.isMapModel)) { + imports.add(createMapping("import", "reflect")); + imports.add(createMapping("import", "strings")); + } + + } + } + return objs; } @Override - public String toModelDocFilename(String name) { - return toModelName(name); + public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) { + objs = super.postProcessOperationsWithModels(objs, allModels); + Map<String, Object> operations = (Map<String, Object>) objs.get("operations"); + HashMap<String, CodegenModel> modelMaps = new HashMap<String, CodegenModel>(); + HashMap<String, Integer> processedModelMaps = new HashMap<String, Integer>(); + + for (Object o : allModels) { + HashMap<String, Object> h = (HashMap<String, Object>) o; + CodegenModel m = (CodegenModel) h.get("model"); + modelMaps.put(m.classname, m); + } + + List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation"); + for (CodegenOperation op : operationList) { + for (CodegenParameter p : op.allParams) { + p.vendorExtensions.put("x-go-example", constructExampleCode(p, modelMaps, processedModelMaps)); + } + } + + processedModelMaps.clear(); + for (CodegenOperation operation : operationList) { + for (CodegenParameter cp : operation.allParams) { + cp.vendorExtensions.put("x-go-example", constructExampleCode(cp, modelMaps, processedModelMaps)); + } + } + + return objs; } - @Override - public String toApiDocFilename(String name) { - return toApiName(name); + private String constructExampleCode(CodegenParameter codegenParameter, HashMap<String, CodegenModel> modelMaps, HashMap<String, Integer> processedModelMap) { + if (codegenParameter.isListContainer) { // array + return codegenParameter.dataType + "{" + constructExampleCode(codegenParameter.items, modelMaps, processedModelMap) + "}"; + } else if (codegenParameter.isMapContainer) { + return "map[string]string{ \"Key\" = \"Value\" }"; + } else if (codegenParameter.isPrimitiveType) { // primitive type + if (codegenParameter.isString) { + if (StringUtils.isEmpty(codegenParameter.example)) { + return "\"" + codegenParameter.example + "\""; + } else { + return "\"" + codegenParameter.paramName + "_example\""; + } + } else if (codegenParameter.isBoolean) { // boolean + if (Boolean.parseBoolean(codegenParameter.example)) { + return "true"; + } else { + return "false"; + } + } else if (codegenParameter.isUri) { // URL + return "URL(string: \"https://example.com\")!"; + } else if (codegenParameter.isDateTime || codegenParameter.isDate) { // datetime or date + return "Get-Date"; + } else { // numeric + if (StringUtils.isEmpty(codegenParameter.example)) { + return codegenParameter.example; + } else { + return "987"; + } + } + } else { // model + // look up the model + if (modelMaps.containsKey(codegenParameter.dataType)) { + return constructExampleCode(modelMaps.get(codegenParameter.dataType), modelMaps, processedModelMap); + } else { + //LOGGER.error("Error in constructing examples. Failed to look up the model " + codegenParameter.dataType); + return "TODO"; + } + } } - public void setPackageVersion(String packageVersion) { - this.packageVersion = packageVersion; + private String constructExampleCode(CodegenProperty codegenProperty, HashMap<String, CodegenModel> modelMaps, HashMap<String, Integer> processedModelMap) { + if (codegenProperty.isListContainer) { // array + return codegenProperty.dataType + "{" + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + ")"; + } else if (codegenProperty.isMapContainer) { // map + return "map[string]string{ \"Key\" = \"Value\" }"; + } else if (codegenProperty.isPrimitiveType) { // primitive type + if (codegenProperty.isString) { + if (StringUtils.isEmpty(codegenProperty.example)) { + return "\"" + codegenProperty.example + "\""; + } else { + return "\"" + codegenProperty.name + "_example\""; + } + } else if (codegenProperty.isBoolean) { // boolean + if (Boolean.parseBoolean(codegenProperty.example)) { + return "true"; + } else { + return "false"; + } + } else if (codegenProperty.isUri) { // URL + return "\"https://example.com\")!"; + } else if (codegenProperty.isDateTime || codegenProperty.isDate) { // datetime or date + return "time.Now()"; + } else { // numeric + String example; + if (StringUtils.isEmpty(codegenProperty.example)) { + example = codegenProperty.example; + } else { + example = "123"; + } + + if (codegenProperty.isLong) { + return "int64(" + example + ")"; + } else { + return example; + } + } + } else { + // look up the model + if (modelMaps.containsKey(codegenProperty.dataType)) { + return constructExampleCode(modelMaps.get(codegenProperty.dataType), modelMaps, processedModelMap); + } else { + //LOGGER.error("Error in constructing examples. Failed to look up the model " + codegenProperty.dataType); + return "\"TODO\""; + } + } } - public void setIsGoSubmodule(boolean isGoSubmodule) { - this.isGoSubmodule = isGoSubmodule; + private String constructExampleCode(CodegenModel codegenModel, HashMap<String, CodegenModel> modelMaps, HashMap<String, Integer> processedModelMap) { + String example; + + // break infinite recursion. Return, in case a model is already processed in the current context. + String model = codegenModel.name; + if (processedModelMap.containsKey(model)) { + int count = processedModelMap.get(model); + if (count == 1) { + processedModelMap.put(model, 2); + } else if (count == 2) { + return ""; + } else { + throw new RuntimeException("Invalid count when constructing example: " + count); + } + } else { + processedModelMap.put(model, 1); + } + + example = "" + goImportAlias + "." + codegenModel.name + "{"; + List<String> propertyExamples = new ArrayList<>(); + for (CodegenProperty codegenProperty : codegenModel.allVars) { + propertyExamples.add(codegenProperty.name + ": " + constructExampleCode(codegenProperty, modelMaps, processedModelMap)); + } + example += StringUtils.join(propertyExamples, ", "); + example += "}"; + return example; } + } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java deleted file mode 100644 index 9ee17ffbaf6..00000000000 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java +++ /dev/null @@ -1,403 +0,0 @@ -/* - * 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.languages; - -import io.swagger.v3.oas.models.media.Schema; -import io.swagger.v3.oas.models.security.SecurityScheme; -import org.apache.commons.lang3.StringUtils; -import org.openapitools.codegen.*; -import org.openapitools.codegen.meta.GeneratorMetadata; -import org.openapitools.codegen.meta.Stability; -import org.openapitools.codegen.utils.ModelUtils; -import org.openapitools.codegen.utils.ProcessUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.*; - -import static org.openapitools.codegen.utils.StringUtils.camelize; - -public class GoClientExperimentalCodegen extends GoClientCodegen { - - private static final Logger LOGGER = LoggerFactory.getLogger(GoClientExperimentalCodegen.class); - protected String goImportAlias = "openapiclient"; - protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup - - public GoClientExperimentalCodegen() { - super(); - outputFolder = "generated-code/go-experimental"; - embeddedTemplateDir = templateDir = "go-experimental"; - - usesOptionals = false; - - generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata).stability(Stability.EXPERIMENTAL).build(); - - cliOptions.add(new CliOption(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC).defaultValue("false")); - // option to change how we process + set the data in the 'additionalProperties' keyword. - CliOption disallowAdditionalPropertiesIfNotPresentOpt = CliOption.newBoolean( - CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, - CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_DESC).defaultValue(Boolean.TRUE.toString()); - Map<String, String> disallowAdditionalPropertiesIfNotPresentOpts = new HashMap<>(); - disallowAdditionalPropertiesIfNotPresentOpts.put("false", - "The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications."); - disallowAdditionalPropertiesIfNotPresentOpts.put("true", - "when the 'additionalProperties' keyword is not present in a schema, " + - "the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. " + - "Note: this mode is not compliant with the JSON schema specification. " + - "This is the original openapi-generator behavior."); - disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts); - cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt); - this.setDisallowAdditionalPropertiesIfNotPresent(true); - } - - /** - * Configures a friendly name for the generator. This will be used by the - * generator to select the library with the -g flag. - * - * @return the friendly name for the generator - */ - @Override - public String getName() { - return "go-experimental"; - } - - @Override - public String toGetter(String name) { - return "Get" + getterAndSetterCapitalize(name); - } - - /** - * Returns human-friendly help for the generator. Provide the consumer with help - * tips, parameters here - * - * @return A string value for the help message - */ - @Override - public String getHelp() { - return "Generates a Go client library (experimental and may subject to breaking changes without further notice)."; - } - - @Override - public void processOpts() { - this.setLegacyDiscriminatorBehavior(false); - super.processOpts(); - supportingFiles.add(new SupportingFile("utils.mustache", "", "utils.go")); - - // Generate the 'signing.py' module, but only if the 'HTTP signature' security scheme is specified in the OAS. - Map<String, SecurityScheme> securitySchemeMap = openAPI != null ? - (openAPI.getComponents() != null ? openAPI.getComponents().getSecuritySchemes() : null) : null; - List<CodegenSecurity> authMethods = fromSecurity(securitySchemeMap); - if (ProcessUtils.hasHttpSignatureMethods(authMethods)) { - supportingFiles.add(new SupportingFile("signing.mustache", "", "signing.go")); - } - - if (additionalProperties.containsKey("goImportAlias")) { - setGoImportAlias(additionalProperties.get("goImportAlias").toString()); - } else { - additionalProperties.put("goImportAlias", goImportAlias); - } - - if (additionalProperties.containsKey(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP)) { - setUseOneOfDiscriminatorLookup(convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP)); - } else { - additionalProperties.put(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, useOneOfDiscriminatorLookup); - } - - if (additionalProperties.containsKey(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT)) { - this.setDisallowAdditionalPropertiesIfNotPresent(Boolean.valueOf(additionalProperties - .get(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT).toString())); - } - - } - - public void setUseOneOfDiscriminatorLookup(boolean useOneOfDiscriminatorLookup) { - this.useOneOfDiscriminatorLookup = useOneOfDiscriminatorLookup; - } - - public boolean getUseOneOfDiscriminatorLookup() { - return this.useOneOfDiscriminatorLookup; - } - - public void setGoImportAlias(String goImportAlias) { - this.goImportAlias = goImportAlias; - } - - @Override - public String toModelName(String name) { - // underscoring would also lowercase the whole name, thus losing acronyms which are in capitals - return camelize(toModel(name, false)); - } - - public String escapeReservedWord(String name) { - if (this.reservedWordsMappings().containsKey(name)) { - return this.reservedWordsMappings().get(name); - } - return name + '_'; - } - - @Override - public String toEnumDefaultValue(String value, String datatype) { - String prefix = ""; - if (enumClassPrefix) { - prefix = datatype.toUpperCase(Locale.ROOT) + "_"; - } - return prefix + value; - } - - @Override - public void updateCodegenPropertyEnum(CodegenProperty var) { - // make sure the inline enums have plain defaults (e.g. string, int, float) - String enumDefault = null; - if (var.isEnum && var.defaultValue != null) { - enumDefault = var.defaultValue; - } - super.updateCodegenPropertyEnum(var); - if (var.isEnum && enumDefault != null) { - var.defaultValue = enumDefault; - } - } - - @Override - public String toDefaultValue(Schema p) { - p = ModelUtils.getReferencedSchema(this.openAPI, p); - if (ModelUtils.isStringSchema(p)) { - if (p.getDefault() != null) { - return "\"" + escapeText((String) p.getDefault()) + "\""; - } - return null; - } - - return super.toDefaultValue(p); - } - - @Override - public CodegenProperty fromProperty(String name, Schema p) { - CodegenProperty prop = super.fromProperty(name, p); - String cc = camelize(prop.name, true); - if (isReservedWord(cc)) { - cc = escapeReservedWord(cc); - } - prop.nameInCamelCase = cc; - return prop; - } - - @Override - public Map<String, Object> postProcessModels(Map<String, Object> objs) { - // The superclass determines the list of required golang imports. The actual list of imports - // depends on which types are used, some of which are changed in the code below (but then preserved - // and used through x-go-base-type in templates). So super.postProcessModels - // must be invoked at the beginning of this method. - objs = super.postProcessModels(objs); - - List<Map<String, String>> imports = (List<Map<String, String>>) objs.get("imports"); - - List<Map<String, Object>> models = (List<Map<String, Object>>) objs.get("models"); - for (Map<String, Object> m : models) { - Object v = m.get("model"); - if (v instanceof CodegenModel) { - CodegenModel model = (CodegenModel) v; - if (model.isEnum) { - continue; - } - - for (CodegenProperty param : model.vars) { - param.vendorExtensions.put("x-go-base-type", param.dataType); - if (!param.isNullable || param.isMapContainer || param.isListContainer || - param.isFreeFormObject || param.isAnyType) { - continue; - } - if (param.isDateTime) { - // Note this could have been done by adding the following line in processOpts(), - // however, we only want to represent the DateTime object as NullableTime if - // it's marked as nullable in the spec. - // typeMapping.put("DateTime", "NullableTime"); - param.dataType = "NullableTime"; - } else { - param.dataType = "Nullable" + Character.toUpperCase(param.dataType.charAt(0)) - + param.dataType.substring(1); - } - } - - // additional import for different cases - // oneOf - if (model.oneOf != null && !model.oneOf.isEmpty()) { - imports.add(createMapping("import", "fmt")); - } - - // anyOf - if (model.anyOf != null && !model.anyOf.isEmpty()) { - imports.add(createMapping("import", "fmt")); - } - - // additionalProperties: true and parent - if (model.isAdditionalPropertiesTrue && model.parent != null && Boolean.FALSE.equals(model.isMapModel)) { - imports.add(createMapping("import", "reflect")); - imports.add(createMapping("import", "strings")); - } - - } - } - return objs; - } - - @Override - public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) { - objs = super.postProcessOperationsWithModels(objs, allModels); - Map<String, Object> operations = (Map<String, Object>) objs.get("operations"); - HashMap<String, CodegenModel> modelMaps = new HashMap<String, CodegenModel>(); - HashMap<String, Integer> processedModelMaps = new HashMap<String, Integer>(); - - for (Object o : allModels) { - HashMap<String, Object> h = (HashMap<String, Object>) o; - CodegenModel m = (CodegenModel) h.get("model"); - modelMaps.put(m.classname, m); - } - - List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation"); - for (CodegenOperation op : operationList) { - for (CodegenParameter p : op.allParams) { - p.vendorExtensions.put("x-go-example", constructExampleCode(p, modelMaps, processedModelMaps)); - } - } - - processedModelMaps.clear(); - for (CodegenOperation operation : operationList) { - for (CodegenParameter cp : operation.allParams) { - cp.vendorExtensions.put("x-go-example", constructExampleCode(cp, modelMaps, processedModelMaps)); - } - } - - return objs; - } - - private String constructExampleCode(CodegenParameter codegenParameter, HashMap<String, CodegenModel> modelMaps, HashMap<String, Integer> processedModelMap) { - if (codegenParameter.isListContainer) { // array - return codegenParameter.dataType + "{" + constructExampleCode(codegenParameter.items, modelMaps, processedModelMap) + "}"; - } else if (codegenParameter.isMapContainer) { - return "map[string]string{ \"Key\" = \"Value\" }"; - } else if (codegenParameter.isPrimitiveType) { // primitive type - if (codegenParameter.isString) { - if (StringUtils.isEmpty(codegenParameter.example)) { - return "\"" + codegenParameter.example + "\""; - } else { - return "\"" + codegenParameter.paramName + "_example\""; - } - } else if (codegenParameter.isBoolean) { // boolean - if (Boolean.parseBoolean(codegenParameter.example)) { - return "true"; - } else { - return "false"; - } - } else if (codegenParameter.isUri) { // URL - return "URL(string: \"https://example.com\")!"; - } else if (codegenParameter.isDateTime || codegenParameter.isDate) { // datetime or date - return "Get-Date"; - } else { // numeric - if (StringUtils.isEmpty(codegenParameter.example)) { - return codegenParameter.example; - } else { - return "987"; - } - } - } else { // model - // look up the model - if (modelMaps.containsKey(codegenParameter.dataType)) { - return constructExampleCode(modelMaps.get(codegenParameter.dataType), modelMaps, processedModelMap); - } else { - //LOGGER.error("Error in constructing examples. Failed to look up the model " + codegenParameter.dataType); - return "TODO"; - } - } - } - - private String constructExampleCode(CodegenProperty codegenProperty, HashMap<String, CodegenModel> modelMaps, HashMap<String, Integer> processedModelMap) { - if (codegenProperty.isListContainer) { // array - return codegenProperty.dataType + "{" + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + ")"; - } else if (codegenProperty.isMapContainer) { // map - return "map[string]string{ \"Key\" = \"Value\" }"; - } else if (codegenProperty.isPrimitiveType) { // primitive type - if (codegenProperty.isString) { - if (StringUtils.isEmpty(codegenProperty.example)) { - return "\"" + codegenProperty.example + "\""; - } else { - return "\"" + codegenProperty.name + "_example\""; - } - } else if (codegenProperty.isBoolean) { // boolean - if (Boolean.parseBoolean(codegenProperty.example)) { - return "true"; - } else { - return "false"; - } - } else if (codegenProperty.isUri) { // URL - return "\"https://example.com\")!"; - } else if (codegenProperty.isDateTime || codegenProperty.isDate) { // datetime or date - return "time.Now()"; - } else { // numeric - String example; - if (StringUtils.isEmpty(codegenProperty.example)) { - example = codegenProperty.example; - } else { - example = "123"; - } - - if (codegenProperty.isLong) { - return "int64(" + example + ")"; - } else { - return example; - } - } - } else { - // look up the model - if (modelMaps.containsKey(codegenProperty.dataType)) { - return constructExampleCode(modelMaps.get(codegenProperty.dataType), modelMaps, processedModelMap); - } else { - //LOGGER.error("Error in constructing examples. Failed to look up the model " + codegenProperty.dataType); - return "\"TODO\""; - } - } - } - - private String constructExampleCode(CodegenModel codegenModel, HashMap<String, CodegenModel> modelMaps, HashMap<String, Integer> processedModelMap) { - String example; - - // break infinite recursion. Return, in case a model is already processed in the current context. - String model = codegenModel.name; - if (processedModelMap.containsKey(model)) { - int count = processedModelMap.get(model); - if (count == 1) { - processedModelMap.put(model, 2); - } else if (count == 2) { - return ""; - } else { - throw new RuntimeException("Invalid count when constructing example: " + count); - } - } else { - processedModelMap.put(model, 1); - } - - example = "" + goImportAlias + "." + codegenModel.name + "{"; - List<String> propertyExamples = new ArrayList<>(); - for (CodegenProperty codegenProperty : codegenModel.allVars) { - propertyExamples.add(codegenProperty.name + ": " + constructExampleCode(codegenProperty, modelMaps, processedModelMap)); - } - example += StringUtils.join(propertyExamples, ", "); - example += "}"; - return example; - } - - -} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoDeprecatedClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoDeprecatedClientCodegen.java new file mode 100644 index 00000000000..46392c1aad6 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoDeprecatedClientCodegen.java @@ -0,0 +1,244 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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.languages; + +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenType; +import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.meta.features.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.util.EnumSet; + +public class GoDeprecatedClientCodegen extends AbstractGoCodegen { + + private static final Logger LOGGER = LoggerFactory.getLogger(GoDeprecatedClientCodegen.class); + + protected String packageVersion = "1.0.0"; + protected String apiDocPath = "docs/"; + protected String modelDocPath = "docs/"; + protected boolean isGoSubmodule = false; + public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment"; + public static final String WITH_XML = "withXml"; + public static final String STRUCT_PREFIX = "structPrefix"; + public static final String WITH_AWSV4_SIGNATURE = "withAWSV4Signature"; + + public GoDeprecatedClientCodegen() { + super(); + + modifyFeatureSet(features -> features + .includeDocumentationFeatures(DocumentationFeature.Readme) + .wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML)) + .securityFeatures(EnumSet.of( + SecurityFeature.BasicAuth, + SecurityFeature.ApiKey, + SecurityFeature.OAuth2_Implicit + )) + .includeGlobalFeatures( + GlobalFeature.ParameterizedServer + ) + .excludeGlobalFeatures( + GlobalFeature.XMLStructureDefinitions, + GlobalFeature.Callbacks, + GlobalFeature.LinkObjects, + GlobalFeature.ParameterStyling + ) + .excludeSchemaSupportFeatures( + SchemaSupportFeature.Polymorphism + ) + .includeParameterFeatures( + ParameterFeature.Cookie + ) + .includeClientModificationFeatures( + ClientModificationFeature.BasePath, + ClientModificationFeature.UserAgent + ) + ); + + outputFolder = "generated-code/go-deprecated"; + modelTemplateFiles.put("model.mustache", ".go"); + apiTemplateFiles.put("api.mustache", ".go"); + + modelDocTemplateFiles.put("model_doc.mustache", ".md"); + apiDocTemplateFiles.put("api_doc.mustache", ".md"); + + embeddedTemplateDir = templateDir = "go-deprecated"; + + // default HIDE_GENERATION_TIMESTAMP to true + hideGenerationTimestamp = Boolean.TRUE; + + cliOptions.add(CliOption.newBoolean(CodegenConstants.IS_GO_SUBMODULE, CodegenConstants.IS_GO_SUBMODULE_DESC)); + cliOptions.add(CliOption.newBoolean(WITH_GO_CODEGEN_COMMENT, "whether to include Go codegen comment to disable Go Lint and collapse by default in GitHub PRs and diffs")); + cliOptions.add(CliOption.newBoolean(WITH_XML, "whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)")); + cliOptions.add(CliOption.newBoolean(CodegenConstants.ENUM_CLASS_PREFIX, CodegenConstants.ENUM_CLASS_PREFIX_DESC)); + cliOptions.add(CliOption.newBoolean(STRUCT_PREFIX, "whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts")); + cliOptions.add(CliOption.newBoolean(WITH_AWSV4_SIGNATURE, "whether to include AWS v4 signature support")); + + // option to change the order of form/body parameter + cliOptions.add(CliOption.newBoolean( + CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, + CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS_DESC) + .defaultValue(Boolean.FALSE.toString())); + } + + @Override + public void processOpts() { + super.processOpts(); + + if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { + setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); + } else { + setPackageName("openapi"); + } + + if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) { + setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION)); + } else { + setPackageVersion("1.0.0"); + } + + additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); + additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion); + + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); + + modelPackage = packageName; + apiPackage = packageName; + + supportingFiles.add(new SupportingFile("openapi.mustache", "api", "openapi.yaml")); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); + supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.go")); + supportingFiles.add(new SupportingFile("client.mustache", "", "client.go")); + supportingFiles.add(new SupportingFile("response.mustache", "", "response.go")); + supportingFiles.add(new SupportingFile("go.mod.mustache", "", "go.mod")); + supportingFiles.add(new SupportingFile("go.sum", "", "go.sum")); + supportingFiles.add(new SupportingFile(".travis.yml", "", ".travis.yml")); + + if (additionalProperties.containsKey(WITH_GO_CODEGEN_COMMENT)) { + setWithGoCodegenComment(Boolean.parseBoolean(additionalProperties.get(WITH_GO_CODEGEN_COMMENT).toString())); + additionalProperties.put(WITH_GO_CODEGEN_COMMENT, withGoCodegenComment); + } + + if (additionalProperties.containsKey(WITH_AWSV4_SIGNATURE)) { + setWithAWSV4Signature(Boolean.parseBoolean(additionalProperties.get(WITH_AWSV4_SIGNATURE).toString())); + additionalProperties.put(WITH_AWSV4_SIGNATURE, withAWSV4Signature); + } + + if (additionalProperties.containsKey(WITH_XML)) { + setWithXml(Boolean.parseBoolean(additionalProperties.get(WITH_XML).toString())); + additionalProperties.put(WITH_XML, withXml); + } + + if (additionalProperties.containsKey(CodegenConstants.ENUM_CLASS_PREFIX)) { + setEnumClassPrefix(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.ENUM_CLASS_PREFIX).toString())); + additionalProperties.put(CodegenConstants.ENUM_CLASS_PREFIX, enumClassPrefix); + } + + if (additionalProperties.containsKey(CodegenConstants.IS_GO_SUBMODULE)) { + setIsGoSubmodule(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.IS_GO_SUBMODULE).toString())); + additionalProperties.put(CodegenConstants.IS_GO_SUBMODULE, isGoSubmodule); + } + + if (additionalProperties.containsKey(STRUCT_PREFIX)) { + setStructPrefix(Boolean.parseBoolean(additionalProperties.get(STRUCT_PREFIX).toString())); + additionalProperties.put(STRUCT_PREFIX, structPrefix); + } + } + + /** + * Configures the type of generator. + * + * @return the CodegenType for this generator + * @see org.openapitools.codegen.CodegenType + */ + @Override + public CodegenType getTag() { + return CodegenType.CLIENT; + } + + /** + * Configures a friendly name for the generator. This will be used by the generator + * to select the library with the -g flag. + * + * @return the friendly name for the generator + */ + @Override + public String getName() { + return "go-deprecated"; + } + + /** + * Returns human-friendly help for the generator. Provide the consumer with help + * tips, parameters here + * + * @return A string value for the help message + */ + @Override + public String getHelp() { + return "Generates a Go client library (beta). NOTE: this generator has been dprecated. Please switch to `go` client generator instead."; + } + + /** + * Location to write api files. You can use the apiPackage() as defined when the class is + * instantiated + */ + @Override + public String apiFileFolder() { + return outputFolder + File.separator; + } + + @Override + public String modelFileFolder() { + return outputFolder + File.separator; + } + + @Override + public String apiDocFileFolder() { + return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); + } + + @Override + public String modelDocFileFolder() { + return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); + } + + @Override + public String toModelDocFilename(String name) { + return toModelName(name); + } + + @Override + public String toApiDocFilename(String name) { + return toApiName(name); + } + + public void setPackageVersion(String packageVersion) { + this.packageVersion = packageVersion; + } + + public void setIsGoSubmodule(boolean isGoSubmodule) { + this.isGoSubmodule = isGoSubmodule; + } + +} diff --git a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig index 87020fffa16..bfc8abd4a99 100644 --- a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig +++ b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig @@ -33,8 +33,8 @@ org.openapitools.codegen.languages.ErlangServerCodegen org.openapitools.codegen.languages.FlashClientCodegen org.openapitools.codegen.languages.FsharpFunctionsServerCodegen org.openapitools.codegen.languages.FsharpGiraffeServerCodegen +org.openapitools.codegen.languages.GoDeprecatedClientCodegen org.openapitools.codegen.languages.GoClientCodegen -org.openapitools.codegen.languages.GoClientExperimentalCodegen org.openapitools.codegen.languages.GoServerCodegen org.openapitools.codegen.languages.GoGinServerCodegen org.openapitools.codegen.languages.GraphQLSchemaCodegen diff --git a/modules/openapi-generator/src/main/resources/go-experimental/.travis.yml b/modules/openapi-generator/src/main/resources/go-deprecated/.travis.yml similarity index 100% rename from modules/openapi-generator/src/main/resources/go-experimental/.travis.yml rename to modules/openapi-generator/src/main/resources/go-deprecated/.travis.yml diff --git a/modules/openapi-generator/src/main/resources/go-deprecated/README.mustache b/modules/openapi-generator/src/main/resources/go-deprecated/README.mustache new file mode 100644 index 00000000000..e4e8ffa507d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/go-deprecated/README.mustache @@ -0,0 +1,148 @@ +# Go API client for {{packageName}} + +{{#appDescriptionWithNewLines}} +{{{appDescriptionWithNewLines}}} +{{/appDescriptionWithNewLines}} + +## 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: {{appVersion}} +- Package version: {{packageVersion}} +{{^hideGenerationTimestamp}} +- Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} +- Build package: {{generatorClass}} +{{#infoUrl}} +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +## Installation + +Install the following dependencies: + +```shell +go get github.com/stretchr/testify/assert +go get golang.org/x/oauth2 +{{#withAWSV4Signature}} +go get github.com/aws/aws-sdk-go/aws +{{/withAWSV4Signature}} +go get golang.org/x/net/context +go get github.com/antihax/optional +``` + +Put the package under your project folder and add the following in import: + +```golang +import "./{{packageName}}" +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation For Models + +{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) +{{/model}}{{/models}} + +## Documentation For Authorization + +{{^authMethods}} Endpoints do not require authorization. +{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} +{{#authMethods}} + +## {{{name}}} + +{{#isApiKey}}- **Type**: API key + +Example + +```golang +auth := context.WithValue(context.Background(), {{packageName}}.ContextAPIKey, {{packageName}}.APIKey{ + Key: "APIKEY", + Prefix: "Bearer", // Omit if not necessary. +}) +r, err := client.Service.Operation(auth, args) +``` + +{{/isApiKey}} +{{#isHttpSignature}} +Not supported. + +{{/isHttpSignature}} +{{#isBasicBasic}}- **Type**: HTTP basic authentication + +Example + +```golang +auth := context.WithValue(context.Background(), {{packageName}}.ContextBasicAuth, {{packageName}}.BasicAuth{ + UserName: "username", + Password: "password", +}) +r, err := client.Service.Operation(auth, args) +``` + +{{/isBasicBasic}} +{{#isBasicBearer}}- **Type**: HTTP Bearer token authentication + +Example + +```golang +auth := context.WithValue(context.Background(), {{packageName}}.ContextAccessToken, "BEARERTOKENSTRING") +r, err := client.Service.Operation(auth, args) +``` + +{{/isBasicBearer}} +{{#isOAuth}} + +- **Type**: OAuth +- **Flow**: {{{flow}}} +- **Authorization URL**: {{{authorizationUrl}}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - **{{{scope}}}**: {{{description}}} +{{/scopes}} + +Example + +```golang +auth := context.WithValue(context.Background(), {{packageName}}.ContextAccessToken, "ACCESSTOKENSTRING") +r, err := client.Service.Operation(auth, args) +``` + +Or via OAuth2 module to automatically refresh tokens and perform user authentication. + +```golang +import "golang.org/x/oauth2" + +/* Perform OAuth2 round trip request and obtain a token */ + +tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) +auth := context.WithValue(oauth2.NoContext, {{packageName}}.ContextOAuth2, tokenSource) +r, err := client.Service.Operation(auth, args) +``` + +{{/isOAuth}} +{{/authMethods}} + +{{#withAWSV4Signature}} +Example + +```golang +auth := context.WithValue(context.Background(), {{packageName}}.ContextAWSv4, {{packageName}}.AWSv4{ + AccessKey: "ACCESSKEYSTRING", + SecretKey: "SECRETKEYSTRING", +}) +r, err := client.Service.Operation(auth, args) +``` +{{/withAWSV4Signature}} + +## Author + +{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} +{{/hasMore}}{{/apis}}{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/go-experimental/api.mustache b/modules/openapi-generator/src/main/resources/go-deprecated/api.mustache similarity index 51% rename from modules/openapi-generator/src/main/resources/go-experimental/api.mustache rename to modules/openapi-generator/src/main/resources/go-deprecated/api.mustache index d887bddecc5..e5d81ff292a 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/api.mustache +++ b/modules/openapi-generator/src/main/resources/go-deprecated/api.mustache @@ -7,6 +7,7 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" + _bytes "bytes" {{#imports}} "{{import}}" {{/imports}} ) @@ -18,46 +19,53 @@ var ( // {{classname}}Service {{classname}} service type {{classname}}Service service - {{#operation}} -type api{{operationId}}Request struct { - ctx _context.Context - apiService *{{classname}}Service{{#allParams}} - {{paramName}} {{^isPathParam}}*{{/isPathParam}}{{{dataType}}}{{/allParams}} -} +{{#hasOptionalParams}} +// {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts Optional parameters for the method '{{{nickname}}}' +type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts struct { {{#allParams}} -{{^isPathParam}} -func (r api{{operationId}}Request) {{vendorExtensions.x-export-param-name}}({{paramName}} {{{dataType}}}) api{{operationId}}Request { - r.{{paramName}} = &{{paramName}} - return r -} -{{/isPathParam}} +{{^required}} +{{#isPrimitiveType}} +{{^isBinary}} + {{vendorExtensions.x-export-param-name}} optional.{{vendorExtensions.x-optional-data-type}} +{{/isBinary}} +{{#isBinary}} + {{vendorExtensions.x-export-param-name}} optional.Interface +{{/isBinary}} +{{/isPrimitiveType}} +{{^isPrimitiveType}} + {{vendorExtensions.x-export-param-name}} optional.Interface +{{/isPrimitiveType}} +{{/required}} {{/allParams}} +} + +{{/hasOptionalParams}} /* {{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} {{#notes}} -{{{unescapedNotes}}} +{{notes}} {{/notes}} - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().{{#pathParams}} - * @param {{paramName}}{{#description}} {{{.}}}{{/description}}{{/pathParams}} -@return api{{operationId}}Request -*/ -func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) api{{operationId}}Request { - return api{{operationId}}Request{ - apiService: a, - ctx: ctx,{{#pathParams}} - {{paramName}}: {{paramName}},{{/pathParams}} - } -} - -/* -Execute executes the request + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +{{#allParams}} +{{#required}} + * @param {{paramName}}{{#description}} {{{.}}}{{/description}} +{{/required}} +{{/allParams}} +{{#hasOptionalParams}} + * @param optional nil or *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts - Optional Parameters: +{{#allParams}} +{{^required}} + * @param "{{vendorExtensions.x-export-param-name}}" ({{#isPrimitiveType}}{{^isBinary}}optional.{{vendorExtensions.x-optional-data-type}}{{/isBinary}}{{#isBinary}}optional.Interface of {{dataType}}{{/isBinary}}{{/isPrimitiveType}}{{^isPrimitiveType}}optional.Interface of {{dataType}}{{/isPrimitiveType}}) - {{#description}} {{{.}}}{{/description}} +{{/required}} +{{/allParams}} +{{/hasOptionalParams}} {{#returnType}} -@return {{{.}}} +@return {{{returnType}}} {{/returnType}} */ -func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnType}}*_nethttp.Response, error) { +func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.Method{{httpMethod}} localVarPostBody interface{} @@ -65,66 +73,58 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT localVarFileName string localVarFileBytes []byte {{#returnType}} - localVarReturnValue {{{.}}} + localVarReturnValue {{{returnType}}} {{/returnType}} ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "{{{classname}}}Service.{{{nickname}}}") - if err != nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "{{{path}}}"{{#pathParams}} - localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.PathEscape(parameterToString(r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) , -1){{/pathParams}} + // create path and map variables + localVarPath := a.client.cfg.BasePath + "{{{path}}}"{{#pathParams}} + localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.PathEscape(parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) , -1) + {{/pathParams}} localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} {{#allParams}} {{#required}} - {{^isPathParam}} - if r.{{paramName}} == nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} is required and must be specified") - } - {{/isPathParam}} {{#minItems}} - if len({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) < {{minItems}} { + if len({{paramName}}) < {{minItems}} { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minItems}} elements") } {{/minItems}} {{#maxItems}} - if len({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) > {{maxItems}} { + if len({{paramName}}) > {{maxItems}} { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxItems}} elements") } {{/maxItems}} {{#minLength}} - if strlen({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) < {{minLength}} { + if strlen({{paramName}}) < {{minLength}} { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minLength}} elements") } {{/minLength}} {{#maxLength}} - if strlen({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) > {{maxLength}} { + if strlen({{paramName}}) > {{maxLength}} { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxLength}} elements") } {{/maxLength}} {{#minimum}} {{#isString}} - {{paramName}}Txt, err := atoi({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) + {{paramName}}Txt, err := atoi({{paramName}}) if {{paramName}}Txt < {{minimum}} { {{/isString}} {{^isString}} - if {{^isPathParam}}*{{/isPathParam}}r.{{paramName}} < {{minimum}} { + if {{paramName}} < {{minimum}} { {{/isString}} return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must be greater than {{minimum}}") } {{/minimum}} {{#maximum}} {{#isString}} - {{paramName}}Txt, err := atoi({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) + {{paramName}}Txt, err := atoi({{paramName}}) if {{paramName}}Txt > {{maximum}} { {{/isString}} {{^isString}} - if {{^isPathParam}}*{{/isPathParam}}r.{{paramName}} > {{maximum}} { + if {{paramName}} > {{maximum}} { {{/isString}} return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must be less than {{maximum}}") } @@ -132,11 +132,12 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT {{/required}} {{/allParams}} + {{#hasQueryParams}} {{#queryParams}} {{#required}} {{#isCollectionFormatMulti}} { - t := *r.{{paramName}} + t:={{paramName}} if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { @@ -148,13 +149,13 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT } {{/isCollectionFormatMulti}} {{^isCollectionFormatMulti}} - localVarQueryParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) + localVarQueryParams.Add("{{baseName}}", parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) {{/isCollectionFormatMulti}} {{/required}} {{^required}} - if r.{{paramName}} != nil { + if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-export-param-name}}.IsSet() { {{#isCollectionFormatMulti}} - t := *r.{{paramName}} + t:=localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value() if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { @@ -165,11 +166,12 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT } {{/isCollectionFormatMulti}} {{^isCollectionFormatMulti}} - localVarQueryParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) + localVarQueryParams.Add("{{baseName}}", parameterToString(localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) {{/isCollectionFormatMulti}} } {{/required}} {{/queryParams}} + {{/hasQueryParams}} // to determine the Content-Type header {{=<% %>=}} localVarHTTPContentTypes := []string{<%#consumes%>"<%&mediaType%>"<%^-last%>, <%/-last%><%/consumes%>} @@ -191,26 +193,33 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } +{{#hasHeaderParams}} {{#headerParams}} {{#required}} - localVarHeaderParams["{{baseName}}"] = parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}") + localVarHeaderParams["{{baseName}}"] = parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}") {{/required}} {{^required}} - if r.{{paramName}} != nil { - localVarHeaderParams["{{baseName}}"] = parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}") + if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-export-param-name}}.IsSet() { + localVarHeaderParams["{{baseName}}"] = parameterToString(localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}") } {{/required}} {{/headerParams}} +{{/hasHeaderParams}} +{{#hasFormParams}} {{#formParams}} {{#isFile}} localVarFormFileName = "{{baseName}}" {{#required}} - localVarFile := *r.{{paramName}} + localVarFile := {{paramName}} {{/required}} {{^required}} var localVarFile {{dataType}} - if r.{{paramName}} != nil { - localVarFile = *r.{{paramName}} + if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-export-param-name}}.IsSet() { + localVarFileOk := false + localVarFile, localVarFileOk = localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value().({{dataType}}) + if !localVarFileOk { + return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} should be {{dataType}}") + } } {{/required}} if localVarFile != nil { @@ -222,12 +231,12 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT {{/isFile}} {{^isFile}} {{#required}} - localVarFormParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) + localVarFormParams.Add("{{baseName}}", parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) {{/required}} {{^required}} {{#isModel}} - if r.{{paramName}} != nil { - paramJson, err := parameterToJson(*r.{{paramName}}) + if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-export-param-name}}.IsSet() { + paramJson, err := parameterToJson(localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value()) if err != nil { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err } @@ -235,65 +244,73 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT } {{/isModel}} {{^isModel}} - if r.{{paramName}} != nil { - localVarFormParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) + if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-export-param-name}}.IsSet() { + localVarFormParams.Add("{{baseName}}", parameterToString(localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) } {{/isModel}} {{/required}} {{/isFile}} {{/formParams}} +{{/hasFormParams}} +{{#hasBodyParam}} {{#bodyParams}} // body params - localVarPostBody = r.{{paramName}} +{{#required}} + localVarPostBody = &{{paramName}} +{{/required}} +{{^required}} + if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-export-param-name}}.IsSet() { + {{#isPrimitiveType}} + localVarPostBody = localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value() + {{/isPrimitiveType}} + {{^isPrimitiveType}} + localVarOptional{{vendorExtensions.x-export-param-name}}, localVarOptional{{vendorExtensions.x-export-param-name}}ok := localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value().({{{dataType}}}) + if !localVarOptional{{vendorExtensions.x-export-param-name}}ok { + return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} should be {{dataType}}") + } + localVarPostBody = &localVarOptional{{vendorExtensions.x-export-param-name}} + {{/isPrimitiveType}} + } + +{{/required}} {{/bodyParams}} +{{/hasBodyParam}} {{#authMethods}} {{#isApiKey}} {{^isKeyInCookie}} - if r.ctx != nil { + if ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { - {{#vendorExtensions.x-auth-id-alias}} - if apiKey, ok := auth["{{.}}"]; ok { - var key string - if prefix, ok := auth["{{name}}"]; ok && prefix.Prefix != "" { - key = prefix.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - {{/vendorExtensions.x-auth-id-alias}} - {{^vendorExtensions.x-auth-id-alias}} - if apiKey, ok := auth["{{name}}"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - {{/vendorExtensions.x-auth-id-alias}} - {{#isKeyInHeader}} - localVarHeaderParams["{{keyParamName}}"] = key - {{/isKeyInHeader}} - {{#isKeyInQuery}} - localVarQueryParams.Add("{{keyParamName}}", key) - {{/isKeyInQuery}} + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key } + {{#isKeyInHeader}} + localVarHeaderParams["{{keyParamName}}"] = key + {{/isKeyInHeader}} + {{#isKeyInQuery}} + localVarQueryParams.Add("{{keyParamName}}", key) + {{/isKeyInQuery}} } } {{/isKeyInCookie}} {{/isApiKey}} {{/authMethods}} - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(r) if err != nil || localVarHTTPResponse == nil { return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err } localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody)) if err != nil { return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err } @@ -311,7 +328,7 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT if localVarHTTPResponse.StatusCode == {{{code}}} { {{/wildcard}} var v {{{dataType}}} - err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, newErr @@ -331,7 +348,7 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT } {{#returnType}} - err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, diff --git a/modules/openapi-generator/src/main/resources/go-deprecated/api_doc.mustache b/modules/openapi-generator/src/main/resources/go-deprecated/api_doc.mustache new file mode 100644 index 00000000000..5ddad640ca3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/go-deprecated/api_doc.mustache @@ -0,0 +1,59 @@ +# {{invokerPackage}}\{{classname}}{{#description}} + +{{description}}{{/description}} + +All URIs are relative to *{{basePath}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} + +## {{{operationId}}} + +> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}(ctx, {{#allParams}}{{#required}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}optional{{/hasOptionalParams}}) + +{{{summary}}}{{#notes}} + +{{{notes}}}{{/notes}} + +### Required Parameters + +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.{{/-last}}{{/allParams}}{{#allParams}}{{#required}} +**{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{#hasOptionalParams}} + **optional** | ***{{{nickname}}}Opts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a {{{nickname}}}Opts struct +{{#allParams}}{{#-last}} + +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}} +{{^required}} **{{paramName}}** | {{#isFile}}**optional.Interface of {{dataType}}**{{/isFile}}{{#isPrimitiveType}}**optional.{{vendorExtensions.x-optional-data-type}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**optional.Interface of {{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{/hasOptionalParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}} (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + +- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} +- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + +[[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) + +{{/operation}} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/go-experimental/client.mustache b/modules/openapi-generator/src/main/resources/go-deprecated/client.mustache similarity index 91% rename from modules/openapi-generator/src/main/resources/go-experimental/client.mustache rename to modules/openapi-generator/src/main/resources/go-deprecated/client.mustache index 6fe63dcfdf9..8dcefae5f86 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/client.mustache +++ b/modules/openapi-generator/src/main/resources/go-deprecated/client.mustache @@ -9,6 +9,7 @@ import ( "errors" "fmt" "io" + "io/ioutil" "log" "mime/multipart" "net/http" @@ -24,10 +25,14 @@ import ( "unicode/utf8" "golang.org/x/oauth2" + {{#withAWSV4Signature}} + awsv4 "github.com/aws/aws-sdk-go/aws/signer/v4" + awscredentials "github.com/aws/aws-sdk-go/aws/credentials" + {{/withAWSV4Signature}} ) var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?(?:problem\+)?json)`) xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) ) @@ -164,9 +169,9 @@ func parameterToJson(obj interface{}) (string, error) { // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { if c.cfg.Debug { - dump, err := httputil.DumpRequestOut(request, true) + dump, err := httputil.DumpRequestOut(request, true) if err != nil { - return nil, err + return nil, err } log.Printf("\n%s\n", string(dump)) } @@ -183,9 +188,15 @@ func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { } log.Printf("\n%s\n", string(dump)) } + return resp, err } +// ChangeBasePath changes base path to allow switching to mocks +func (c *APIClient) ChangeBasePath(path string) { + c.cfg.BasePath = path +} + // 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 { @@ -346,23 +357,31 @@ func (c *APIClient) prepareRequest( if auth, ok := ctx.Value(ContextAccessToken).(string); ok { localVarRequest.Header.Add("Authorization", "Bearer "+auth) } - } - for header, value := range c.cfg.DefaultHeader { - localVarRequest.Header.Add(header, value) - } -{{#hasHttpSignatureMethods}} - if ctx != nil { - // HTTP Signature Authentication. All request headers must be set (including default headers) - // because the headers may be included in the signature. - if auth, ok := ctx.Value(ContextHttpSignatureAuth).(HttpSignatureAuth); ok { - err = SignRequest(ctx, localVarRequest, auth) + {{#withAWSV4Signature}} + // AWS Signature v4 Authentication + if auth, ok := ctx.Value(ContextAWSv4).(AWSv4); ok { + creds := awscredentials.NewStaticCredentials(auth.AccessKey, auth.SecretKey, "") + signer := awsv4.NewSigner(creds) + var reader *strings.Reader + if body == nil { + reader = strings.NewReader("") + } else { + reader = strings.NewReader(body.String()) + } + timestamp := time.Now() + _, err := signer.Sign(localVarRequest, reader, "oapi", "eu-west-2", timestamp) if err != nil { return nil, err } } + {{/withAWSV4Signature}} } -{{/hasHttpSignatureMethods}} + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil } @@ -374,6 +393,15 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err *s = string(b) return nil } + if f, ok := v.(**os.File); ok { + *f, err = ioutil.TempFile("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + _, err = (*f).Seek(0, io.SeekStart) + return + } if xmlCheck.MatchString(contentType) { if err = xml.Unmarshal(b, v); err != nil { return err @@ -381,15 +409,7 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err 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 { - errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") - } - } else if err = json.Unmarshal(b, v); err != nil { // simple model + if err = json.Unmarshal(b, v); err != nil { return err } return nil diff --git a/modules/openapi-generator/src/main/resources/go-deprecated/configuration.mustache b/modules/openapi-generator/src/main/resources/go-deprecated/configuration.mustache new file mode 100644 index 00000000000..b21d2a13a23 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/go-deprecated/configuration.mustache @@ -0,0 +1,161 @@ +{{>partial_header}} +package {{packageName}} + +import ( + "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 ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKey takes an APIKey as authentication for the request + ContextAPIKey = contextKey("apikey") + + {{#withAWSV4Signature}} + // ContextAWSv4 takes an Access Key and a Secret Key for signing AWS Signature v4. + ContextAWSv4 = contextKey("awsv4") + {{/withAWSV4Signature}} +) + +// 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 +} + +{{#withAWSV4Signature}} +// AWSv4 provides AWS Signature to a request passed via context using ContextAWSv4 +// https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html +type AWSv4 struct { + AccessKey string + SecretKey string +} +{{/withAWSV4Signature}} + +// 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 +} + +// Configuration stores the configuration of the API client +type Configuration struct { + BasePath string `json:"basePath,omitempty"` + 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 []ServerConfiguration + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + BasePath: "{{{basePath}}}", + DefaultHeader: make(map[string]string), + UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/go{{/httpUserAgent}}", + Debug: false, + {{#servers}} + {{#-first}} + Servers: []ServerConfiguration{ + {{/-first}} + { + Url: "{{{url}}}", + Description: "{{{description}}}{{^description}}No description provided{{/description}}", + {{#variables}} + {{#-first}} + Variables: map[string]ServerVariable{ + {{/-first}} + "{{{name}}}": ServerVariable{ + Description: "{{{description}}}{{^description}}No description provided{{/description}}", + DefaultValue: "{{{defaultValue}}}", + {{#enumValues}} + {{#-first}} + EnumValues: []string{ + {{/-first}} + "{{{.}}}", + {{#-last}} + }, + {{/-last}} + {{/enumValues}} + }, + {{#-last}} + }, + {{/-last}} + {{/variables}} + }, + {{#-last}} + }, + {{/-last}} + {{/servers}} + } + 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 +} + +// ServerUrl returns URL based on server settings +func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) { + if index < 0 || len(c.Servers) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1) + } + server := c.Servers[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 +} diff --git a/modules/openapi-generator/src/main/resources/go-experimental/git_push.sh.mustache b/modules/openapi-generator/src/main/resources/go-deprecated/git_push.sh.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/go-experimental/git_push.sh.mustache rename to modules/openapi-generator/src/main/resources/go-deprecated/git_push.sh.mustache diff --git a/modules/openapi-generator/src/main/resources/go-experimental/gitignore.mustache b/modules/openapi-generator/src/main/resources/go-deprecated/gitignore.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/go-experimental/gitignore.mustache rename to modules/openapi-generator/src/main/resources/go-deprecated/gitignore.mustache diff --git a/modules/openapi-generator/src/main/resources/go-experimental/go.mod.mustache b/modules/openapi-generator/src/main/resources/go-deprecated/go.mod.mustache similarity index 58% rename from modules/openapi-generator/src/main/resources/go-experimental/go.mod.mustache rename to modules/openapi-generator/src/main/resources/go-deprecated/go.mod.mustache index 3b7d202ac4f..6c31cf3e9f1 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/go.mod.mustache +++ b/modules/openapi-generator/src/main/resources/go-deprecated/go.mod.mustache @@ -1,7 +1,7 @@ module {{gitHost}}/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}{{/isGoSubmodule}} -go 1.13 - require ( + github.com/antihax/optional v1.0.0 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 + {{#withAWSV4Signature}}github.com/aws/aws-sdk-go v1.26.3{{/withAWSV4Signature}} ) diff --git a/modules/openapi-generator/src/main/resources/go-experimental/go.sum b/modules/openapi-generator/src/main/resources/go-deprecated/go.sum similarity index 89% rename from modules/openapi-generator/src/main/resources/go-experimental/go.sum rename to modules/openapi-generator/src/main/resources/go-deprecated/go.sum index ce55b3c6a08..ee695202297 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/go.sum +++ b/modules/openapi-generator/src/main/resources/go-deprecated/go.sum @@ -1,6 +1,8 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/aws/aws-sdk-go v1.26.3 h1:szQdfJcUBAhQT0zZEx4sxoDuWb7iScoucxCiVxDmaBk= +github.com/aws/aws-sdk-go v1.26.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= 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= diff --git a/modules/openapi-generator/src/main/resources/go-deprecated/model.mustache b/modules/openapi-generator/src/main/resources/go-deprecated/model.mustache new file mode 100644 index 00000000000..f30047a9e21 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/go-deprecated/model.mustache @@ -0,0 +1,43 @@ +{{>partial_header}} +package {{packageName}} +{{#models}} +{{#imports}} +{{#-first}} +import ( +{{/-first}} + "{{import}}" +{{#-last}} +) +{{/-last}} +{{/imports}} +{{#model}} +{{#isEnum}} +// {{{classname}}} {{#description}}{{{.}}}{{/description}}{{^description}}the model '{{{classname}}}'{{/description}} +type {{{classname}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/format}} + +// List of {{{name}}} +const ( + {{#allowableValues}} + {{#enumVars}} + {{^-first}} + {{/-first}} + {{#enumClassPrefix}}{{{classname.toUpperCase}}}_{{/enumClassPrefix}}{{name}} {{{classname}}} = {{{value}}} + {{/enumVars}} + {{/allowableValues}} +) +{{/isEnum}} +{{^isEnum}} +// {{classname}}{{#description}} {{{description}}}{{/description}}{{^description}} struct for {{{classname}}}{{/description}} +type {{classname}} struct { +{{#allVars}} +{{^-first}} +{{/-first}} +{{#description}} + // {{{description}}} +{{/description}} + {{name}} {{#isNullable}}*{{/isNullable}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` +{{/allVars}} +} +{{/isEnum}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/go-deprecated/model_doc.mustache b/modules/openapi-generator/src/main/resources/go-deprecated/model_doc.mustache new file mode 100644 index 00000000000..ae517d4a75a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/go-deprecated/model_doc.mustache @@ -0,0 +1,12 @@ +{{#models}}{{#model}}# {{classname}} + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#allVars}}**{{name}}** | {{#isNullable}}Pointer to {{/isNullable}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} +{{/allVars}} + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/go-experimental/openapi.mustache b/modules/openapi-generator/src/main/resources/go-deprecated/openapi.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/go-experimental/openapi.mustache rename to modules/openapi-generator/src/main/resources/go-deprecated/openapi.mustache diff --git a/modules/openapi-generator/src/main/resources/go-experimental/partial_header.mustache b/modules/openapi-generator/src/main/resources/go-deprecated/partial_header.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/go-experimental/partial_header.mustache rename to modules/openapi-generator/src/main/resources/go-deprecated/partial_header.mustache diff --git a/modules/openapi-generator/src/main/resources/go-experimental/response.mustache b/modules/openapi-generator/src/main/resources/go-deprecated/response.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/go-experimental/response.mustache rename to modules/openapi-generator/src/main/resources/go-deprecated/response.mustache diff --git a/modules/openapi-generator/src/main/resources/go-experimental/README.mustache b/modules/openapi-generator/src/main/resources/go-experimental/README.mustache deleted file mode 100644 index 45897979f3f..00000000000 --- a/modules/openapi-generator/src/main/resources/go-experimental/README.mustache +++ /dev/null @@ -1,215 +0,0 @@ -# Go API client for {{packageName}} - -{{#appDescriptionWithNewLines}} -{{{appDescriptionWithNewLines}}} -{{/appDescriptionWithNewLines}} - -## 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: {{appVersion}} -- Package version: {{packageVersion}} -{{^hideGenerationTimestamp}} -- Build date: {{generatedDate}} -{{/hideGenerationTimestamp}} -- Build package: {{generatorClass}} -{{#infoUrl}} -For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) -{{/infoUrl}} - -## Installation - -Install the following dependencies: - -```shell -go get github.com/stretchr/testify/assert -go get golang.org/x/oauth2 -go get golang.org/x/net/context -``` - -Put the package under your project folder and add the following in import: - -```golang -import sw "./{{packageName}}" -``` - -## 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(), sw.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(), sw.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 identifield 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. - -``` -ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{ - "{classname}Service.{nickname}": 2, -}) -ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{ - "{classname}Service.{nickname}": { - "port": "8443", - }, -}) -``` - -## Documentation for API Endpoints - -All URIs are relative to *{{basePath}}* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} -{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} - -## Documentation For Models - -{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) -{{/model}}{{/models}} - -## Documentation For Authorization - -{{^authMethods}} Endpoints do not require authorization. -{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} -{{#authMethods}} - -### {{{name}}} - -{{#isApiKey}} -- **Type**: API key -- **API key parameter name**: {{{keyParamName}}} -- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - -Note, each API key must be added to a map of `map[string]APIKey` where the key is: {{keyParamName}} and passed in as the auth context for each request. - -{{/isApiKey}} -{{#isBasic}} -{{#isBasicBearer}} -- **Type**: HTTP Bearer token authentication - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARERTOKENSTRING") -r, err := client.Service.Operation(auth, args) -``` - -{{/isBasicBearer}} -{{#isBasicBasic}} -- **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) -``` - -{{/isBasicBasic}} -{{#isHttpSignature}} -- **Type**: HTTP signature authentication - -Example - -```golang - authConfig := sw.HttpSignatureAuth{ - KeyId: "my-key-id", - PrivateKeyPath: "rsa.pem", - Passphrase: "my-passphrase", - SigningScheme: sw.HttpSigningSchemeHs2019, - SignedHeaders: []string{ - sw.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target. - sw.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value. - "Host", // The Host request header specifies the domain name of the server, and optionally the TCP port number. - "Date", // The date and time at which the message was originated. - "Content-Type", // The Media type of the body of the request. - "Digest", // A cryptographic digest of the request body. - }, - SigningAlgorithm: sw.HttpSigningAlgorithmRsaPSS, - SignatureMaxValidity: 5 * time.Minute, - } - var authCtx context.Context - var err error - if authCtx, err = authConfig.ContextWithValue(context.Background()); err != nil { - // Process error - } - r, err = client.Service.Operation(auth, args) - -``` -{{/isHttpSignature}} -{{/isBasic}} -{{#isOAuth}} - -- **Type**: OAuth -- **Flow**: {{{flow}}} -- **Authorization URL**: {{{authorizationUrl}}} -- **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}} - **{{{scope}}}**: {{{description}}} -{{/scopes}} - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") -r, err := client.Service.Operation(auth, args) -``` - -Or via OAuth2 module to automatically refresh tokens and perform user authentication. - -```golang -import "golang.org/x/oauth2" - -/* Perform OAuth2 round trip request and obtain a token */ - -tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) -auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) -r, err := client.Service.Operation(auth, args) -``` - -{{/isOAuth}} -{{/authMethods}} - -## 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 - -{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} -{{/hasMore}}{{/apis}}{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache b/modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache deleted file mode 100644 index 0ab0d27a346..00000000000 --- a/modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache +++ /dev/null @@ -1,89 +0,0 @@ -# {{invokerPackage}}\{{classname}}{{#description}} - -{{description}}{{/description}} - -All URIs are relative to *{{basePath}}* - -Method | HTTP request | Description -------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} -{{/operation}}{{/operations}} - -{{#operations}} -{{#operation}} - -## {{{operationId}}} - -> {{#returnType}}{{{.}}} {{/returnType}}{{{operationId}}}(ctx{{#pathParams}}, {{paramName}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{vendorExtensions.x-export-param-name}}({{paramName}}){{/isPathParam}}{{/allParams}}.Execute() - -{{{summary}}}{{#notes}} - -{{{unespacedNotes}}}{{/notes}} - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - {{goImportAlias}} "./openapi" -) - -func main() { - {{#allParams}} - {{paramName}} := {{{vendorExtensions.x-go-example}}} // {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} - {{/allParams}} - - configuration := {{goImportAlias}}.NewConfiguration() - api_client := {{goImportAlias}}.NewAPIClient(configuration) - resp, r, err := api_client.{{classname}}.{{operationId}}(context.Background(), {{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}}.{{{vendorExtensions.x-export-param-name}}}({{{paramName}}}){{/optionalParams}}.Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `{{classname}}.{{operationId}}``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - {{#returnType}} - // response from `{{operationId}}`: {{{.}}} - fmt.Fprintf(os.Stdout, "Response from `{{classname}}.{{operationId}}`: %v\n", resp) - {{/returnType}} -} -``` - -### Path Parameters - -{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#pathParams}}{{#-last}} -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.{{/-last}}{{/pathParams}}{{#pathParams}} -**{{paramName}}** | {{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/pathParams}} - -### Other Parameters - -Other parameters are passed through a pointer to a api{{{nickname}}}Request struct via the builder pattern -{{#allParams}}{{#-last}} - -Name | Type | Description | Notes -------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}} -{{^isPathParam}} **{{paramName}}** | {{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/isPathParam}}{{/allParams}} - -### Return type - -{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}} (empty response body){{/returnType}} - -### Authorization - -{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} - -### HTTP request headers - -- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} -- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} - -[[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) - -{{/operation}} -{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/go-experimental/configuration.mustache b/modules/openapi-generator/src/main/resources/go-experimental/configuration.mustache deleted file mode 100644 index 3cda1954db8..00000000000 --- a/modules/openapi-generator/src/main/resources/go-experimental/configuration.mustache +++ /dev/null @@ -1,289 +0,0 @@ -{{>partial_header}} -package {{packageName}} - -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 ( - // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. - ContextOAuth2 = contextKey("token") - - // ContextBasicAuth takes BasicAuth as authentication for the request. - ContextBasicAuth = contextKey("basic") - - // ContextAccessToken takes a string oauth2 access token as authentication for the request. - ContextAccessToken = contextKey("accesstoken") - - // ContextAPIKeys takes a string apikey as authentication for the request - ContextAPIKeys = contextKey("apiKeys") - - // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. - ContextHttpSignatureAuth = contextKey("httpsignature") - - // 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: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/go{{/httpUserAgent}}", - Debug: false, - {{#servers}} - {{#-first}} - Servers: ServerConfigurations{ - {{/-first}} - { - URL: "{{{url}}}", - Description: "{{{description}}}{{^description}}No description provided{{/description}}", - {{#variables}} - {{#-first}} - Variables: map[string]ServerVariable{ - {{/-first}} - "{{{name}}}": ServerVariable{ - Description: "{{{description}}}{{^description}}No description provided{{/description}}", - DefaultValue: "{{{defaultValue}}}", - {{#enumValues}} - {{#-first}} - EnumValues: []string{ - {{/-first}} - "{{{.}}}", - {{#-last}} - }, - {{/-last}} - {{/enumValues}} - }, - {{#-last}} - }, - {{/-last}} - {{/variables}} - }, - {{#-last}} - }, - {{/-last}} - {{/servers}} - {{#apiInfo}} - OperationServers: map[string]ServerConfigurations{ - {{#apis}} - {{#operations}} - {{#operation}} - {{#servers}} - {{#-first}} - "{{{classname}}}Service.{{{nickname}}}": { - {{/-first}} - { - URL: "{{{url}}}", - Description: "{{{description}}}{{^description}}No description provided{{/description}}", - {{#variables}} - {{#-first}} - Variables: map[string]ServerVariable{ - {{/-first}} - "{{{name}}}": ServerVariable{ - Description: "{{{description}}}{{^description}}No description provided{{/description}}", - DefaultValue: "{{{defaultValue}}}", - {{#enumValues}} - {{#-first}} - EnumValues: []string{ - {{/-first}} - "{{{.}}}", - {{#-last}} - }, - {{/-last}} - {{/enumValues}} - }, - {{#-last}} - }, - {{/-last}} - {{/variables}} - }, - {{#-last}} - }, - {{/-last}} - {{/servers}} - {{/operation}} - {{/operations}} - {{/apis}} - }, - {{/apiInfo}} - } - 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) -} diff --git a/modules/openapi-generator/src/main/resources/go-experimental/model.mustache b/modules/openapi-generator/src/main/resources/go-experimental/model.mustache deleted file mode 100644 index 684af1d33c6..00000000000 --- a/modules/openapi-generator/src/main/resources/go-experimental/model.mustache +++ /dev/null @@ -1,20 +0,0 @@ -{{>partial_header}} -package {{packageName}} - -{{#models}} -import ( - "encoding/json" -{{#imports}} - "{{import}}" -{{/imports}} -) - -{{#model}} -{{#isEnum}} -{{>model_enum}} -{{/isEnum}} -{{^isEnum}} -{{#oneOf}}{{#-first}}{{>model_oneof}}{{/-first}}{{/oneOf}}{{^oneOf}}{{#anyOf}}{{#-first}}{{>model_anyof}}{{/-first}}{{/anyOf}}{{^anyOf}}{{>model_simple}}{{/anyOf}}{{/oneOf}} -{{/isEnum}} -{{/model}} -{{/models}} diff --git a/modules/openapi-generator/src/main/resources/go-experimental/model_doc.mustache b/modules/openapi-generator/src/main/resources/go-experimental/model_doc.mustache deleted file mode 100644 index 9045d9fe088..00000000000 --- a/modules/openapi-generator/src/main/resources/go-experimental/model_doc.mustache +++ /dev/null @@ -1,90 +0,0 @@ -{{#models}}{{#model}}# {{classname}} - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -{{#vendorExtensions.x-is-one-of-interface}} -**{{classname}}Interface** | **interface { {{#discriminator}}{{propertyGetter}}() {{propertyType}}{{/discriminator}} }** | An interface that can hold any of the proper implementing types | -{{/vendorExtensions.x-is-one-of-interface}} -{{^vendorExtensions.x-is-one-of-interface}} -{{#vars}}**{{name}}** | {{^required}}Pointer to {{/required}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} -{{/vars}} -{{/vendorExtensions.x-is-one-of-interface}} - -{{^isEnum}} -## Methods - -{{^vendorExtensions.x-is-one-of-interface}} -### New{{classname}} - -`func New{{classname}}({{#vars}}{{#required}}{{nameInCamelCase}} {{dataType}}, {{/required}}{{/vars}}) *{{classname}}` - -New{{classname}} instantiates a new {{classname}} 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 - -### New{{classname}}WithDefaults - -`func New{{classname}}WithDefaults() *{{classname}}` - -New{{classname}}WithDefaults instantiates a new {{classname}} 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 - -{{#vars}} -### Get{{name}} - -`func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-go-base-type}}` - -Get{{name}} returns the {{name}} field if non-nil, zero value otherwise. - -### Get{{name}}Ok - -`func (o *{{classname}}) Get{{name}}Ok() (*{{vendorExtensions.x-go-base-type}}, bool)` - -Get{{name}}Ok 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. - -### Set{{name}} - -`func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-go-base-type}})` - -Set{{name}} sets {{name}} field to given value. - -{{^required}} -### Has{{name}} - -`func (o *{{classname}}) Has{{name}}() bool` - -Has{{name}} returns a boolean if a field has been set. -{{/required}} - -{{#isNullable}} -### Set{{name}}Nil - -`func (o *{{classname}}) Set{{name}}Nil(b bool)` - - Set{{name}}Nil sets the value for {{name}} to be an explicit nil - -### Unset{{name}} -`func (o *{{classname}}) Unset{{name}}()` - -Unset{{name}} ensures that no value is present for {{name}}, not even an explicit nil -{{/isNullable}} -{{/vars}} -{{#vendorExtensions.x-implements}} - -### As{{{.}}} - -`func (s *{{classname}}) As{{{.}}}() {{{.}}}` - -Convenience method to wrap this instance of {{classname}} in {{{.}}} -{{/vendorExtensions.x-implements}} -{{/vendorExtensions.x-is-one-of-interface}} -{{/isEnum}} - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - -{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/go/README.mustache b/modules/openapi-generator/src/main/resources/go/README.mustache index e4e8ffa507d..45897979f3f 100644 --- a/modules/openapi-generator/src/main/resources/go/README.mustache +++ b/modules/openapi-generator/src/main/resources/go/README.mustache @@ -24,17 +24,54 @@ Install the following dependencies: ```shell go get github.com/stretchr/testify/assert go get golang.org/x/oauth2 -{{#withAWSV4Signature}} -go get github.com/aws/aws-sdk-go/aws -{{/withAWSV4Signature}} go get golang.org/x/net/context -go get github.com/antihax/optional ``` Put the package under your project folder and add the following in import: ```golang -import "./{{packageName}}" +import sw "./{{packageName}}" +``` + +## 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(), sw.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(), sw.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 identifield 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. + +``` +ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) ``` ## Documentation for API Endpoints @@ -57,31 +94,35 @@ Class | Method | HTTP request | Description {{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} {{#authMethods}} -## {{{name}}} +### {{{name}}} -{{#isApiKey}}- **Type**: API key +{{#isApiKey}} +- **Type**: API key +- **API key parameter name**: {{{keyParamName}}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} + +Note, each API key must be added to a map of `map[string]APIKey` where the key is: {{keyParamName}} and passed in as the auth context for each request. + +{{/isApiKey}} +{{#isBasic}} +{{#isBasicBearer}} +- **Type**: HTTP Bearer token authentication Example ```golang -auth := context.WithValue(context.Background(), {{packageName}}.ContextAPIKey, {{packageName}}.APIKey{ - Key: "APIKEY", - Prefix: "Bearer", // Omit if not necessary. -}) +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARERTOKENSTRING") r, err := client.Service.Operation(auth, args) ``` -{{/isApiKey}} -{{#isHttpSignature}} -Not supported. - -{{/isHttpSignature}} -{{#isBasicBasic}}- **Type**: HTTP basic authentication +{{/isBasicBearer}} +{{#isBasicBasic}} +- **Type**: HTTP basic authentication Example ```golang -auth := context.WithValue(context.Background(), {{packageName}}.ContextBasicAuth, {{packageName}}.BasicAuth{ +auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ UserName: "username", Password: "password", }) @@ -89,16 +130,38 @@ r, err := client.Service.Operation(auth, args) ``` {{/isBasicBasic}} -{{#isBasicBearer}}- **Type**: HTTP Bearer token authentication +{{#isHttpSignature}} +- **Type**: HTTP signature authentication Example ```golang -auth := context.WithValue(context.Background(), {{packageName}}.ContextAccessToken, "BEARERTOKENSTRING") -r, err := client.Service.Operation(auth, args) -``` + authConfig := sw.HttpSignatureAuth{ + KeyId: "my-key-id", + PrivateKeyPath: "rsa.pem", + Passphrase: "my-passphrase", + SigningScheme: sw.HttpSigningSchemeHs2019, + SignedHeaders: []string{ + sw.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target. + sw.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value. + "Host", // The Host request header specifies the domain name of the server, and optionally the TCP port number. + "Date", // The date and time at which the message was originated. + "Content-Type", // The Media type of the body of the request. + "Digest", // A cryptographic digest of the request body. + }, + SigningAlgorithm: sw.HttpSigningAlgorithmRsaPSS, + SignatureMaxValidity: 5 * time.Minute, + } + var authCtx context.Context + var err error + if authCtx, err = authConfig.ContextWithValue(context.Background()); err != nil { + // Process error + } + r, err = client.Service.Operation(auth, args) -{{/isBasicBearer}} +``` +{{/isHttpSignature}} +{{/isBasic}} {{#isOAuth}} - **Type**: OAuth @@ -111,7 +174,7 @@ r, err := client.Service.Operation(auth, args) Example ```golang -auth := context.WithValue(context.Background(), {{packageName}}.ContextAccessToken, "ACCESSTOKENSTRING") +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") r, err := client.Service.Operation(auth, args) ``` @@ -123,24 +186,28 @@ import "golang.org/x/oauth2" /* Perform OAuth2 round trip request and obtain a token */ tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) -auth := context.WithValue(oauth2.NoContext, {{packageName}}.ContextOAuth2, tokenSource) +auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) r, err := client.Service.Operation(auth, args) ``` {{/isOAuth}} {{/authMethods}} -{{#withAWSV4Signature}} -Example - -```golang -auth := context.WithValue(context.Background(), {{packageName}}.ContextAWSv4, {{packageName}}.AWSv4{ - AccessKey: "ACCESSKEYSTRING", - SecretKey: "SECRETKEYSTRING", -}) -r, err := client.Service.Operation(auth, args) -``` -{{/withAWSV4Signature}} +## 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 diff --git a/modules/openapi-generator/src/main/resources/go/api.mustache b/modules/openapi-generator/src/main/resources/go/api.mustache index e5d81ff292a..d887bddecc5 100644 --- a/modules/openapi-generator/src/main/resources/go/api.mustache +++ b/modules/openapi-generator/src/main/resources/go/api.mustache @@ -7,7 +7,6 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - _bytes "bytes" {{#imports}} "{{import}}" {{/imports}} ) @@ -19,53 +18,46 @@ var ( // {{classname}}Service {{classname}} service type {{classname}}Service service + {{#operation}} +type api{{operationId}}Request struct { + ctx _context.Context + apiService *{{classname}}Service{{#allParams}} + {{paramName}} {{^isPathParam}}*{{/isPathParam}}{{{dataType}}}{{/allParams}} +} -{{#hasOptionalParams}} -// {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts Optional parameters for the method '{{{nickname}}}' -type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts struct { {{#allParams}} -{{^required}} -{{#isPrimitiveType}} -{{^isBinary}} - {{vendorExtensions.x-export-param-name}} optional.{{vendorExtensions.x-optional-data-type}} -{{/isBinary}} -{{#isBinary}} - {{vendorExtensions.x-export-param-name}} optional.Interface -{{/isBinary}} -{{/isPrimitiveType}} -{{^isPrimitiveType}} - {{vendorExtensions.x-export-param-name}} optional.Interface -{{/isPrimitiveType}} -{{/required}} -{{/allParams}} +{{^isPathParam}} +func (r api{{operationId}}Request) {{vendorExtensions.x-export-param-name}}({{paramName}} {{{dataType}}}) api{{operationId}}Request { + r.{{paramName}} = &{{paramName}} + return r } - -{{/hasOptionalParams}} +{{/isPathParam}} +{{/allParams}} /* {{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} {{#notes}} -{{notes}} +{{{unescapedNotes}}} {{/notes}} - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). -{{#allParams}} -{{#required}} - * @param {{paramName}}{{#description}} {{{.}}}{{/description}} -{{/required}} -{{/allParams}} -{{#hasOptionalParams}} - * @param optional nil or *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts - Optional Parameters: -{{#allParams}} -{{^required}} - * @param "{{vendorExtensions.x-export-param-name}}" ({{#isPrimitiveType}}{{^isBinary}}optional.{{vendorExtensions.x-optional-data-type}}{{/isBinary}}{{#isBinary}}optional.Interface of {{dataType}}{{/isBinary}}{{/isPrimitiveType}}{{^isPrimitiveType}}optional.Interface of {{dataType}}{{/isPrimitiveType}}) - {{#description}} {{{.}}}{{/description}} -{{/required}} -{{/allParams}} -{{/hasOptionalParams}} + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().{{#pathParams}} + * @param {{paramName}}{{#description}} {{{.}}}{{/description}}{{/pathParams}} +@return api{{operationId}}Request +*/ +func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) api{{operationId}}Request { + return api{{operationId}}Request{ + apiService: a, + ctx: ctx,{{#pathParams}} + {{paramName}}: {{paramName}},{{/pathParams}} + } +} + +/* +Execute executes the request {{#returnType}} -@return {{{returnType}}} +@return {{{.}}} {{/returnType}} */ -func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*_nethttp.Response, error) { +func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnType}}*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.Method{{httpMethod}} localVarPostBody interface{} @@ -73,58 +65,66 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams localVarFileName string localVarFileBytes []byte {{#returnType}} - localVarReturnValue {{{returnType}}} + localVarReturnValue {{{.}}} {{/returnType}} ) - // create path and map variables - localVarPath := a.client.cfg.BasePath + "{{{path}}}"{{#pathParams}} - localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.PathEscape(parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) , -1) - {{/pathParams}} + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "{{{classname}}}Service.{{{nickname}}}") + if err != nil { + return {{#returnType}}localVarReturnValue, {{/returnType}}nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "{{{path}}}"{{#pathParams}} + localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.PathEscape(parameterToString(r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) , -1){{/pathParams}} localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} {{#allParams}} {{#required}} + {{^isPathParam}} + if r.{{paramName}} == nil { + return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} is required and must be specified") + } + {{/isPathParam}} {{#minItems}} - if len({{paramName}}) < {{minItems}} { + if len({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) < {{minItems}} { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minItems}} elements") } {{/minItems}} {{#maxItems}} - if len({{paramName}}) > {{maxItems}} { + if len({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) > {{maxItems}} { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxItems}} elements") } {{/maxItems}} {{#minLength}} - if strlen({{paramName}}) < {{minLength}} { + if strlen({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) < {{minLength}} { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minLength}} elements") } {{/minLength}} {{#maxLength}} - if strlen({{paramName}}) > {{maxLength}} { + if strlen({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) > {{maxLength}} { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxLength}} elements") } {{/maxLength}} {{#minimum}} {{#isString}} - {{paramName}}Txt, err := atoi({{paramName}}) + {{paramName}}Txt, err := atoi({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) if {{paramName}}Txt < {{minimum}} { {{/isString}} {{^isString}} - if {{paramName}} < {{minimum}} { + if {{^isPathParam}}*{{/isPathParam}}r.{{paramName}} < {{minimum}} { {{/isString}} return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must be greater than {{minimum}}") } {{/minimum}} {{#maximum}} {{#isString}} - {{paramName}}Txt, err := atoi({{paramName}}) + {{paramName}}Txt, err := atoi({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) if {{paramName}}Txt > {{maximum}} { {{/isString}} {{^isString}} - if {{paramName}} > {{maximum}} { + if {{^isPathParam}}*{{/isPathParam}}r.{{paramName}} > {{maximum}} { {{/isString}} return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must be less than {{maximum}}") } @@ -132,12 +132,11 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams {{/required}} {{/allParams}} - {{#hasQueryParams}} {{#queryParams}} {{#required}} {{#isCollectionFormatMulti}} { - t:={{paramName}} + t := *r.{{paramName}} if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { @@ -149,13 +148,13 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams } {{/isCollectionFormatMulti}} {{^isCollectionFormatMulti}} - localVarQueryParams.Add("{{baseName}}", parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) + localVarQueryParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) {{/isCollectionFormatMulti}} {{/required}} {{^required}} - if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-export-param-name}}.IsSet() { + if r.{{paramName}} != nil { {{#isCollectionFormatMulti}} - t:=localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value() + t := *r.{{paramName}} if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { @@ -166,12 +165,11 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams } {{/isCollectionFormatMulti}} {{^isCollectionFormatMulti}} - localVarQueryParams.Add("{{baseName}}", parameterToString(localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) + localVarQueryParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) {{/isCollectionFormatMulti}} } {{/required}} {{/queryParams}} - {{/hasQueryParams}} // to determine the Content-Type header {{=<% %>=}} localVarHTTPContentTypes := []string{<%#consumes%>"<%&mediaType%>"<%^-last%>, <%/-last%><%/consumes%>} @@ -193,33 +191,26 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } -{{#hasHeaderParams}} {{#headerParams}} {{#required}} - localVarHeaderParams["{{baseName}}"] = parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}") + localVarHeaderParams["{{baseName}}"] = parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}") {{/required}} {{^required}} - if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-export-param-name}}.IsSet() { - localVarHeaderParams["{{baseName}}"] = parameterToString(localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}") + if r.{{paramName}} != nil { + localVarHeaderParams["{{baseName}}"] = parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}") } {{/required}} {{/headerParams}} -{{/hasHeaderParams}} -{{#hasFormParams}} {{#formParams}} {{#isFile}} localVarFormFileName = "{{baseName}}" {{#required}} - localVarFile := {{paramName}} + localVarFile := *r.{{paramName}} {{/required}} {{^required}} var localVarFile {{dataType}} - if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-export-param-name}}.IsSet() { - localVarFileOk := false - localVarFile, localVarFileOk = localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value().({{dataType}}) - if !localVarFileOk { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} should be {{dataType}}") - } + if r.{{paramName}} != nil { + localVarFile = *r.{{paramName}} } {{/required}} if localVarFile != nil { @@ -231,12 +222,12 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams {{/isFile}} {{^isFile}} {{#required}} - localVarFormParams.Add("{{baseName}}", parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) + localVarFormParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) {{/required}} {{^required}} {{#isModel}} - if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-export-param-name}}.IsSet() { - paramJson, err := parameterToJson(localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value()) + if r.{{paramName}} != nil { + paramJson, err := parameterToJson(*r.{{paramName}}) if err != nil { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err } @@ -244,73 +235,65 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams } {{/isModel}} {{^isModel}} - if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-export-param-name}}.IsSet() { - localVarFormParams.Add("{{baseName}}", parameterToString(localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) + if r.{{paramName}} != nil { + localVarFormParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) } {{/isModel}} {{/required}} {{/isFile}} {{/formParams}} -{{/hasFormParams}} -{{#hasBodyParam}} {{#bodyParams}} // body params -{{#required}} - localVarPostBody = &{{paramName}} -{{/required}} -{{^required}} - if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-export-param-name}}.IsSet() { - {{#isPrimitiveType}} - localVarPostBody = localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value() - {{/isPrimitiveType}} - {{^isPrimitiveType}} - localVarOptional{{vendorExtensions.x-export-param-name}}, localVarOptional{{vendorExtensions.x-export-param-name}}ok := localVarOptionals.{{vendorExtensions.x-export-param-name}}.Value().({{{dataType}}}) - if !localVarOptional{{vendorExtensions.x-export-param-name}}ok { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} should be {{dataType}}") - } - localVarPostBody = &localVarOptional{{vendorExtensions.x-export-param-name}} - {{/isPrimitiveType}} - } - -{{/required}} + localVarPostBody = r.{{paramName}} {{/bodyParams}} -{{/hasBodyParam}} {{#authMethods}} {{#isApiKey}} {{^isKeyInCookie}} - if ctx != nil { + if r.ctx != nil { // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + {{#vendorExtensions.x-auth-id-alias}} + if apiKey, ok := auth["{{.}}"]; ok { + var key string + if prefix, ok := auth["{{name}}"]; ok && prefix.Prefix != "" { + key = prefix.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + {{/vendorExtensions.x-auth-id-alias}} + {{^vendorExtensions.x-auth-id-alias}} + if apiKey, ok := auth["{{name}}"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + {{/vendorExtensions.x-auth-id-alias}} + {{#isKeyInHeader}} + localVarHeaderParams["{{keyParamName}}"] = key + {{/isKeyInHeader}} + {{#isKeyInQuery}} + localVarQueryParams.Add("{{keyParamName}}", key) + {{/isKeyInQuery}} } - {{#isKeyInHeader}} - localVarHeaderParams["{{keyParamName}}"] = key - {{/isKeyInHeader}} - {{#isKeyInQuery}} - localVarQueryParams.Add("{{keyParamName}}", key) - {{/isKeyInQuery}} } } {{/isKeyInCookie}} {{/isApiKey}} {{/authMethods}} - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err } localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody)) if err != nil { return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err } @@ -328,7 +311,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams if localVarHTTPResponse.StatusCode == {{{code}}} { {{/wildcard}} var v {{{dataType}}} - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, newErr @@ -348,7 +331,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams } {{#returnType}} - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, diff --git a/modules/openapi-generator/src/main/resources/go/api_doc.mustache b/modules/openapi-generator/src/main/resources/go/api_doc.mustache index 5ddad640ca3..0ab0d27a346 100644 --- a/modules/openapi-generator/src/main/resources/go/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/go/api_doc.mustache @@ -14,29 +14,59 @@ Method | HTTP request | Description ## {{{operationId}}} -> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}(ctx, {{#allParams}}{{#required}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}optional{{/hasOptionalParams}}) +> {{#returnType}}{{{.}}} {{/returnType}}{{{operationId}}}(ctx{{#pathParams}}, {{paramName}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{vendorExtensions.x-export-param-name}}({{paramName}}){{/isPathParam}}{{/allParams}}.Execute() {{{summary}}}{{#notes}} -{{{notes}}}{{/notes}} - -### Required Parameters - -{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +{{{unespacedNotes}}}{{/notes}} + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + {{goImportAlias}} "./openapi" +) + +func main() { + {{#allParams}} + {{paramName}} := {{{vendorExtensions.x-go-example}}} // {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} + {{/allParams}} + + configuration := {{goImportAlias}}.NewConfiguration() + api_client := {{goImportAlias}}.NewAPIClient(configuration) + resp, r, err := api_client.{{classname}}.{{operationId}}(context.Background(), {{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}}.{{{vendorExtensions.x-export-param-name}}}({{{paramName}}}){{/optionalParams}}.Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `{{classname}}.{{operationId}}``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + {{#returnType}} + // response from `{{operationId}}`: {{{.}}} + fmt.Fprintf(os.Stdout, "Response from `{{classname}}.{{operationId}}`: %v\n", resp) + {{/returnType}} +} +``` + +### Path Parameters + +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#pathParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.{{/-last}}{{/allParams}}{{#allParams}}{{#required}} -**{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{#hasOptionalParams}} - **optional** | ***{{{nickname}}}Opts** | optional parameters | nil if no parameters +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.{{/-last}}{{/pathParams}}{{#pathParams}} +**{{paramName}}** | {{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/pathParams}} -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a {{{nickname}}}Opts struct +Other parameters are passed through a pointer to a api{{{nickname}}}Request struct via the builder pattern {{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}} -{{^required}} **{{paramName}}** | {{#isFile}}**optional.Interface of {{dataType}}**{{/isFile}}{{#isPrimitiveType}}**optional.{{vendorExtensions.x-optional-data-type}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**optional.Interface of {{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{/hasOptionalParams}} +{{^isPathParam}} **{{paramName}}** | {{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/isPathParam}}{{/allParams}} ### Return type diff --git a/modules/openapi-generator/src/main/resources/go/client.mustache b/modules/openapi-generator/src/main/resources/go/client.mustache index 8dcefae5f86..6fe63dcfdf9 100644 --- a/modules/openapi-generator/src/main/resources/go/client.mustache +++ b/modules/openapi-generator/src/main/resources/go/client.mustache @@ -9,7 +9,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "log" "mime/multipart" "net/http" @@ -25,14 +24,10 @@ import ( "unicode/utf8" "golang.org/x/oauth2" - {{#withAWSV4Signature}} - awsv4 "github.com/aws/aws-sdk-go/aws/signer/v4" - awscredentials "github.com/aws/aws-sdk-go/aws/credentials" - {{/withAWSV4Signature}} ) var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?(?:problem\+)?json)`) + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) ) @@ -169,9 +164,9 @@ func parameterToJson(obj interface{}) (string, error) { // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { if c.cfg.Debug { - dump, err := httputil.DumpRequestOut(request, true) + dump, err := httputil.DumpRequestOut(request, true) if err != nil { - return nil, err + return nil, err } log.Printf("\n%s\n", string(dump)) } @@ -188,15 +183,9 @@ func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { } log.Printf("\n%s\n", string(dump)) } - return resp, err } -// ChangeBasePath changes base path to allow switching to mocks -func (c *APIClient) ChangeBasePath(path string) { - c.cfg.BasePath = path -} - // 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 { @@ -357,31 +346,23 @@ func (c *APIClient) prepareRequest( if auth, ok := ctx.Value(ContextAccessToken).(string); ok { localVarRequest.Header.Add("Authorization", "Bearer "+auth) } + } - {{#withAWSV4Signature}} - // AWS Signature v4 Authentication - if auth, ok := ctx.Value(ContextAWSv4).(AWSv4); ok { - creds := awscredentials.NewStaticCredentials(auth.AccessKey, auth.SecretKey, "") - signer := awsv4.NewSigner(creds) - var reader *strings.Reader - if body == nil { - reader = strings.NewReader("") - } else { - reader = strings.NewReader(body.String()) - } - timestamp := time.Now() - _, err := signer.Sign(localVarRequest, reader, "oapi", "eu-west-2", timestamp) + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } +{{#hasHttpSignatureMethods}} + if ctx != nil { + // HTTP Signature Authentication. All request headers must be set (including default headers) + // because the headers may be included in the signature. + if auth, ok := ctx.Value(ContextHttpSignatureAuth).(HttpSignatureAuth); ok { + err = SignRequest(ctx, localVarRequest, auth) if err != nil { return nil, err } } - {{/withAWSV4Signature}} } - - for header, value := range c.cfg.DefaultHeader { - localVarRequest.Header.Add(header, value) - } - +{{/hasHttpSignatureMethods}} return localVarRequest, nil } @@ -393,15 +374,6 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err *s = string(b) return nil } - if f, ok := v.(**os.File); ok { - *f, err = ioutil.TempFile("", "HttpClientFile") - if err != nil { - return - } - _, err = (*f).Write(b) - _, err = (*f).Seek(0, io.SeekStart) - return - } if xmlCheck.MatchString(contentType) { if err = xml.Unmarshal(b, v); err != nil { return err @@ -409,7 +381,15 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err return nil } if jsonCheck.MatchString(contentType) { - if err = json.Unmarshal(b, v); err != nil { + 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 { + 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 diff --git a/modules/openapi-generator/src/main/resources/go/configuration.mustache b/modules/openapi-generator/src/main/resources/go/configuration.mustache index b21d2a13a23..3cda1954db8 100644 --- a/modules/openapi-generator/src/main/resources/go/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/go/configuration.mustache @@ -2,6 +2,7 @@ package {{packageName}} import ( + "context" "fmt" "net/http" "strings" @@ -27,13 +28,23 @@ var ( // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") - // ContextAPIKey takes an APIKey as authentication for the request - ContextAPIKey = contextKey("apikey") + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") - {{#withAWSV4Signature}} - // ContextAWSv4 takes an Access Key and a Secret Key for signing AWS Signature v4. - ContextAWSv4 = contextKey("awsv4") - {{/withAWSV4Signature}} + // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. + ContextHttpSignatureAuth = contextKey("httpsignature") + + // 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 @@ -48,15 +59,6 @@ type APIKey struct { Prefix string } -{{#withAWSV4Signature}} -// AWSv4 provides AWS Signature to a request passed via context using ContextAWSv4 -// https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html -type AWSv4 struct { - AccessKey string - SecretKey string -} -{{/withAWSV4Signature}} - // ServerVariable stores the information about a server variable type ServerVariable struct { Description string @@ -66,36 +68,38 @@ type ServerVariable struct { // ServerConfiguration stores the information about a server type ServerConfiguration struct { - Url string + 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 { - BasePath string `json:"basePath,omitempty"` - 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 []ServerConfiguration - HTTPClient *http.Client + 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{ - BasePath: "{{{basePath}}}", - DefaultHeader: make(map[string]string), - UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/go{{/httpUserAgent}}", - Debug: false, + DefaultHeader: make(map[string]string), + UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/go{{/httpUserAgent}}", + Debug: false, {{#servers}} {{#-first}} - Servers: []ServerConfiguration{ + Servers: ServerConfigurations{ {{/-first}} { - Url: "{{{url}}}", + URL: "{{{url}}}", Description: "{{{description}}}{{^description}}No description provided{{/description}}", {{#variables}} {{#-first}} @@ -123,6 +127,49 @@ func NewConfiguration() *Configuration { }, {{/-last}} {{/servers}} + {{#apiInfo}} + OperationServers: map[string]ServerConfigurations{ + {{#apis}} + {{#operations}} + {{#operation}} + {{#servers}} + {{#-first}} + "{{{classname}}}Service.{{{nickname}}}": { + {{/-first}} + { + URL: "{{{url}}}", + Description: "{{{description}}}{{^description}}No description provided{{/description}}", + {{#variables}} + {{#-first}} + Variables: map[string]ServerVariable{ + {{/-first}} + "{{{name}}}": ServerVariable{ + Description: "{{{description}}}{{^description}}No description provided{{/description}}", + DefaultValue: "{{{defaultValue}}}", + {{#enumValues}} + {{#-first}} + EnumValues: []string{ + {{/-first}} + "{{{.}}}", + {{#-last}} + }, + {{/-last}} + {{/enumValues}} + }, + {{#-last}} + }, + {{/-last}} + {{/variables}} + }, + {{#-last}} + }, + {{/-last}} + {{/servers}} + {{/operation}} + {{/operations}} + {{/apis}} + }, + {{/apiInfo}} } return cfg } @@ -132,13 +179,13 @@ func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } -// ServerUrl returns URL based on server settings -func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) { - if index < 0 || len(c.Servers) <= index { - return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1) +// 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 := c.Servers[index] - url := server.Url + server := sc[index] + url := server.URL // go through variables and replace placeholders for name, variable := range server.Variables { @@ -159,3 +206,84 @@ func (c *Configuration) ServerUrl(index int, variables map[string]string) (strin } 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) +} diff --git a/modules/openapi-generator/src/main/resources/go/go.mod.mustache b/modules/openapi-generator/src/main/resources/go/go.mod.mustache index 6c31cf3e9f1..3b7d202ac4f 100644 --- a/modules/openapi-generator/src/main/resources/go/go.mod.mustache +++ b/modules/openapi-generator/src/main/resources/go/go.mod.mustache @@ -1,7 +1,7 @@ module {{gitHost}}/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}{{/isGoSubmodule}} +go 1.13 + require ( - github.com/antihax/optional v1.0.0 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 - {{#withAWSV4Signature}}github.com/aws/aws-sdk-go v1.26.3{{/withAWSV4Signature}} ) diff --git a/modules/openapi-generator/src/main/resources/go/go.sum b/modules/openapi-generator/src/main/resources/go/go.sum index ee695202297..ce55b3c6a08 100644 --- a/modules/openapi-generator/src/main/resources/go/go.sum +++ b/modules/openapi-generator/src/main/resources/go/go.sum @@ -1,8 +1,6 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/aws/aws-sdk-go v1.26.3 h1:szQdfJcUBAhQT0zZEx4sxoDuWb7iScoucxCiVxDmaBk= -github.com/aws/aws-sdk-go v1.26.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= 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= diff --git a/modules/openapi-generator/src/main/resources/go/model.mustache b/modules/openapi-generator/src/main/resources/go/model.mustache index f30047a9e21..684af1d33c6 100644 --- a/modules/openapi-generator/src/main/resources/go/model.mustache +++ b/modules/openapi-generator/src/main/resources/go/model.mustache @@ -1,43 +1,20 @@ {{>partial_header}} package {{packageName}} + {{#models}} -{{#imports}} -{{#-first}} import ( -{{/-first}} + "encoding/json" +{{#imports}} "{{import}}" -{{#-last}} -) -{{/-last}} {{/imports}} +) + {{#model}} {{#isEnum}} -// {{{classname}}} {{#description}}{{{.}}}{{/description}}{{^description}}the model '{{{classname}}}'{{/description}} -type {{{classname}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/format}} - -// List of {{{name}}} -const ( - {{#allowableValues}} - {{#enumVars}} - {{^-first}} - {{/-first}} - {{#enumClassPrefix}}{{{classname.toUpperCase}}}_{{/enumClassPrefix}}{{name}} {{{classname}}} = {{{value}}} - {{/enumVars}} - {{/allowableValues}} -) +{{>model_enum}} {{/isEnum}} {{^isEnum}} -// {{classname}}{{#description}} {{{description}}}{{/description}}{{^description}} struct for {{{classname}}}{{/description}} -type {{classname}} struct { -{{#allVars}} -{{^-first}} -{{/-first}} -{{#description}} - // {{{description}}} -{{/description}} - {{name}} {{#isNullable}}*{{/isNullable}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` -{{/allVars}} -} +{{#oneOf}}{{#-first}}{{>model_oneof}}{{/-first}}{{/oneOf}}{{^oneOf}}{{#anyOf}}{{#-first}}{{>model_anyof}}{{/-first}}{{/anyOf}}{{^anyOf}}{{>model_simple}}{{/anyOf}}{{/oneOf}} {{/isEnum}} {{/model}} {{/models}} diff --git a/modules/openapi-generator/src/main/resources/go-experimental/model_anyof.mustache b/modules/openapi-generator/src/main/resources/go/model_anyof.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/go-experimental/model_anyof.mustache rename to modules/openapi-generator/src/main/resources/go/model_anyof.mustache diff --git a/modules/openapi-generator/src/main/resources/go/model_doc.mustache b/modules/openapi-generator/src/main/resources/go/model_doc.mustache index ae517d4a75a..9045d9fe088 100644 --- a/modules/openapi-generator/src/main/resources/go/model_doc.mustache +++ b/modules/openapi-generator/src/main/resources/go/model_doc.mustache @@ -4,8 +4,86 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -{{#allVars}}**{{name}}** | {{#isNullable}}Pointer to {{/isNullable}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} -{{/allVars}} +{{#vendorExtensions.x-is-one-of-interface}} +**{{classname}}Interface** | **interface { {{#discriminator}}{{propertyGetter}}() {{propertyType}}{{/discriminator}} }** | An interface that can hold any of the proper implementing types | +{{/vendorExtensions.x-is-one-of-interface}} +{{^vendorExtensions.x-is-one-of-interface}} +{{#vars}}**{{name}}** | {{^required}}Pointer to {{/required}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} +{{/vars}} +{{/vendorExtensions.x-is-one-of-interface}} + +{{^isEnum}} +## Methods + +{{^vendorExtensions.x-is-one-of-interface}} +### New{{classname}} + +`func New{{classname}}({{#vars}}{{#required}}{{nameInCamelCase}} {{dataType}}, {{/required}}{{/vars}}) *{{classname}}` + +New{{classname}} instantiates a new {{classname}} 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 + +### New{{classname}}WithDefaults + +`func New{{classname}}WithDefaults() *{{classname}}` + +New{{classname}}WithDefaults instantiates a new {{classname}} 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 + +{{#vars}} +### Get{{name}} + +`func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-go-base-type}}` + +Get{{name}} returns the {{name}} field if non-nil, zero value otherwise. + +### Get{{name}}Ok + +`func (o *{{classname}}) Get{{name}}Ok() (*{{vendorExtensions.x-go-base-type}}, bool)` + +Get{{name}}Ok 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. + +### Set{{name}} + +`func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-go-base-type}})` + +Set{{name}} sets {{name}} field to given value. + +{{^required}} +### Has{{name}} + +`func (o *{{classname}}) Has{{name}}() bool` + +Has{{name}} returns a boolean if a field has been set. +{{/required}} + +{{#isNullable}} +### Set{{name}}Nil + +`func (o *{{classname}}) Set{{name}}Nil(b bool)` + + Set{{name}}Nil sets the value for {{name}} to be an explicit nil + +### Unset{{name}} +`func (o *{{classname}}) Unset{{name}}()` + +Unset{{name}} ensures that no value is present for {{name}}, not even an explicit nil +{{/isNullable}} +{{/vars}} +{{#vendorExtensions.x-implements}} + +### As{{{.}}} + +`func (s *{{classname}}) As{{{.}}}() {{{.}}}` + +Convenience method to wrap this instance of {{classname}} in {{{.}}} +{{/vendorExtensions.x-implements}} +{{/vendorExtensions.x-is-one-of-interface}} +{{/isEnum}} [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/modules/openapi-generator/src/main/resources/go-experimental/model_enum.mustache b/modules/openapi-generator/src/main/resources/go/model_enum.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/go-experimental/model_enum.mustache rename to modules/openapi-generator/src/main/resources/go/model_enum.mustache diff --git a/modules/openapi-generator/src/main/resources/go-experimental/model_oneof.mustache b/modules/openapi-generator/src/main/resources/go/model_oneof.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/go-experimental/model_oneof.mustache rename to modules/openapi-generator/src/main/resources/go/model_oneof.mustache diff --git a/modules/openapi-generator/src/main/resources/go-experimental/model_simple.mustache b/modules/openapi-generator/src/main/resources/go/model_simple.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/go-experimental/model_simple.mustache rename to modules/openapi-generator/src/main/resources/go/model_simple.mustache diff --git a/modules/openapi-generator/src/main/resources/go-experimental/nullable_model.mustache b/modules/openapi-generator/src/main/resources/go/nullable_model.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/go-experimental/nullable_model.mustache rename to modules/openapi-generator/src/main/resources/go/nullable_model.mustache diff --git a/modules/openapi-generator/src/main/resources/go-experimental/signing.mustache b/modules/openapi-generator/src/main/resources/go/signing.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/go-experimental/signing.mustache rename to modules/openapi-generator/src/main/resources/go/signing.mustache diff --git a/modules/openapi-generator/src/main/resources/go-experimental/utils.mustache b/modules/openapi-generator/src/main/resources/go/utils.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/go-experimental/utils.mustache rename to modules/openapi-generator/src/main/resources/go/utils.mustache diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalDataTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalDataTest.java index 5a10f3d219d..bc168dd8ac8 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalDataTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalDataTest.java @@ -3,7 +3,7 @@ package org.openapitools.codegen.utils; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenModel; import org.openapitools.codegen.CodegenProperty; -import org.openapitools.codegen.languages.GoClientExperimentalCodegen; +import org.openapitools.codegen.languages.GoClientCodegen; import org.testng.Assert; import org.testng.annotations.Test; @@ -47,7 +47,7 @@ public class OneOfImplementorAdditionalDataTest { cp3.hasMore = false; implModel.vars.add(cp3); List<Map<String, String>> implModelImports = new ArrayList<>(); - GoClientExperimentalCodegen cc = new GoClientExperimentalCodegen(); + GoClientCodegen cc = new GoClientCodegen(); cc.setModelPackage("openapi"); o.addToImplementor(cc, implModel, implModelImports, false); -- GitLab From a287699a5371900860c3b656b97e5aec783a0005 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Mon, 31 Aug 2020 15:04:30 +0800 Subject: [PATCH 02/10] update samples --- ...perimental-extensions-x-auth-id-alias.yaml | 6 +- .../go/go-petstore/.openapi-generator/FILES | 217 +++++++-------- .../client/petstore/go/go-petstore/README.md | 98 +++++-- .../client/petstore/go/go-petstore/client.go | 34 +-- .../petstore/go/go-petstore/configuration.go | 147 +++++++++-- samples/client/petstore/go/go-petstore/go.mod | 4 +- samples/client/petstore/go/go-petstore/go.sum | 2 - .../go/go-petstore/.openapi-generator/FILES | 246 ++++++++++-------- .../client/petstore/go/go-petstore/README.md | 144 +++++++--- .../petstore/go/go-petstore/api/openapi.yaml | 139 +++++++--- .../client/petstore/go/go-petstore/client.go | 44 ++-- .../petstore/go/go-petstore/configuration.go | 169 ++++++++++-- .../client/petstore/go/go-petstore/go.mod | 4 +- .../client/petstore/go/go-petstore/go.sum | 2 - 14 files changed, 843 insertions(+), 413 deletions(-) diff --git a/bin/configs/go-experimental-extensions-x-auth-id-alias.yaml b/bin/configs/go-experimental-extensions-x-auth-id-alias.yaml index 517b6fe83d7..14606095d80 100644 --- a/bin/configs/go-experimental-extensions-x-auth-id-alias.yaml +++ b/bin/configs/go-experimental-extensions-x-auth-id-alias.yaml @@ -1,6 +1,6 @@ -generatorName: go-experimental -outputDir: samples/openapi3/client/extensions/x-auth-id-alias/go-experimental +generatorName: go +outputDir: samples/openapi3/client/extensions/x-auth-id-alias/go inputSpec: modules/openapi-generator/src/test/resources/3_0/extensions/x-auth-id-alias.yaml -templateDir: modules/openapi-generator/src/main/resources/go-experimental +templateDir: modules/openapi-generator/src/main/resources/go additionalProperties: packageName: x_auth_id_alias diff --git a/samples/client/petstore/go/go-petstore/.openapi-generator/FILES b/samples/client/petstore/go/go-petstore/.openapi-generator/FILES index 28a8ffd70f1..cac9e95792d 100644 --- a/samples/client/petstore/go/go-petstore/.openapi-generator/FILES +++ b/samples/client/petstore/go/go-petstore/.openapi-generator/FILES @@ -1,118 +1,119 @@ +$Special[modelName].md .gitignore .travis.yml +200Response.md +AdditionalPropertiesAnyType.md +AdditionalPropertiesArray.md +AdditionalPropertiesBoolean.md +AdditionalPropertiesClass.md +AdditionalPropertiesInteger.md +AdditionalPropertiesNumber.md +AdditionalPropertiesObject.md +AdditionalPropertiesString.md +Animal.md +AnotherFakeApi.md +ApiResponse.md +ArrayOfArrayOfNumberOnly.md +ArrayOfNumberOnly.md +ArrayTest.md +BigCat.md +BigCatAllOf.md +Capitalization.md +Cat.md +CatAllOf.md +Category.md +ClassModel.md +Client.md +Dog.md +DogAllOf.md +EnumArrays.md +EnumClass.md +EnumTest.md +FakeApi.md +FakeClassnameTags123Api.md +File.md +FileSchemaTestClass.md +FormatTest.md +HasOnlyReadOnly.md +List.md +MapTest.md +MixedPropertiesAndAdditionalPropertiesClass.md +Name.md +NumberOnly.md +Order.md +OuterComposite.md +OuterEnum.md +Pet.md +PetApi.md README.md +ReadOnlyFirst.md +Return.md +StoreApi.md +Tag.md +TypeHolderDefault.md +TypeHolderExample.md +User.md +UserApi.md +XmlItem.md api/openapi.yaml -api_another_fake.go -api_fake.go -api_fake_classname_tags123.go -api_pet.go -api_store.go -api_user.go client.go configuration.go -docs/AdditionalPropertiesAnyType.md -docs/AdditionalPropertiesArray.md -docs/AdditionalPropertiesBoolean.md -docs/AdditionalPropertiesClass.md -docs/AdditionalPropertiesInteger.md -docs/AdditionalPropertiesNumber.md -docs/AdditionalPropertiesObject.md -docs/AdditionalPropertiesString.md -docs/Animal.md -docs/AnotherFakeApi.md -docs/ApiResponse.md -docs/ArrayOfArrayOfNumberOnly.md -docs/ArrayOfNumberOnly.md -docs/ArrayTest.md -docs/BigCat.md -docs/BigCatAllOf.md -docs/Capitalization.md -docs/Cat.md -docs/CatAllOf.md -docs/Category.md -docs/ClassModel.md -docs/Client.md -docs/Dog.md -docs/DogAllOf.md -docs/EnumArrays.md -docs/EnumClass.md -docs/EnumTest.md -docs/FakeApi.md -docs/FakeClassnameTags123Api.md -docs/File.md -docs/FileSchemaTestClass.md -docs/FormatTest.md -docs/HasOnlyReadOnly.md -docs/List.md -docs/MapTest.md -docs/MixedPropertiesAndAdditionalPropertiesClass.md -docs/Model200Response.md -docs/Name.md -docs/NumberOnly.md -docs/Order.md -docs/OuterComposite.md -docs/OuterEnum.md -docs/Pet.md -docs/PetApi.md -docs/ReadOnlyFirst.md -docs/Return.md -docs/SpecialModelName.md -docs/StoreApi.md -docs/Tag.md -docs/TypeHolderDefault.md -docs/TypeHolderExample.md -docs/User.md -docs/UserApi.md -docs/XmlItem.md git_push.sh go.mod go.sum -model_200_response.go -model_additional_properties_any_type.go -model_additional_properties_array.go -model_additional_properties_boolean.go -model_additional_properties_class.go -model_additional_properties_integer.go -model_additional_properties_number.go -model_additional_properties_object.go -model_additional_properties_string.go -model_animal.go -model_api_response.go -model_array_of_array_of_number_only.go -model_array_of_number_only.go -model_array_test_.go -model_big_cat.go -model_big_cat_all_of.go -model_capitalization.go -model_cat.go -model_cat_all_of.go -model_category.go -model_class_model.go -model_client.go -model_dog.go -model_dog_all_of.go -model_enum_arrays.go -model_enum_class.go -model_enum_test_.go -model_file.go -model_file_schema_test_class.go -model_format_test_.go -model_has_only_read_only.go -model_list.go -model_map_test_.go -model_mixed_properties_and_additional_properties_class.go -model_name.go -model_number_only.go -model_order.go -model_outer_composite.go -model_outer_enum.go -model_pet.go -model_read_only_first.go -model_return.go -model_special_model_name.go -model_tag.go -model_type_holder_default.go -model_type_holder_example.go -model_user.go -model_xml_item.go +petstore/api_another_fake.go +petstore/api_fake.go +petstore/api_fake_classname_tags123.go +petstore/api_pet.go +petstore/api_store.go +petstore/api_user.go +petstore/model_200_response.go +petstore/model_additional_properties_any_type.go +petstore/model_additional_properties_array.go +petstore/model_additional_properties_boolean.go +petstore/model_additional_properties_class.go +petstore/model_additional_properties_integer.go +petstore/model_additional_properties_number.go +petstore/model_additional_properties_object.go +petstore/model_additional_properties_string.go +petstore/model_animal.go +petstore/model_api_response.go +petstore/model_array_of_array_of_number_only.go +petstore/model_array_of_number_only.go +petstore/model_array_test_.go +petstore/model_big_cat.go +petstore/model_big_cat_all_of.go +petstore/model_capitalization.go +petstore/model_cat.go +petstore/model_cat_all_of.go +petstore/model_category.go +petstore/model_class_model.go +petstore/model_client.go +petstore/model_dog.go +petstore/model_dog_all_of.go +petstore/model_enum_arrays.go +petstore/model_enum_class.go +petstore/model_enum_test_.go +petstore/model_file.go +petstore/model_file_schema_test_class.go +petstore/model_format_test_.go +petstore/model_has_only_read_only.go +petstore/model_list.go +petstore/model_map_test_.go +petstore/model_mixed_properties_and_additional_properties_class.go +petstore/model_name.go +petstore/model_number_only.go +petstore/model_order.go +petstore/model_outer_composite.go +petstore/model_outer_enum.go +petstore/model_pet.go +petstore/model_read_only_first.go +petstore/model_return.go +petstore/model_special_model_name.go +petstore/model_tag.go +petstore/model_type_holder_default.go +petstore/model_type_holder_example.go +petstore/model_user.go +petstore/model_xml_item.go response.go +utils.go diff --git a/samples/client/petstore/go/go-petstore/README.md b/samples/client/petstore/go/go-petstore/README.md index 611d9e5d5d4..50602aacedf 100644 --- a/samples/client/petstore/go/go-petstore/README.md +++ b/samples/client/petstore/go/go-petstore/README.md @@ -7,6 +7,7 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat - API version: 1.0.0 - Package version: 1.0.0 +- Build date: 2020-08-31T07:04:15.507Z[UTC] - Build package: org.openapitools.codegen.languages.GoClientCodegen ## Installation @@ -17,13 +18,53 @@ Install the following dependencies: go get github.com/stretchr/testify/assert go get golang.org/x/oauth2 go get golang.org/x/net/context -go get github.com/antihax/optional ``` Put the package under your project folder and add the following in import: ```golang -import "./petstore" +import sw "./petstore" +``` + +## 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(), sw.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(), sw.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 identifield 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. + +``` +ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) ``` ## Documentation for API Endpoints @@ -127,44 +168,32 @@ Class | Method | HTTP request | Description -## api_key +### api_key - **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header -Example - -```golang -auth := context.WithValue(context.Background(), petstore.ContextAPIKey, petstore.APIKey{ - Key: "APIKEY", - Prefix: "Bearer", // Omit if not necessary. -}) -r, err := client.Service.Operation(auth, args) -``` +Note, each API key must be added to a map of `map[string]APIKey` where the key is: api_key and passed in as the auth context for each request. -## api_key_query +### api_key_query - **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string -Example - -```golang -auth := context.WithValue(context.Background(), petstore.ContextAPIKey, petstore.APIKey{ - Key: "APIKEY", - Prefix: "Bearer", // Omit if not necessary. -}) -r, err := client.Service.Operation(auth, args) -``` +Note, each API key must be added to a map of `map[string]APIKey` where the key is: api_key_query and passed in as the auth context for each request. -## http_basic_test +### http_basic_test - **Type**: HTTP basic authentication Example ```golang -auth := context.WithValue(context.Background(), petstore.ContextBasicAuth, petstore.BasicAuth{ +auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ UserName: "username", Password: "password", }) @@ -172,7 +201,7 @@ r, err := client.Service.Operation(auth, args) ``` -## petstore_auth +### petstore_auth - **Type**: OAuth @@ -185,7 +214,7 @@ r, err := client.Service.Operation(auth, args) Example ```golang -auth := context.WithValue(context.Background(), petstore.ContextAccessToken, "ACCESSTOKENSTRING") +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") r, err := client.Service.Operation(auth, args) ``` @@ -197,11 +226,26 @@ import "golang.org/x/oauth2" /* Perform OAuth2 round trip request and obtain a token */ tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) -auth := context.WithValue(oauth2.NoContext, petstore.ContextOAuth2, tokenSource) +auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) 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 diff --git a/samples/client/petstore/go/go-petstore/client.go b/samples/client/petstore/go/go-petstore/client.go index 769e38acab3..a9bd76d6123 100644 --- a/samples/client/petstore/go/go-petstore/client.go +++ b/samples/client/petstore/go/go-petstore/client.go @@ -17,7 +17,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "log" "mime/multipart" "net/http" @@ -36,7 +35,7 @@ import ( ) var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?(?:problem\+)?json)`) + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) ) @@ -176,9 +175,9 @@ func parameterToJson(obj interface{}) (string, error) { // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { if c.cfg.Debug { - dump, err := httputil.DumpRequestOut(request, true) + dump, err := httputil.DumpRequestOut(request, true) if err != nil { - return nil, err + return nil, err } log.Printf("\n%s\n", string(dump)) } @@ -195,15 +194,9 @@ func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { } log.Printf("\n%s\n", string(dump)) } - return resp, err } -// ChangeBasePath changes base path to allow switching to mocks -func (c *APIClient) ChangeBasePath(path string) { - c.cfg.BasePath = path -} - // 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 { @@ -364,13 +357,11 @@ func (c *APIClient) prepareRequest( if auth, ok := ctx.Value(ContextAccessToken).(string); ok { localVarRequest.Header.Add("Authorization", "Bearer "+auth) } - } for header, value := range c.cfg.DefaultHeader { localVarRequest.Header.Add(header, value) } - return localVarRequest, nil } @@ -382,15 +373,6 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err *s = string(b) return nil } - if f, ok := v.(**os.File); ok { - *f, err = ioutil.TempFile("", "HttpClientFile") - if err != nil { - return - } - _, err = (*f).Write(b) - _, err = (*f).Seek(0, io.SeekStart) - return - } if xmlCheck.MatchString(contentType) { if err = xml.Unmarshal(b, v); err != nil { return err @@ -398,7 +380,15 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err return nil } if jsonCheck.MatchString(contentType) { - if err = json.Unmarshal(b, v); err != nil { + 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 { + 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 diff --git a/samples/client/petstore/go/go-petstore/configuration.go b/samples/client/petstore/go/go-petstore/configuration.go index 4a35e840836..4c503f92637 100644 --- a/samples/client/petstore/go/go-petstore/configuration.go +++ b/samples/client/petstore/go/go-petstore/configuration.go @@ -10,6 +10,7 @@ package petstore import ( + "context" "fmt" "net/http" "strings" @@ -35,9 +36,23 @@ var ( // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") - // ContextAPIKey takes an APIKey as authentication for the request - ContextAPIKey = contextKey("apikey") + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. + ContextHttpSignatureAuth = contextKey("httpsignature") + + // 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 @@ -52,7 +67,6 @@ type APIKey struct { Prefix string } - // ServerVariable stores the information about a server variable type ServerVariable struct { Description string @@ -62,36 +76,40 @@ type ServerVariable struct { // ServerConfiguration stores the information about a server type ServerConfiguration struct { - Url string + 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 { - BasePath string `json:"basePath,omitempty"` - 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 []ServerConfiguration - HTTPClient *http.Client + 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{ - BasePath: "http://petstore.swagger.io:80/v2", - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Servers: []ServerConfiguration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: ServerConfigurations{ { - Url: "http://petstore.swagger.io:80/v2", + URL: "http://petstore.swagger.io:80/v2", Description: "No description provided", }, }, + OperationServers: map[string]ServerConfigurations{ + }, } return cfg } @@ -101,13 +119,13 @@ func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } -// ServerUrl returns URL based on server settings -func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) { - if index < 0 || len(c.Servers) <= index { - return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1) +// 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 := c.Servers[index] - url := server.Url + server := sc[index] + url := server.URL // go through variables and replace placeholders for name, variable := range server.Variables { @@ -128,3 +146,84 @@ func (c *Configuration) ServerUrl(index int, variables map[string]string) (strin } 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) +} diff --git a/samples/client/petstore/go/go-petstore/go.mod b/samples/client/petstore/go/go-petstore/go.mod index f55c1461f84..f9811556cc5 100644 --- a/samples/client/petstore/go/go-petstore/go.mod +++ b/samples/client/petstore/go/go-petstore/go.mod @@ -1,7 +1,7 @@ module github.com/GIT_USER_ID/GIT_REPO_ID +go 1.13 + require ( - github.com/antihax/optional v1.0.0 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 - ) diff --git a/samples/client/petstore/go/go-petstore/go.sum b/samples/client/petstore/go/go-petstore/go.sum index ee695202297..ce55b3c6a08 100644 --- a/samples/client/petstore/go/go-petstore/go.sum +++ b/samples/client/petstore/go/go-petstore/go.sum @@ -1,8 +1,6 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/aws/aws-sdk-go v1.26.3 h1:szQdfJcUBAhQT0zZEx4sxoDuWb7iScoucxCiVxDmaBk= -github.com/aws/aws-sdk-go v1.26.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= 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= diff --git a/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/FILES b/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/FILES index cc725b6d4dc..3b4727b9d24 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/FILES @@ -1,122 +1,144 @@ .gitignore .travis.yml +200Response.md +AdditionalPropertiesClass.md +Animal.md +AnotherFakeApi.md +ApiResponse.md +Apple.md +AppleReq.md +ArrayOfArrayOfNumberOnly.md +ArrayOfNumberOnly.md +ArrayTest.md +Banana.md +BananaReq.md +Capitalization.md +Cat.md +CatAllOf.md +Category.md +ClassModel.md +Client.md +DefaultApi.md +Dog.md +DogAllOf.md +EnumArrays.md +EnumClass.md +EnumTest.md +FakeApi.md +FakeClassnameTags123Api.md +File.md +FileSchemaTestClass.md +Foo.md +FormatTest.md +Fruit.md +FruitReq.md +GmFruit.md +HasOnlyReadOnly.md +HealthCheckResult.md +InlineObject.md +InlineObject1.md +InlineObject2.md +InlineObject3.md +InlineObject4.md +InlineObject5.md +InlineResponseDefault.md +List.md +Mammal.md +MapTest.md +MixedPropertiesAndAdditionalPropertiesClass.md +Name.md +NullableClass.md +NumberOnly.md +Order.md +OuterComposite.md +OuterEnum.md +OuterEnumDefaultValue.md +OuterEnumInteger.md +OuterEnumIntegerDefaultValue.md +Pet.md +PetApi.md README.md +ReadOnlyFirst.md +Return.md +SpecialModelName.md +StoreApi.md +Tag.md +User.md +UserApi.md +Whale.md +Zebra.md api/openapi.yaml -api_another_fake.go -api_default.go -api_fake.go -api_fake_classname_tags123.go -api_pet.go -api_store.go -api_user.go client.go configuration.go -docs/AdditionalPropertiesClass.md -docs/Animal.md -docs/AnotherFakeApi.md -docs/ApiResponse.md -docs/ArrayOfArrayOfNumberOnly.md -docs/ArrayOfNumberOnly.md -docs/ArrayTest.md -docs/Capitalization.md -docs/Cat.md -docs/CatAllOf.md -docs/Category.md -docs/ClassModel.md -docs/Client.md -docs/DefaultApi.md -docs/Dog.md -docs/DogAllOf.md -docs/EnumArrays.md -docs/EnumClass.md -docs/EnumTest.md -docs/FakeApi.md -docs/FakeClassnameTags123Api.md -docs/File.md -docs/FileSchemaTestClass.md -docs/Foo.md -docs/FormatTest.md -docs/HasOnlyReadOnly.md -docs/HealthCheckResult.md -docs/InlineObject.md -docs/InlineObject1.md -docs/InlineObject2.md -docs/InlineObject3.md -docs/InlineObject4.md -docs/InlineObject5.md -docs/InlineResponseDefault.md -docs/List.md -docs/MapTest.md -docs/MixedPropertiesAndAdditionalPropertiesClass.md -docs/Model200Response.md -docs/Name.md -docs/NullableClass.md -docs/NumberOnly.md -docs/Order.md -docs/OuterComposite.md -docs/OuterEnum.md -docs/OuterEnumDefaultValue.md -docs/OuterEnumInteger.md -docs/OuterEnumIntegerDefaultValue.md -docs/Pet.md -docs/PetApi.md -docs/ReadOnlyFirst.md -docs/Return.md -docs/SpecialModelName.md -docs/StoreApi.md -docs/Tag.md -docs/User.md -docs/UserApi.md git_push.sh go.mod go.sum -model_200_response.go -model__special_model_name_.go -model_additional_properties_class.go -model_animal.go -model_api_response.go -model_array_of_array_of_number_only.go -model_array_of_number_only.go -model_array_test_.go -model_capitalization.go -model_cat.go -model_cat_all_of.go -model_category.go -model_class_model.go -model_client.go -model_dog.go -model_dog_all_of.go -model_enum_arrays.go -model_enum_class.go -model_enum_test_.go -model_file.go -model_file_schema_test_class.go -model_foo.go -model_format_test_.go -model_has_only_read_only.go -model_health_check_result.go -model_inline_object.go -model_inline_object_1.go -model_inline_object_2.go -model_inline_object_3.go -model_inline_object_4.go -model_inline_object_5.go -model_inline_response_default.go -model_list.go -model_map_test_.go -model_mixed_properties_and_additional_properties_class.go -model_name.go -model_nullable_class.go -model_number_only.go -model_order.go -model_outer_composite.go -model_outer_enum.go -model_outer_enum_default_value.go -model_outer_enum_integer.go -model_outer_enum_integer_default_value.go -model_pet.go -model_read_only_first.go -model_return.go -model_tag.go -model_user.go +petstore/api_another_fake.go +petstore/api_default.go +petstore/api_fake.go +petstore/api_fake_classname_tags123.go +petstore/api_pet.go +petstore/api_store.go +petstore/api_user.go +petstore/model_200_response.go +petstore/model__special_model_name_.go +petstore/model_additional_properties_class.go +petstore/model_animal.go +petstore/model_api_response.go +petstore/model_apple.go +petstore/model_apple_req.go +petstore/model_array_of_array_of_number_only.go +petstore/model_array_of_number_only.go +petstore/model_array_test_.go +petstore/model_banana.go +petstore/model_banana_req.go +petstore/model_capitalization.go +petstore/model_cat.go +petstore/model_cat_all_of.go +petstore/model_category.go +petstore/model_class_model.go +petstore/model_client.go +petstore/model_dog.go +petstore/model_dog_all_of.go +petstore/model_enum_arrays.go +petstore/model_enum_class.go +petstore/model_enum_test_.go +petstore/model_file.go +petstore/model_file_schema_test_class.go +petstore/model_foo.go +petstore/model_format_test_.go +petstore/model_fruit.go +petstore/model_fruit_req.go +petstore/model_gm_fruit.go +petstore/model_has_only_read_only.go +petstore/model_health_check_result.go +petstore/model_inline_object.go +petstore/model_inline_object_1.go +petstore/model_inline_object_2.go +petstore/model_inline_object_3.go +petstore/model_inline_object_4.go +petstore/model_inline_object_5.go +petstore/model_inline_response_default.go +petstore/model_list.go +petstore/model_mammal.go +petstore/model_map_test_.go +petstore/model_mixed_properties_and_additional_properties_class.go +petstore/model_name.go +petstore/model_nullable_class.go +petstore/model_number_only.go +petstore/model_order.go +petstore/model_outer_composite.go +petstore/model_outer_enum.go +petstore/model_outer_enum_default_value.go +petstore/model_outer_enum_integer.go +petstore/model_outer_enum_integer_default_value.go +petstore/model_pet.go +petstore/model_read_only_first.go +petstore/model_return.go +petstore/model_tag.go +petstore/model_user.go +petstore/model_whale.go +petstore/model_zebra.go response.go +signing.go +utils.go diff --git a/samples/openapi3/client/petstore/go/go-petstore/README.md b/samples/openapi3/client/petstore/go/go-petstore/README.md index 78adce57a44..4109445fef0 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/README.md +++ b/samples/openapi3/client/petstore/go/go-petstore/README.md @@ -7,6 +7,7 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat - API version: 1.0.0 - Package version: 1.0.0 +- Build date: 2020-08-31T07:04:15.251Z[UTC] - Build package: org.openapitools.codegen.languages.GoClientCodegen ## Installation @@ -17,13 +18,53 @@ Install the following dependencies: go get github.com/stretchr/testify/assert go get golang.org/x/oauth2 go get golang.org/x/net/context -go get github.com/antihax/optional ``` Put the package under your project folder and add the following in import: ```golang -import "./petstore" +import sw "./petstore" +``` + +## 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(), sw.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(), sw.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 identifield 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. + +``` +ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) ``` ## Documentation for API Endpoints @@ -35,7 +76,6 @@ Class | Method | HTTP request | Description *AnotherFakeApi* | [**Call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **Patch** /another-fake/dummy | To test special tags *DefaultApi* | [**FooGet**](docs/DefaultApi.md#fooget) | **Get** /foo | *FakeApi* | [**FakeHealthGet**](docs/FakeApi.md#fakehealthget) | **Get** /fake/health | Health check endpoint -*FakeApi* | [**FakeHttpSignatureTest**](docs/FakeApi.md#fakehttpsignaturetest) | **Get** /fake/http-signature-test | test http signature authentication *FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **Post** /fake/outer/boolean | *FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **Post** /fake/outer/composite | *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **Post** /fake/outer/number | @@ -78,9 +118,13 @@ Class | Method | HTTP request | Description - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) - [Animal](docs/Animal.md) - [ApiResponse](docs/ApiResponse.md) + - [Apple](docs/Apple.md) + - [AppleReq](docs/AppleReq.md) - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [ArrayTest](docs/ArrayTest.md) + - [Banana](docs/Banana.md) + - [BananaReq](docs/BananaReq.md) - [Capitalization](docs/Capitalization.md) - [Cat](docs/Cat.md) - [CatAllOf](docs/CatAllOf.md) @@ -96,6 +140,9 @@ Class | Method | HTTP request | Description - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) - [FormatTest](docs/FormatTest.md) + - [Fruit](docs/Fruit.md) + - [FruitReq](docs/FruitReq.md) + - [GmFruit](docs/GmFruit.md) - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [HealthCheckResult](docs/HealthCheckResult.md) - [InlineObject](docs/InlineObject.md) @@ -106,6 +153,7 @@ Class | Method | HTTP request | Description - [InlineObject5](docs/InlineObject5.md) - [InlineResponseDefault](docs/InlineResponseDefault.md) - [List](docs/List.md) + - [Mammal](docs/Mammal.md) - [MapTest](docs/MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - [Model200Response](docs/Model200Response.md) @@ -124,62 +172,52 @@ Class | Method | HTTP request | Description - [SpecialModelName](docs/SpecialModelName.md) - [Tag](docs/Tag.md) - [User](docs/User.md) + - [Whale](docs/Whale.md) + - [Zebra](docs/Zebra.md) ## Documentation For Authorization -## api_key +### api_key - **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header -Example - -```golang -auth := context.WithValue(context.Background(), petstore.ContextAPIKey, petstore.APIKey{ - Key: "APIKEY", - Prefix: "Bearer", // Omit if not necessary. -}) -r, err := client.Service.Operation(auth, args) -``` +Note, each API key must be added to a map of `map[string]APIKey` where the key is: api_key and passed in as the auth context for each request. -## api_key_query +### api_key_query - **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string -Example - -```golang -auth := context.WithValue(context.Background(), petstore.ContextAPIKey, petstore.APIKey{ - Key: "APIKEY", - Prefix: "Bearer", // Omit if not necessary. -}) -r, err := client.Service.Operation(auth, args) -``` +Note, each API key must be added to a map of `map[string]APIKey` where the key is: api_key_query and passed in as the auth context for each request. -## bearer_test +### bearer_test - **Type**: HTTP Bearer token authentication Example ```golang -auth := context.WithValue(context.Background(), petstore.ContextAccessToken, "BEARERTOKENSTRING") +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARERTOKENSTRING") r, err := client.Service.Operation(auth, args) ``` -## http_basic_test +### http_basic_test - **Type**: HTTP basic authentication Example ```golang -auth := context.WithValue(context.Background(), petstore.ContextBasicAuth, petstore.BasicAuth{ +auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ UserName: "username", Password: "password", }) @@ -187,12 +225,39 @@ r, err := client.Service.Operation(auth, args) ``` -## http_signature_test +### http_signature_test + +- **Type**: HTTP signature authentication + +Example -Not supported. +```golang + authConfig := sw.HttpSignatureAuth{ + KeyId: "my-key-id", + PrivateKeyPath: "rsa.pem", + Passphrase: "my-passphrase", + SigningScheme: sw.HttpSigningSchemeHs2019, + SignedHeaders: []string{ + sw.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target. + sw.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value. + "Host", // The Host request header specifies the domain name of the server, and optionally the TCP port number. + "Date", // The date and time at which the message was originated. + "Content-Type", // The Media type of the body of the request. + "Digest", // A cryptographic digest of the request body. + }, + SigningAlgorithm: sw.HttpSigningAlgorithmRsaPSS, + SignatureMaxValidity: 5 * time.Minute, + } + var authCtx context.Context + var err error + if authCtx, err = authConfig.ContextWithValue(context.Background()); err != nil { + // Process error + } + r, err = client.Service.Operation(auth, args) +``` -## petstore_auth +### petstore_auth - **Type**: OAuth @@ -205,7 +270,7 @@ Not supported. Example ```golang -auth := context.WithValue(context.Background(), petstore.ContextAccessToken, "ACCESSTOKENSTRING") +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") r, err := client.Service.Operation(auth, args) ``` @@ -217,11 +282,26 @@ import "golang.org/x/oauth2" /* Perform OAuth2 round trip request and obtain a token */ tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) -auth := context.WithValue(oauth2.NoContext, petstore.ContextOAuth2, tokenSource) +auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) 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 diff --git a/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml index 51e7c243284..4bb7abdc392 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml +++ b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml @@ -57,6 +57,7 @@ paths: "405": description: Invalid input security: + - http_signature_test: [] - petstore_auth: - write:pets - read:pets @@ -75,6 +76,7 @@ paths: "405": description: Validation exception security: + - http_signature_test: [] - petstore_auth: - write:pets - read:pets @@ -121,6 +123,7 @@ paths: "400": description: Invalid status value security: + - http_signature_test: [] - petstore_auth: - write:pets - read:pets @@ -161,6 +164,7 @@ paths: "400": description: Invalid tag value security: + - http_signature_test: [] - petstore_auth: - write:pets - read:pets @@ -1169,36 +1173,6 @@ paths: summary: Health check endpoint tags: - fake - /fake/http-signature-test: - get: - operationId: fake-http-signature-test - parameters: - - description: query parameter - explode: true - in: query - name: query_1 - required: false - schema: - type: string - style: form - - description: header parameter - explode: false - in: header - name: header_1 - required: false - schema: - type: string - style: simple - requestBody: - $ref: '#/components/requestBodies/Pet' - responses: - "200": - description: The instance started successfully - security: - - http_signature_test: [] - summary: test http signature authentication - tags: - - fake components: requestBodies: UserArray: @@ -1325,9 +1299,13 @@ components: lastName: lastName password: password userStatus: 6 + arbitraryTypeValue: "" + arbitraryNullableTypeValue: "" phone: phone id: 0 + arbitraryObject: '{}' email: email + arbitraryNullableObject: '{}' username: username properties: id: @@ -1350,6 +1328,22 @@ components: description: User Status format: int32 type: integer + arbitraryObject: + description: test code generation for objects Value must be a map of strings + to values. It cannot be the 'null' value. + type: object + arbitraryNullableObject: + description: test code generation for nullable objects. Value must be a + map of strings to values or the 'null' value. + nullable: true + type: object + arbitraryTypeValue: + description: test code generation for any type Value can be any type - string, + number, boolean, array or object. + arbitraryNullableTypeValue: + description: test code generation for any type Value can be any type - string, + number, boolean, array, object or the 'null' value. + nullable: true type: object xml: name: User @@ -1482,7 +1476,12 @@ components: Cat: allOf: - $ref: '#/components/schemas/Animal' + - $ref: '#/components/schemas/Address' - $ref: '#/components/schemas/Cat_allOf' + Address: + additionalProperties: + type: integer + type: object Animal: discriminator: propertyName: className @@ -1913,6 +1912,86 @@ components: type: object type: object type: object + fruit: + oneOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + properties: + color: + type: string + apple: + properties: + cultivar: + type: string + type: object + banana: + additionalProperties: true + properties: + lengthCm: + type: number + type: object + mammal: + discriminator: + mapping: + whale: '#/components/schemas/whale' + zebra: '#/components/schemas/zebra' + propertyName: className + oneOf: + - $ref: '#/components/schemas/whale' + - $ref: '#/components/schemas/zebra' + whale: + properties: + hasBaleen: + type: boolean + hasTeeth: + type: boolean + className: + type: string + required: + - className + type: object + zebra: + properties: + type: + enum: + - plains + - mountain + - grevys + type: string + className: + type: string + required: + - className + type: object + gmFruit: + anyOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + properties: + color: + type: string + fruitReq: + oneOf: + - $ref: '#/components/schemas/appleReq' + - $ref: '#/components/schemas/bananaReq' + appleReq: + properties: + cultivar: + type: string + mealy: + type: boolean + required: + - cultivar + type: object + bananaReq: + properties: + lengthCm: + type: number + sweet: + type: boolean + required: + - lengthCm + type: object inline_response_default: example: string: diff --git a/samples/openapi3/client/petstore/go/go-petstore/client.go b/samples/openapi3/client/petstore/go/go-petstore/client.go index 838b6e9d0e0..f38d68a6a60 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/client.go +++ b/samples/openapi3/client/petstore/go/go-petstore/client.go @@ -17,7 +17,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "log" "mime/multipart" "net/http" @@ -36,7 +35,7 @@ import ( ) var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?(?:problem\+)?json)`) + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) ) @@ -179,9 +178,9 @@ func parameterToJson(obj interface{}) (string, error) { // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { if c.cfg.Debug { - dump, err := httputil.DumpRequestOut(request, true) + dump, err := httputil.DumpRequestOut(request, true) if err != nil { - return nil, err + return nil, err } log.Printf("\n%s\n", string(dump)) } @@ -198,15 +197,9 @@ func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { } log.Printf("\n%s\n", string(dump)) } - return resp, err } -// ChangeBasePath changes base path to allow switching to mocks -func (c *APIClient) ChangeBasePath(path string) { - c.cfg.BasePath = path -} - // 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 { @@ -367,13 +360,21 @@ func (c *APIClient) prepareRequest( if auth, ok := ctx.Value(ContextAccessToken).(string); ok { localVarRequest.Header.Add("Authorization", "Bearer "+auth) } - } for header, value := range c.cfg.DefaultHeader { localVarRequest.Header.Add(header, value) } - + if ctx != nil { + // HTTP Signature Authentication. All request headers must be set (including default headers) + // because the headers may be included in the signature. + if auth, ok := ctx.Value(ContextHttpSignatureAuth).(HttpSignatureAuth); ok { + err = SignRequest(ctx, localVarRequest, auth) + if err != nil { + return nil, err + } + } + } return localVarRequest, nil } @@ -385,15 +386,6 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err *s = string(b) return nil } - if f, ok := v.(**os.File); ok { - *f, err = ioutil.TempFile("", "HttpClientFile") - if err != nil { - return - } - _, err = (*f).Write(b) - _, err = (*f).Seek(0, io.SeekStart) - return - } if xmlCheck.MatchString(contentType) { if err = xml.Unmarshal(b, v); err != nil { return err @@ -401,7 +393,15 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err return nil } if jsonCheck.MatchString(contentType) { - if err = json.Unmarshal(b, v); err != nil { + 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 { + 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 diff --git a/samples/openapi3/client/petstore/go/go-petstore/configuration.go b/samples/openapi3/client/petstore/go/go-petstore/configuration.go index 64ae25b4669..ddcea71eaf9 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/configuration.go +++ b/samples/openapi3/client/petstore/go/go-petstore/configuration.go @@ -10,6 +10,7 @@ package petstore import ( + "context" "fmt" "net/http" "strings" @@ -35,9 +36,23 @@ var ( // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") - // ContextAPIKey takes an APIKey as authentication for the request - ContextAPIKey = contextKey("apikey") + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. + ContextHttpSignatureAuth = contextKey("httpsignature") + + // 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 @@ -52,7 +67,6 @@ type APIKey struct { Prefix string } - // ServerVariable stores the information about a server variable type ServerVariable struct { Description string @@ -62,33 +76,35 @@ type ServerVariable struct { // ServerConfiguration stores the information about a server type ServerConfiguration struct { - Url string + 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 { - BasePath string `json:"basePath,omitempty"` - 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 []ServerConfiguration - HTTPClient *http.Client + 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{ - BasePath: "http://petstore.swagger.io:80/v2", - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Servers: []ServerConfiguration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: ServerConfigurations{ { - Url: "http://{server}.swagger.io:{port}/v2", + URL: "http://{server}.swagger.io:{port}/v2", Description: "petstore server", Variables: map[string]ServerVariable{ "server": ServerVariable{ @@ -111,7 +127,7 @@ func NewConfiguration() *Configuration { }, }, { - Url: "https://localhost:8080/{version}", + URL: "https://localhost:8080/{version}", Description: "The local server", Variables: map[string]ServerVariable{ "version": ServerVariable{ @@ -125,6 +141,28 @@ func NewConfiguration() *Configuration { }, }, }, + OperationServers: map[string]ServerConfigurations{ + "PetApiService.AddPet": { + { + URL: "http://petstore.swagger.io/v2", + Description: "No description provided", + }, + { + URL: "http://path-server-test.petstore.local/v2", + Description: "No description provided", + }, + }, + "PetApiService.UpdatePet": { + { + URL: "http://petstore.swagger.io/v2", + Description: "No description provided", + }, + { + URL: "http://path-server-test.petstore.local/v2", + Description: "No description provided", + }, + }, + }, } return cfg } @@ -134,13 +172,13 @@ func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } -// ServerUrl returns URL based on server settings -func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) { - if index < 0 || len(c.Servers) <= index { - return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1) +// 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 := c.Servers[index] - url := server.Url + server := sc[index] + url := server.URL // go through variables and replace placeholders for name, variable := range server.Variables { @@ -161,3 +199,84 @@ func (c *Configuration) ServerUrl(index int, variables map[string]string) (strin } 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) +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/go.mod b/samples/openapi3/client/petstore/go/go-petstore/go.mod index f55c1461f84..f9811556cc5 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/go.mod +++ b/samples/openapi3/client/petstore/go/go-petstore/go.mod @@ -1,7 +1,7 @@ module github.com/GIT_USER_ID/GIT_REPO_ID +go 1.13 + require ( - github.com/antihax/optional v1.0.0 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 - ) diff --git a/samples/openapi3/client/petstore/go/go-petstore/go.sum b/samples/openapi3/client/petstore/go/go-petstore/go.sum index ee695202297..ce55b3c6a08 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/go.sum +++ b/samples/openapi3/client/petstore/go/go-petstore/go.sum @@ -1,8 +1,6 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/aws/aws-sdk-go v1.26.3 h1:szQdfJcUBAhQT0zZEx4sxoDuWb7iScoucxCiVxDmaBk= -github.com/aws/aws-sdk-go v1.26.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= 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= -- GitLab From e2bcd14ffff72b0ef7f8283223db332172bb39ce Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Mon, 31 Aug 2020 15:04:52 +0800 Subject: [PATCH 03/10] update samples --- .../go/go-petstore/$Special[modelName].md | 56 + .../petstore/go/go-petstore/200Response.md | 82 + .../AdditionalPropertiesAnyType.md | 56 + .../go-petstore/AdditionalPropertiesArray.md | 56 + .../AdditionalPropertiesBoolean.md | 56 + .../go-petstore/AdditionalPropertiesClass.md | 316 +++ .../AdditionalPropertiesInteger.md | 56 + .../go-petstore/AdditionalPropertiesNumber.md | 56 + .../go-petstore/AdditionalPropertiesObject.md | 56 + .../go-petstore/AdditionalPropertiesString.md | 56 + .../client/petstore/go/go-petstore/Animal.md | 77 + .../petstore/go/go-petstore/AnotherFakeApi.md | 75 + .../petstore/go/go-petstore/ApiResponse.md | 108 ++ .../go-petstore/ArrayOfArrayOfNumberOnly.md | 56 + .../go/go-petstore/ArrayOfNumberOnly.md | 56 + .../petstore/go/go-petstore/ArrayTest.md | 108 ++ .../client/petstore/go/go-petstore/BigCat.md | 56 + .../petstore/go/go-petstore/BigCatAllOf.md | 56 + .../petstore/go/go-petstore/Capitalization.md | 186 ++ samples/client/petstore/go/go-petstore/Cat.md | 56 + .../petstore/go/go-petstore/CatAllOf.md | 56 + .../petstore/go/go-petstore/Category.md | 77 + .../petstore/go/go-petstore/ClassModel.md | 56 + .../client/petstore/go/go-petstore/Client.md | 56 + samples/client/petstore/go/go-petstore/Dog.md | 56 + .../petstore/go/go-petstore/DogAllOf.md | 56 + .../petstore/go/go-petstore/EnumArrays.md | 82 + .../petstore/go/go-petstore/EnumClass.md | 11 + .../petstore/go/go-petstore/EnumTest.md | 155 ++ .../client/petstore/go/go-petstore/FakeApi.md | 984 ++++++++++ .../go/go-petstore/FakeClassnameTags123Api.md | 75 + .../client/petstore/go/go-petstore/File.md | 56 + .../go/go-petstore/FileSchemaTestClass.md | 82 + .../petstore/go/go-petstore/FormatTest.md | 374 ++++ .../go/go-petstore/HasOnlyReadOnly.md | 82 + .../client/petstore/go/go-petstore/List.md | 56 + .../client/petstore/go/go-petstore/MapTest.md | 134 ++ ...dPropertiesAndAdditionalPropertiesClass.md | 108 ++ .../client/petstore/go/go-petstore/Name.md | 129 ++ .../petstore/go/go-petstore/NumberOnly.md | 56 + .../client/petstore/go/go-petstore/Order.md | 186 ++ .../petstore/go/go-petstore/OuterComposite.md | 108 ++ .../petstore/go/go-petstore/OuterEnum.md | 11 + samples/client/petstore/go/go-petstore/Pet.md | 176 ++ .../client/petstore/go/go-petstore/PetApi.md | 625 ++++++ .../petstore/go/go-petstore/ReadOnlyFirst.md | 82 + .../client/petstore/go/go-petstore/Return.md | 56 + .../petstore/go/go-petstore/StoreApi.md | 275 +++ samples/client/petstore/go/go-petstore/Tag.md | 82 + .../go/go-petstore/TypeHolderDefault.md | 135 ++ .../go/go-petstore/TypeHolderExample.md | 156 ++ .../client/petstore/go/go-petstore/User.md | 238 +++ .../client/petstore/go/go-petstore/UserApi.md | 533 ++++++ .../client/petstore/go/go-petstore/XmlItem.md | 784 ++++++++ .../go-petstore/petstore/api_another_fake.go | 131 ++ .../go/go-petstore/petstore/api_fake.go | 1671 ++++++++++++++++ .../petstore/api_fake_classname_tags123.go | 145 ++ .../go/go-petstore/petstore/api_pet.go | 977 ++++++++++ .../go/go-petstore/petstore/api_store.go | 433 +++++ .../go/go-petstore/petstore/api_user.go | 786 ++++++++ .../petstore/model_200_response.go | 150 ++ .../model_additional_properties_any_type.go | 114 ++ .../model_additional_properties_array.go | 114 ++ .../model_additional_properties_boolean.go | 114 ++ .../model_additional_properties_class.go | 474 +++++ .../model_additional_properties_integer.go | 114 ++ .../model_additional_properties_number.go | 114 ++ .../model_additional_properties_object.go | 114 ++ .../model_additional_properties_string.go | 114 ++ .../go/go-petstore/petstore/model_animal.go | 147 ++ .../petstore/model_api_response.go | 186 ++ .../model_array_of_array_of_number_only.go | 114 ++ .../petstore/model_array_of_number_only.go | 114 ++ .../go-petstore/petstore/model_array_test_.go | 186 ++ .../go/go-petstore/petstore/model_big_cat.go | 123 ++ .../petstore/model_big_cat_all_of.go | 114 ++ .../petstore/model_capitalization.go | 295 +++ .../go/go-petstore/petstore/model_cat.go | 123 ++ .../go-petstore/petstore/model_cat_all_of.go | 114 ++ .../go/go-petstore/petstore/model_category.go | 145 ++ .../go-petstore/petstore/model_class_model.go | 114 ++ .../go/go-petstore/petstore/model_client.go | 114 ++ .../go/go-petstore/petstore/model_dog.go | 123 ++ .../go-petstore/petstore/model_dog_all_of.go | 114 ++ .../go-petstore/petstore/model_enum_arrays.go | 150 ++ .../go-petstore/petstore/model_enum_class.go | 84 + .../go-petstore/petstore/model_enum_test_.go | 251 +++ .../go/go-petstore/petstore/model_file.go | 115 ++ .../petstore/model_file_schema_test_class.go | 150 ++ .../petstore/model_format_test_.go | 556 ++++++ .../petstore/model_has_only_read_only.go | 150 ++ .../go/go-petstore/petstore/model_list.go | 114 ++ .../go-petstore/petstore/model_map_test_.go | 222 +++ ...perties_and_additional_properties_class.go | 187 ++ .../go/go-petstore/petstore/model_name.go | 215 +++ .../go-petstore/petstore/model_number_only.go | 114 ++ .../go/go-petstore/petstore/model_order.go | 300 +++ .../petstore/model_outer_composite.go | 186 ++ .../go-petstore/petstore/model_outer_enum.go | 84 + .../go/go-petstore/petstore/model_pet.go | 281 +++ .../petstore/model_read_only_first.go | 150 ++ .../go/go-petstore/petstore/model_return.go | 114 ++ .../petstore/model_special_model_name.go | 114 ++ .../go/go-petstore/petstore/model_tag.go | 150 ++ .../petstore/model_type_holder_default.go | 227 +++ .../petstore/model_type_holder_example.go | 252 +++ .../go/go-petstore/petstore/model_user.go | 367 ++++ .../go/go-petstore/petstore/model_xml_item.go | 1122 +++++++++++ .../client/petstore/go/go-petstore/utils.go | 334 ++++ .../extensions/x-auth-id-alias/go/.gitignore | 24 + .../go/.openapi-generator-ignore | 23 + .../go/.openapi-generator/FILES | 13 + .../go/.openapi-generator/VERSION | 1 + .../extensions/x-auth-id-alias/go/.travis.yml | 8 + .../extensions/x-auth-id-alias/go/README.md | 127 ++ .../extensions/x-auth-id-alias/go/UsageApi.md | 256 +++ .../x-auth-id-alias/go/api/openapi.yaml | 114 ++ .../extensions/x-auth-id-alias/go/client.go | 532 ++++++ .../x-auth-id-alias/go/configuration.go | 262 +++ .../extensions/x-auth-id-alias/go/git_push.sh | 58 + .../extensions/x-auth-id-alias/go/go.mod | 7 + .../extensions/x-auth-id-alias/go/go.sum | 15 + .../extensions/x-auth-id-alias/go/response.go | 46 + .../extensions/x-auth-id-alias/go/utils.go | 334 ++++ .../go/x_auth_id_alias/api_usage.go | 490 +++++ .../petstore/go/go-petstore/200Response.md | 82 + .../go-petstore/AdditionalPropertiesClass.md | 82 + .../client/petstore/go/go-petstore/Animal.md | 77 + .../petstore/go/go-petstore/AnotherFakeApi.md | 75 + .../petstore/go/go-petstore/ApiResponse.md | 108 ++ .../client/petstore/go/go-petstore/Apple.md | 56 + .../petstore/go/go-petstore/AppleReq.md | 77 + .../go-petstore/ArrayOfArrayOfNumberOnly.md | 56 + .../go/go-petstore/ArrayOfNumberOnly.md | 56 + .../petstore/go/go-petstore/ArrayTest.md | 108 ++ .../client/petstore/go/go-petstore/Banana.md | 56 + .../petstore/go/go-petstore/BananaReq.md | 77 + .../petstore/go/go-petstore/Capitalization.md | 186 ++ .../client/petstore/go/go-petstore/Cat.md | 56 + .../petstore/go/go-petstore/CatAllOf.md | 56 + .../petstore/go/go-petstore/Category.md | 77 + .../petstore/go/go-petstore/ClassModel.md | 56 + .../client/petstore/go/go-petstore/Client.md | 56 + .../petstore/go/go-petstore/DefaultApi.md | 68 + .../client/petstore/go/go-petstore/Dog.md | 56 + .../petstore/go/go-petstore/DogAllOf.md | 56 + .../petstore/go/go-petstore/EnumArrays.md | 82 + .../petstore/go/go-petstore/EnumClass.md | 11 + .../petstore/go/go-petstore/EnumTest.md | 243 +++ .../client/petstore/go/go-petstore/FakeApi.md | 979 ++++++++++ .../go/go-petstore/FakeClassnameTags123Api.md | 75 + .../client/petstore/go/go-petstore/File.md | 56 + .../go/go-petstore/FileSchemaTestClass.md | 82 + .../client/petstore/go/go-petstore/Foo.md | 56 + .../petstore/go/go-petstore/FormatTest.md | 400 ++++ .../client/petstore/go/go-petstore/Fruit.md | 108 ++ .../petstore/go/go-petstore/FruitReq.md | 124 ++ .../client/petstore/go/go-petstore/GmFruit.md | 108 ++ .../go/go-petstore/HasOnlyReadOnly.md | 82 + .../go/go-petstore/HealthCheckResult.md | 66 + .../petstore/go/go-petstore/InlineObject.md | 82 + .../petstore/go/go-petstore/InlineObject1.md | 82 + .../petstore/go/go-petstore/InlineObject2.md | 82 + .../petstore/go/go-petstore/InlineObject3.md | 374 ++++ .../petstore/go/go-petstore/InlineObject4.md | 72 + .../petstore/go/go-petstore/InlineObject5.md | 77 + .../go/go-petstore/InlineResponseDefault.md | 56 + .../client/petstore/go/go-petstore/List.md | 56 + .../client/petstore/go/go-petstore/Mammal.md | 129 ++ .../client/petstore/go/go-petstore/MapTest.md | 134 ++ ...dPropertiesAndAdditionalPropertiesClass.md | 108 ++ .../client/petstore/go/go-petstore/Name.md | 129 ++ .../petstore/go/go-petstore/NullableClass.md | 442 +++++ .../petstore/go/go-petstore/NumberOnly.md | 56 + .../client/petstore/go/go-petstore/Order.md | 186 ++ .../petstore/go/go-petstore/OuterComposite.md | 108 ++ .../petstore/go/go-petstore/OuterEnum.md | 11 + .../go/go-petstore/OuterEnumDefaultValue.md | 11 + .../go/go-petstore/OuterEnumInteger.md | 11 + .../OuterEnumIntegerDefaultValue.md | 11 + .../client/petstore/go/go-petstore/Pet.md | 176 ++ .../client/petstore/go/go-petstore/PetApi.md | 625 ++++++ .../petstore/go/go-petstore/ReadOnlyFirst.md | 82 + .../client/petstore/go/go-petstore/Return.md | 56 + .../go/go-petstore/SpecialModelName.md | 56 + .../petstore/go/go-petstore/StoreApi.md | 275 +++ .../client/petstore/go/go-petstore/Tag.md | 82 + .../client/petstore/go/go-petstore/User.md | 372 ++++ .../client/petstore/go/go-petstore/UserApi.md | 533 ++++++ .../client/petstore/go/go-petstore/Whale.md | 103 + .../client/petstore/go/go-petstore/Zebra.md | 77 + .../go-petstore/petstore/api_another_fake.go | 131 ++ .../go/go-petstore/petstore/api_default.go | 127 ++ .../go/go-petstore/petstore/api_fake.go | 1690 +++++++++++++++++ .../petstore/api_fake_classname_tags123.go | 145 ++ .../go/go-petstore/petstore/api_pet.go | 977 ++++++++++ .../go/go-petstore/petstore/api_store.go | 433 +++++ .../go/go-petstore/petstore/api_user.go | 786 ++++++++ .../petstore/model_200_response.go | 176 ++ .../petstore/model__special_model_name_.go | 139 ++ .../model_additional_properties_class.go | 176 ++ .../go/go-petstore/petstore/model_animal.go | 173 ++ .../petstore/model_api_response.go | 213 +++ .../go/go-petstore/petstore/model_apple.go | 139 ++ .../go-petstore/petstore/model_apple_req.go | 169 ++ .../model_array_of_array_of_number_only.go | 139 ++ .../petstore/model_array_of_number_only.go | 139 ++ .../go-petstore/petstore/model_array_test_.go | 213 +++ .../go/go-petstore/petstore/model_banana.go | 139 ++ .../go-petstore/petstore/model_banana_req.go | 169 ++ .../petstore/model_capitalization.go | 325 ++++ .../go/go-petstore/petstore/model_cat.go | 187 ++ .../go-petstore/petstore/model_cat_all_of.go | 139 ++ .../go/go-petstore/petstore/model_category.go | 171 ++ .../go-petstore/petstore/model_class_model.go | 139 ++ .../go/go-petstore/petstore/model_client.go | 139 ++ .../go/go-petstore/petstore/model_dog.go | 187 ++ .../go-petstore/petstore/model_dog_all_of.go | 139 ++ .../go-petstore/petstore/model_enum_arrays.go | 176 ++ .../go-petstore/petstore/model_enum_class.go | 84 + .../go-petstore/petstore/model_enum_test_.go | 409 ++++ .../go/go-petstore/petstore/model_file.go | 140 ++ .../petstore/model_file_schema_test_class.go | 176 ++ .../go/go-petstore/petstore/model_foo.go | 143 ++ .../petstore/model_format_test_.go | 633 ++++++ .../go/go-petstore/petstore/model_fruit.go | 140 ++ .../go-petstore/petstore/model_fruit_req.go | 140 ++ .../go/go-petstore/petstore/model_gm_fruit.go | 104 + .../petstore/model_has_only_read_only.go | 176 ++ .../petstore/model_health_check_result.go | 149 ++ .../petstore/model_inline_object.go | 178 ++ .../petstore/model_inline_object_1.go | 179 ++ .../petstore/model_inline_object_2.go | 182 ++ .../petstore/model_inline_object_3.go | 608 ++++++ .../petstore/model_inline_object_4.go | 164 ++ .../petstore/model_inline_object_5.go | 172 ++ .../petstore/model_inline_response_default.go | 139 ++ .../go/go-petstore/petstore/model_list.go | 139 ++ .../go/go-petstore/petstore/model_mammal.go | 140 ++ .../go-petstore/petstore/model_map_test_.go | 250 +++ ...perties_and_additional_properties_class.go | 214 +++ .../go/go-petstore/petstore/model_name.go | 243 +++ .../petstore/model_nullable_class.go | 575 ++++++ .../go-petstore/petstore/model_number_only.go | 139 ++ .../go/go-petstore/petstore/model_order.go | 330 ++++ .../petstore/model_outer_composite.go | 213 +++ .../go-petstore/petstore/model_outer_enum.go | 84 + .../model_outer_enum_default_value.go | 84 + .../petstore/model_outer_enum_integer.go | 84 + .../model_outer_enum_integer_default_value.go | 84 + .../go/go-petstore/petstore/model_pet.go | 311 +++ .../petstore/model_read_only_first.go | 176 ++ .../go/go-petstore/petstore/model_return.go | 139 ++ .../go/go-petstore/petstore/model_tag.go | 176 ++ .../go/go-petstore/petstore/model_user.go | 554 ++++++ .../go/go-petstore/petstore/model_whale.go | 206 ++ .../go/go-petstore/petstore/model_zebra.go | 169 ++ .../client/petstore/go/go-petstore/signing.go | 423 +++++ .../client/petstore/go/go-petstore/utils.go | 334 ++++ 259 files changed, 49419 insertions(+) create mode 100644 samples/client/petstore/go/go-petstore/$Special[modelName].md create mode 100644 samples/client/petstore/go/go-petstore/200Response.md create mode 100644 samples/client/petstore/go/go-petstore/AdditionalPropertiesAnyType.md create mode 100644 samples/client/petstore/go/go-petstore/AdditionalPropertiesArray.md create mode 100644 samples/client/petstore/go/go-petstore/AdditionalPropertiesBoolean.md create mode 100644 samples/client/petstore/go/go-petstore/AdditionalPropertiesClass.md create mode 100644 samples/client/petstore/go/go-petstore/AdditionalPropertiesInteger.md create mode 100644 samples/client/petstore/go/go-petstore/AdditionalPropertiesNumber.md create mode 100644 samples/client/petstore/go/go-petstore/AdditionalPropertiesObject.md create mode 100644 samples/client/petstore/go/go-petstore/AdditionalPropertiesString.md create mode 100644 samples/client/petstore/go/go-petstore/Animal.md create mode 100644 samples/client/petstore/go/go-petstore/AnotherFakeApi.md create mode 100644 samples/client/petstore/go/go-petstore/ApiResponse.md create mode 100644 samples/client/petstore/go/go-petstore/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/client/petstore/go/go-petstore/ArrayOfNumberOnly.md create mode 100644 samples/client/petstore/go/go-petstore/ArrayTest.md create mode 100644 samples/client/petstore/go/go-petstore/BigCat.md create mode 100644 samples/client/petstore/go/go-petstore/BigCatAllOf.md create mode 100644 samples/client/petstore/go/go-petstore/Capitalization.md create mode 100644 samples/client/petstore/go/go-petstore/Cat.md create mode 100644 samples/client/petstore/go/go-petstore/CatAllOf.md create mode 100644 samples/client/petstore/go/go-petstore/Category.md create mode 100644 samples/client/petstore/go/go-petstore/ClassModel.md create mode 100644 samples/client/petstore/go/go-petstore/Client.md create mode 100644 samples/client/petstore/go/go-petstore/Dog.md create mode 100644 samples/client/petstore/go/go-petstore/DogAllOf.md create mode 100644 samples/client/petstore/go/go-petstore/EnumArrays.md create mode 100644 samples/client/petstore/go/go-petstore/EnumClass.md create mode 100644 samples/client/petstore/go/go-petstore/EnumTest.md create mode 100644 samples/client/petstore/go/go-petstore/FakeApi.md create mode 100644 samples/client/petstore/go/go-petstore/FakeClassnameTags123Api.md create mode 100644 samples/client/petstore/go/go-petstore/File.md create mode 100644 samples/client/petstore/go/go-petstore/FileSchemaTestClass.md create mode 100644 samples/client/petstore/go/go-petstore/FormatTest.md create mode 100644 samples/client/petstore/go/go-petstore/HasOnlyReadOnly.md create mode 100644 samples/client/petstore/go/go-petstore/List.md create mode 100644 samples/client/petstore/go/go-petstore/MapTest.md create mode 100644 samples/client/petstore/go/go-petstore/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/client/petstore/go/go-petstore/Name.md create mode 100644 samples/client/petstore/go/go-petstore/NumberOnly.md create mode 100644 samples/client/petstore/go/go-petstore/Order.md create mode 100644 samples/client/petstore/go/go-petstore/OuterComposite.md create mode 100644 samples/client/petstore/go/go-petstore/OuterEnum.md create mode 100644 samples/client/petstore/go/go-petstore/Pet.md create mode 100644 samples/client/petstore/go/go-petstore/PetApi.md create mode 100644 samples/client/petstore/go/go-petstore/ReadOnlyFirst.md create mode 100644 samples/client/petstore/go/go-petstore/Return.md create mode 100644 samples/client/petstore/go/go-petstore/StoreApi.md create mode 100644 samples/client/petstore/go/go-petstore/Tag.md create mode 100644 samples/client/petstore/go/go-petstore/TypeHolderDefault.md create mode 100644 samples/client/petstore/go/go-petstore/TypeHolderExample.md create mode 100644 samples/client/petstore/go/go-petstore/User.md create mode 100644 samples/client/petstore/go/go-petstore/UserApi.md create mode 100644 samples/client/petstore/go/go-petstore/XmlItem.md create mode 100644 samples/client/petstore/go/go-petstore/petstore/api_another_fake.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/api_fake.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/api_fake_classname_tags123.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/api_pet.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/api_store.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/api_user.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_200_response.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_additional_properties_any_type.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_additional_properties_array.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_additional_properties_boolean.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_additional_properties_class.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_additional_properties_integer.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_additional_properties_number.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_additional_properties_object.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_additional_properties_string.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_animal.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_api_response.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_array_of_array_of_number_only.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_array_of_number_only.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_array_test_.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_big_cat.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_big_cat_all_of.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_capitalization.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_cat.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_cat_all_of.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_category.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_class_model.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_client.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_dog.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_dog_all_of.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_enum_arrays.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_enum_class.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_enum_test_.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_file.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_file_schema_test_class.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_format_test_.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_has_only_read_only.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_list.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_map_test_.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_mixed_properties_and_additional_properties_class.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_name.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_number_only.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_order.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_outer_composite.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_outer_enum.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_pet.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_read_only_first.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_return.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_special_model_name.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_tag.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_type_holder_default.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_type_holder_example.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_user.go create mode 100644 samples/client/petstore/go/go-petstore/petstore/model_xml_item.go create mode 100644 samples/client/petstore/go/go-petstore/utils.go create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/.gitignore create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/.openapi-generator-ignore create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/.openapi-generator/FILES create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/.openapi-generator/VERSION create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/.travis.yml create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/README.md create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/UsageApi.md create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/api/openapi.yaml create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/client.go create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/configuration.go create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/git_push.sh create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/go.mod create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/go.sum create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/response.go create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/utils.go create mode 100644 samples/openapi3/client/extensions/x-auth-id-alias/go/x_auth_id_alias/api_usage.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/200Response.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/AdditionalPropertiesClass.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Animal.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/AnotherFakeApi.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/ApiResponse.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Apple.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/AppleReq.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/ArrayOfNumberOnly.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/ArrayTest.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Banana.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/BananaReq.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Capitalization.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Cat.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/CatAllOf.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Category.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/ClassModel.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Client.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/DefaultApi.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Dog.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/DogAllOf.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/EnumArrays.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/EnumClass.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/EnumTest.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/FakeApi.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/FakeClassnameTags123Api.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/File.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/FileSchemaTestClass.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Foo.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/FormatTest.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Fruit.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/FruitReq.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/GmFruit.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/HasOnlyReadOnly.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/HealthCheckResult.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/InlineObject.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/InlineObject1.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/InlineObject2.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/InlineObject3.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/InlineObject4.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/InlineObject5.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/InlineResponseDefault.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/List.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Mammal.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/MapTest.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Name.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/NullableClass.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/NumberOnly.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Order.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/OuterComposite.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/OuterEnum.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/OuterEnumDefaultValue.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/OuterEnumInteger.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/OuterEnumIntegerDefaultValue.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Pet.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/PetApi.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/ReadOnlyFirst.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Return.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/SpecialModelName.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/StoreApi.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Tag.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/User.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/UserApi.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Whale.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/Zebra.md create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/api_another_fake.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/api_default.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/api_fake.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/api_fake_classname_tags123.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/api_pet.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/api_store.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/api_user.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_200_response.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model__special_model_name_.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_additional_properties_class.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_animal.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_api_response.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_apple.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_apple_req.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_array_of_array_of_number_only.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_array_of_number_only.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_array_test_.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_banana.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_banana_req.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_capitalization.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_cat.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_cat_all_of.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_category.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_class_model.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_client.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_dog.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_dog_all_of.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_enum_arrays.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_enum_class.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_enum_test_.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_file.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_file_schema_test_class.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_foo.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_format_test_.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_fruit.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_fruit_req.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_gm_fruit.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_has_only_read_only.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_health_check_result.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_1.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_2.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_3.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_4.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_5.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_response_default.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_list.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_mammal.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_map_test_.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_mixed_properties_and_additional_properties_class.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_name.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_nullable_class.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_number_only.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_order.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_composite.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum_default_value.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum_integer.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum_integer_default_value.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_pet.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_read_only_first.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_return.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_tag.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_user.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_whale.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/petstore/model_zebra.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/signing.go create mode 100644 samples/openapi3/client/petstore/go/go-petstore/utils.go diff --git a/samples/client/petstore/go/go-petstore/$Special[modelName].md b/samples/client/petstore/go/go-petstore/$Special[modelName].md new file mode 100644 index 00000000000..3e5a187c1d1 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/$Special[modelName].md @@ -0,0 +1,56 @@ +# SpecialModelName + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SpecialPropertyName** | Pointer to **int64** | | [optional] + +## Methods + +### NewSpecialModelName + +`func NewSpecialModelName() *SpecialModelName` + +NewSpecialModelName instantiates a new SpecialModelName 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 + +### NewSpecialModelNameWithDefaults + +`func NewSpecialModelNameWithDefaults() *SpecialModelName` + +NewSpecialModelNameWithDefaults instantiates a new SpecialModelName 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 + +### GetSpecialPropertyName + +`func (o *SpecialModelName) GetSpecialPropertyName() int64` + +GetSpecialPropertyName returns the SpecialPropertyName field if non-nil, zero value otherwise. + +### GetSpecialPropertyNameOk + +`func (o *SpecialModelName) GetSpecialPropertyNameOk() (*int64, bool)` + +GetSpecialPropertyNameOk returns a tuple with the SpecialPropertyName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSpecialPropertyName + +`func (o *SpecialModelName) SetSpecialPropertyName(v int64)` + +SetSpecialPropertyName sets SpecialPropertyName field to given value. + +### HasSpecialPropertyName + +`func (o *SpecialModelName) HasSpecialPropertyName() bool` + +HasSpecialPropertyName 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) + + diff --git a/samples/client/petstore/go/go-petstore/200Response.md b/samples/client/petstore/go/go-petstore/200Response.md new file mode 100644 index 00000000000..4e0d89fe88f --- /dev/null +++ b/samples/client/petstore/go/go-petstore/200Response.md @@ -0,0 +1,82 @@ +# Model200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **int32** | | [optional] +**Class** | Pointer to **string** | | [optional] + +## Methods + +### NewModel200Response + +`func NewModel200Response() *Model200Response` + +NewModel200Response instantiates a new Model200Response 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 + +### NewModel200ResponseWithDefaults + +`func NewModel200ResponseWithDefaults() *Model200Response` + +NewModel200ResponseWithDefaults instantiates a new Model200Response 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 + +### GetName + +`func (o *Model200Response) GetName() int32` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Model200Response) GetNameOk() (*int32, 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 *Model200Response) SetName(v int32)` + +SetName sets Name field to given value. + +### HasName + +`func (o *Model200Response) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetClass + +`func (o *Model200Response) GetClass() string` + +GetClass returns the Class field if non-nil, zero value otherwise. + +### GetClassOk + +`func (o *Model200Response) GetClassOk() (*string, bool)` + +GetClassOk returns a tuple with the Class field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetClass + +`func (o *Model200Response) SetClass(v string)` + +SetClass sets Class field to given value. + +### HasClass + +`func (o *Model200Response) HasClass() bool` + +HasClass 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) + + diff --git a/samples/client/petstore/go/go-petstore/AdditionalPropertiesAnyType.md b/samples/client/petstore/go/go-petstore/AdditionalPropertiesAnyType.md new file mode 100644 index 00000000000..bcce58bb763 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/AdditionalPropertiesAnyType.md @@ -0,0 +1,56 @@ +# AdditionalPropertiesAnyType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | | [optional] + +## Methods + +### NewAdditionalPropertiesAnyType + +`func NewAdditionalPropertiesAnyType() *AdditionalPropertiesAnyType` + +NewAdditionalPropertiesAnyType instantiates a new AdditionalPropertiesAnyType 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 + +### NewAdditionalPropertiesAnyTypeWithDefaults + +`func NewAdditionalPropertiesAnyTypeWithDefaults() *AdditionalPropertiesAnyType` + +NewAdditionalPropertiesAnyTypeWithDefaults instantiates a new AdditionalPropertiesAnyType 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 + +### GetName + +`func (o *AdditionalPropertiesAnyType) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *AdditionalPropertiesAnyType) 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 *AdditionalPropertiesAnyType) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *AdditionalPropertiesAnyType) 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) + + diff --git a/samples/client/petstore/go/go-petstore/AdditionalPropertiesArray.md b/samples/client/petstore/go/go-petstore/AdditionalPropertiesArray.md new file mode 100644 index 00000000000..9b01a34cbbf --- /dev/null +++ b/samples/client/petstore/go/go-petstore/AdditionalPropertiesArray.md @@ -0,0 +1,56 @@ +# AdditionalPropertiesArray + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | | [optional] + +## Methods + +### NewAdditionalPropertiesArray + +`func NewAdditionalPropertiesArray() *AdditionalPropertiesArray` + +NewAdditionalPropertiesArray instantiates a new AdditionalPropertiesArray 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 + +### NewAdditionalPropertiesArrayWithDefaults + +`func NewAdditionalPropertiesArrayWithDefaults() *AdditionalPropertiesArray` + +NewAdditionalPropertiesArrayWithDefaults instantiates a new AdditionalPropertiesArray 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 + +### GetName + +`func (o *AdditionalPropertiesArray) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *AdditionalPropertiesArray) 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 *AdditionalPropertiesArray) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *AdditionalPropertiesArray) 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) + + diff --git a/samples/client/petstore/go/go-petstore/AdditionalPropertiesBoolean.md b/samples/client/petstore/go/go-petstore/AdditionalPropertiesBoolean.md new file mode 100644 index 00000000000..da3ebcea97e --- /dev/null +++ b/samples/client/petstore/go/go-petstore/AdditionalPropertiesBoolean.md @@ -0,0 +1,56 @@ +# AdditionalPropertiesBoolean + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | | [optional] + +## Methods + +### NewAdditionalPropertiesBoolean + +`func NewAdditionalPropertiesBoolean() *AdditionalPropertiesBoolean` + +NewAdditionalPropertiesBoolean instantiates a new AdditionalPropertiesBoolean 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 + +### NewAdditionalPropertiesBooleanWithDefaults + +`func NewAdditionalPropertiesBooleanWithDefaults() *AdditionalPropertiesBoolean` + +NewAdditionalPropertiesBooleanWithDefaults instantiates a new AdditionalPropertiesBoolean 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 + +### GetName + +`func (o *AdditionalPropertiesBoolean) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *AdditionalPropertiesBoolean) 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 *AdditionalPropertiesBoolean) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *AdditionalPropertiesBoolean) 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) + + diff --git a/samples/client/petstore/go/go-petstore/AdditionalPropertiesClass.md b/samples/client/petstore/go/go-petstore/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..a035ff98c8f --- /dev/null +++ b/samples/client/petstore/go/go-petstore/AdditionalPropertiesClass.md @@ -0,0 +1,316 @@ +# AdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MapString** | Pointer to **map[string]string** | | [optional] +**MapNumber** | Pointer to **map[string]float32** | | [optional] +**MapInteger** | Pointer to **map[string]int32** | | [optional] +**MapBoolean** | Pointer to **map[string]bool** | | [optional] +**MapArrayInteger** | Pointer to [**map[string][]int32**](array.md) | | [optional] +**MapArrayAnytype** | Pointer to [**map[string][]map[string]interface{}**](array.md) | | [optional] +**MapMapString** | Pointer to [**map[string]map[string]string**](map.md) | | [optional] +**MapMapAnytype** | Pointer to [**map[string]map[string]map[string]interface{}**](map.md) | | [optional] +**Anytype1** | Pointer to **map[string]interface{}** | | [optional] +**Anytype2** | Pointer to **map[string]interface{}** | | [optional] +**Anytype3** | Pointer to **map[string]interface{}** | | [optional] + +## Methods + +### NewAdditionalPropertiesClass + +`func NewAdditionalPropertiesClass() *AdditionalPropertiesClass` + +NewAdditionalPropertiesClass instantiates a new AdditionalPropertiesClass 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 + +### NewAdditionalPropertiesClassWithDefaults + +`func NewAdditionalPropertiesClassWithDefaults() *AdditionalPropertiesClass` + +NewAdditionalPropertiesClassWithDefaults instantiates a new AdditionalPropertiesClass 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 + +### GetMapString + +`func (o *AdditionalPropertiesClass) GetMapString() map[string]string` + +GetMapString returns the MapString field if non-nil, zero value otherwise. + +### GetMapStringOk + +`func (o *AdditionalPropertiesClass) GetMapStringOk() (*map[string]string, bool)` + +GetMapStringOk returns a tuple with the MapString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMapString + +`func (o *AdditionalPropertiesClass) SetMapString(v map[string]string)` + +SetMapString sets MapString field to given value. + +### HasMapString + +`func (o *AdditionalPropertiesClass) HasMapString() bool` + +HasMapString returns a boolean if a field has been set. + +### GetMapNumber + +`func (o *AdditionalPropertiesClass) GetMapNumber() map[string]float32` + +GetMapNumber returns the MapNumber field if non-nil, zero value otherwise. + +### GetMapNumberOk + +`func (o *AdditionalPropertiesClass) GetMapNumberOk() (*map[string]float32, bool)` + +GetMapNumberOk returns a tuple with the MapNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMapNumber + +`func (o *AdditionalPropertiesClass) SetMapNumber(v map[string]float32)` + +SetMapNumber sets MapNumber field to given value. + +### HasMapNumber + +`func (o *AdditionalPropertiesClass) HasMapNumber() bool` + +HasMapNumber returns a boolean if a field has been set. + +### GetMapInteger + +`func (o *AdditionalPropertiesClass) GetMapInteger() map[string]int32` + +GetMapInteger returns the MapInteger field if non-nil, zero value otherwise. + +### GetMapIntegerOk + +`func (o *AdditionalPropertiesClass) GetMapIntegerOk() (*map[string]int32, bool)` + +GetMapIntegerOk returns a tuple with the MapInteger field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMapInteger + +`func (o *AdditionalPropertiesClass) SetMapInteger(v map[string]int32)` + +SetMapInteger sets MapInteger field to given value. + +### HasMapInteger + +`func (o *AdditionalPropertiesClass) HasMapInteger() bool` + +HasMapInteger returns a boolean if a field has been set. + +### GetMapBoolean + +`func (o *AdditionalPropertiesClass) GetMapBoolean() map[string]bool` + +GetMapBoolean returns the MapBoolean field if non-nil, zero value otherwise. + +### GetMapBooleanOk + +`func (o *AdditionalPropertiesClass) GetMapBooleanOk() (*map[string]bool, bool)` + +GetMapBooleanOk returns a tuple with the MapBoolean field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMapBoolean + +`func (o *AdditionalPropertiesClass) SetMapBoolean(v map[string]bool)` + +SetMapBoolean sets MapBoolean field to given value. + +### HasMapBoolean + +`func (o *AdditionalPropertiesClass) HasMapBoolean() bool` + +HasMapBoolean returns a boolean if a field has been set. + +### GetMapArrayInteger + +`func (o *AdditionalPropertiesClass) GetMapArrayInteger() map[string][]int32` + +GetMapArrayInteger returns the MapArrayInteger field if non-nil, zero value otherwise. + +### GetMapArrayIntegerOk + +`func (o *AdditionalPropertiesClass) GetMapArrayIntegerOk() (*map[string][]int32, bool)` + +GetMapArrayIntegerOk returns a tuple with the MapArrayInteger field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMapArrayInteger + +`func (o *AdditionalPropertiesClass) SetMapArrayInteger(v map[string][]int32)` + +SetMapArrayInteger sets MapArrayInteger field to given value. + +### HasMapArrayInteger + +`func (o *AdditionalPropertiesClass) HasMapArrayInteger() bool` + +HasMapArrayInteger returns a boolean if a field has been set. + +### GetMapArrayAnytype + +`func (o *AdditionalPropertiesClass) GetMapArrayAnytype() map[string][]map[string]interface{}` + +GetMapArrayAnytype returns the MapArrayAnytype field if non-nil, zero value otherwise. + +### GetMapArrayAnytypeOk + +`func (o *AdditionalPropertiesClass) GetMapArrayAnytypeOk() (*map[string][]map[string]interface{}, bool)` + +GetMapArrayAnytypeOk returns a tuple with the MapArrayAnytype field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMapArrayAnytype + +`func (o *AdditionalPropertiesClass) SetMapArrayAnytype(v map[string][]map[string]interface{})` + +SetMapArrayAnytype sets MapArrayAnytype field to given value. + +### HasMapArrayAnytype + +`func (o *AdditionalPropertiesClass) HasMapArrayAnytype() bool` + +HasMapArrayAnytype returns a boolean if a field has been set. + +### GetMapMapString + +`func (o *AdditionalPropertiesClass) GetMapMapString() map[string]map[string]string` + +GetMapMapString returns the MapMapString field if non-nil, zero value otherwise. + +### GetMapMapStringOk + +`func (o *AdditionalPropertiesClass) GetMapMapStringOk() (*map[string]map[string]string, bool)` + +GetMapMapStringOk returns a tuple with the MapMapString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMapMapString + +`func (o *AdditionalPropertiesClass) SetMapMapString(v map[string]map[string]string)` + +SetMapMapString sets MapMapString field to given value. + +### HasMapMapString + +`func (o *AdditionalPropertiesClass) HasMapMapString() bool` + +HasMapMapString returns a boolean if a field has been set. + +### GetMapMapAnytype + +`func (o *AdditionalPropertiesClass) GetMapMapAnytype() map[string]map[string]map[string]interface{}` + +GetMapMapAnytype returns the MapMapAnytype field if non-nil, zero value otherwise. + +### GetMapMapAnytypeOk + +`func (o *AdditionalPropertiesClass) GetMapMapAnytypeOk() (*map[string]map[string]map[string]interface{}, bool)` + +GetMapMapAnytypeOk returns a tuple with the MapMapAnytype field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMapMapAnytype + +`func (o *AdditionalPropertiesClass) SetMapMapAnytype(v map[string]map[string]map[string]interface{})` + +SetMapMapAnytype sets MapMapAnytype field to given value. + +### HasMapMapAnytype + +`func (o *AdditionalPropertiesClass) HasMapMapAnytype() bool` + +HasMapMapAnytype returns a boolean if a field has been set. + +### GetAnytype1 + +`func (o *AdditionalPropertiesClass) GetAnytype1() map[string]interface{}` + +GetAnytype1 returns the Anytype1 field if non-nil, zero value otherwise. + +### GetAnytype1Ok + +`func (o *AdditionalPropertiesClass) GetAnytype1Ok() (*map[string]interface{}, bool)` + +GetAnytype1Ok returns a tuple with the Anytype1 field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAnytype1 + +`func (o *AdditionalPropertiesClass) SetAnytype1(v map[string]interface{})` + +SetAnytype1 sets Anytype1 field to given value. + +### HasAnytype1 + +`func (o *AdditionalPropertiesClass) HasAnytype1() bool` + +HasAnytype1 returns a boolean if a field has been set. + +### GetAnytype2 + +`func (o *AdditionalPropertiesClass) GetAnytype2() map[string]interface{}` + +GetAnytype2 returns the Anytype2 field if non-nil, zero value otherwise. + +### GetAnytype2Ok + +`func (o *AdditionalPropertiesClass) GetAnytype2Ok() (*map[string]interface{}, bool)` + +GetAnytype2Ok returns a tuple with the Anytype2 field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAnytype2 + +`func (o *AdditionalPropertiesClass) SetAnytype2(v map[string]interface{})` + +SetAnytype2 sets Anytype2 field to given value. + +### HasAnytype2 + +`func (o *AdditionalPropertiesClass) HasAnytype2() bool` + +HasAnytype2 returns a boolean if a field has been set. + +### GetAnytype3 + +`func (o *AdditionalPropertiesClass) GetAnytype3() map[string]interface{}` + +GetAnytype3 returns the Anytype3 field if non-nil, zero value otherwise. + +### GetAnytype3Ok + +`func (o *AdditionalPropertiesClass) GetAnytype3Ok() (*map[string]interface{}, bool)` + +GetAnytype3Ok returns a tuple with the Anytype3 field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAnytype3 + +`func (o *AdditionalPropertiesClass) SetAnytype3(v map[string]interface{})` + +SetAnytype3 sets Anytype3 field to given value. + +### HasAnytype3 + +`func (o *AdditionalPropertiesClass) HasAnytype3() bool` + +HasAnytype3 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) + + diff --git a/samples/client/petstore/go/go-petstore/AdditionalPropertiesInteger.md b/samples/client/petstore/go/go-petstore/AdditionalPropertiesInteger.md new file mode 100644 index 00000000000..68d29ef339a --- /dev/null +++ b/samples/client/petstore/go/go-petstore/AdditionalPropertiesInteger.md @@ -0,0 +1,56 @@ +# AdditionalPropertiesInteger + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | | [optional] + +## Methods + +### NewAdditionalPropertiesInteger + +`func NewAdditionalPropertiesInteger() *AdditionalPropertiesInteger` + +NewAdditionalPropertiesInteger instantiates a new AdditionalPropertiesInteger 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 + +### NewAdditionalPropertiesIntegerWithDefaults + +`func NewAdditionalPropertiesIntegerWithDefaults() *AdditionalPropertiesInteger` + +NewAdditionalPropertiesIntegerWithDefaults instantiates a new AdditionalPropertiesInteger 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 + +### GetName + +`func (o *AdditionalPropertiesInteger) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *AdditionalPropertiesInteger) 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 *AdditionalPropertiesInteger) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *AdditionalPropertiesInteger) 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) + + diff --git a/samples/client/petstore/go/go-petstore/AdditionalPropertiesNumber.md b/samples/client/petstore/go/go-petstore/AdditionalPropertiesNumber.md new file mode 100644 index 00000000000..53fb9c858c0 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/AdditionalPropertiesNumber.md @@ -0,0 +1,56 @@ +# AdditionalPropertiesNumber + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | | [optional] + +## Methods + +### NewAdditionalPropertiesNumber + +`func NewAdditionalPropertiesNumber() *AdditionalPropertiesNumber` + +NewAdditionalPropertiesNumber instantiates a new AdditionalPropertiesNumber 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 + +### NewAdditionalPropertiesNumberWithDefaults + +`func NewAdditionalPropertiesNumberWithDefaults() *AdditionalPropertiesNumber` + +NewAdditionalPropertiesNumberWithDefaults instantiates a new AdditionalPropertiesNumber 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 + +### GetName + +`func (o *AdditionalPropertiesNumber) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *AdditionalPropertiesNumber) 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 *AdditionalPropertiesNumber) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *AdditionalPropertiesNumber) 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) + + diff --git a/samples/client/petstore/go/go-petstore/AdditionalPropertiesObject.md b/samples/client/petstore/go/go-petstore/AdditionalPropertiesObject.md new file mode 100644 index 00000000000..8444c127941 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/AdditionalPropertiesObject.md @@ -0,0 +1,56 @@ +# AdditionalPropertiesObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | | [optional] + +## Methods + +### NewAdditionalPropertiesObject + +`func NewAdditionalPropertiesObject() *AdditionalPropertiesObject` + +NewAdditionalPropertiesObject instantiates a new AdditionalPropertiesObject 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 + +### NewAdditionalPropertiesObjectWithDefaults + +`func NewAdditionalPropertiesObjectWithDefaults() *AdditionalPropertiesObject` + +NewAdditionalPropertiesObjectWithDefaults instantiates a new AdditionalPropertiesObject 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 + +### GetName + +`func (o *AdditionalPropertiesObject) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *AdditionalPropertiesObject) 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 *AdditionalPropertiesObject) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *AdditionalPropertiesObject) 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) + + diff --git a/samples/client/petstore/go/go-petstore/AdditionalPropertiesString.md b/samples/client/petstore/go/go-petstore/AdditionalPropertiesString.md new file mode 100644 index 00000000000..6a95762122b --- /dev/null +++ b/samples/client/petstore/go/go-petstore/AdditionalPropertiesString.md @@ -0,0 +1,56 @@ +# AdditionalPropertiesString + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | | [optional] + +## Methods + +### NewAdditionalPropertiesString + +`func NewAdditionalPropertiesString() *AdditionalPropertiesString` + +NewAdditionalPropertiesString instantiates a new AdditionalPropertiesString 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 + +### NewAdditionalPropertiesStringWithDefaults + +`func NewAdditionalPropertiesStringWithDefaults() *AdditionalPropertiesString` + +NewAdditionalPropertiesStringWithDefaults instantiates a new AdditionalPropertiesString 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 + +### GetName + +`func (o *AdditionalPropertiesString) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *AdditionalPropertiesString) 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 *AdditionalPropertiesString) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *AdditionalPropertiesString) 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) + + diff --git a/samples/client/petstore/go/go-petstore/Animal.md b/samples/client/petstore/go/go-petstore/Animal.md new file mode 100644 index 00000000000..293f75c5171 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/Animal.md @@ -0,0 +1,77 @@ +# Animal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | Pointer to **string** | | [optional] [default to "red"] + +## Methods + +### NewAnimal + +`func NewAnimal(className string, ) *Animal` + +NewAnimal instantiates a new Animal 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 + +### NewAnimalWithDefaults + +`func NewAnimalWithDefaults() *Animal` + +NewAnimalWithDefaults instantiates a new Animal 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 + +### GetClassName + +`func (o *Animal) GetClassName() string` + +GetClassName returns the ClassName field if non-nil, zero value otherwise. + +### GetClassNameOk + +`func (o *Animal) GetClassNameOk() (*string, bool)` + +GetClassNameOk returns a tuple with the ClassName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetClassName + +`func (o *Animal) SetClassName(v string)` + +SetClassName sets ClassName field to given value. + + +### GetColor + +`func (o *Animal) GetColor() string` + +GetColor returns the Color field if non-nil, zero value otherwise. + +### GetColorOk + +`func (o *Animal) 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 *Animal) SetColor(v string)` + +SetColor sets Color field to given value. + +### HasColor + +`func (o *Animal) 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) + + diff --git a/samples/client/petstore/go/go-petstore/AnotherFakeApi.md b/samples/client/petstore/go/go-petstore/AnotherFakeApi.md new file mode 100644 index 00000000000..669daa616b7 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/AnotherFakeApi.md @@ -0,0 +1,75 @@ +# \AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Call123TestSpecialTags**](AnotherFakeApi.md#Call123TestSpecialTags) | **Patch** /another-fake/dummy | To test special tags + + + +## Call123TestSpecialTags + +> Client Call123TestSpecialTags(ctx).Body(body).Execute() + +To test special tags + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.Client{Client: "Client_example"} // Client | client model + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.AnotherFakeApi.Call123TestSpecialTags(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AnotherFakeApi.Call123TestSpecialTags``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `Call123TestSpecialTags`: Client + fmt.Fprintf(os.Stdout, "Response from `AnotherFakeApi.Call123TestSpecialTags`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCall123TestSpecialTagsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md) | client model | + +### Return type + +[**Client**](Client.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) + diff --git a/samples/client/petstore/go/go-petstore/ApiResponse.md b/samples/client/petstore/go/go-petstore/ApiResponse.md new file mode 100644 index 00000000000..877dacb4293 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/ApiResponse.md @@ -0,0 +1,108 @@ +# ApiResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | Pointer to **int32** | | [optional] +**Type** | Pointer to **string** | | [optional] +**Message** | Pointer to **string** | | [optional] + +## Methods + +### NewApiResponse + +`func NewApiResponse() *ApiResponse` + +NewApiResponse instantiates a new ApiResponse 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 + +### NewApiResponseWithDefaults + +`func NewApiResponseWithDefaults() *ApiResponse` + +NewApiResponseWithDefaults instantiates a new ApiResponse 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 + +### GetCode + +`func (o *ApiResponse) GetCode() int32` + +GetCode returns the Code field if non-nil, zero value otherwise. + +### GetCodeOk + +`func (o *ApiResponse) GetCodeOk() (*int32, bool)` + +GetCodeOk returns a tuple with the Code field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCode + +`func (o *ApiResponse) SetCode(v int32)` + +SetCode sets Code field to given value. + +### HasCode + +`func (o *ApiResponse) HasCode() bool` + +HasCode returns a boolean if a field has been set. + +### GetType + +`func (o *ApiResponse) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *ApiResponse) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *ApiResponse) SetType(v string)` + +SetType sets Type field to given value. + +### HasType + +`func (o *ApiResponse) HasType() bool` + +HasType returns a boolean if a field has been set. + +### GetMessage + +`func (o *ApiResponse) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *ApiResponse) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *ApiResponse) SetMessage(v string)` + +SetMessage sets Message field to given value. + +### HasMessage + +`func (o *ApiResponse) HasMessage() bool` + +HasMessage 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) + + diff --git a/samples/client/petstore/go/go-petstore/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/go/go-petstore/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..cb46da598b1 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,56 @@ +# ArrayOfArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayNumber** | Pointer to [**[][]float32**](array.md) | | [optional] + +## Methods + +### NewArrayOfArrayOfNumberOnly + +`func NewArrayOfArrayOfNumberOnly() *ArrayOfArrayOfNumberOnly` + +NewArrayOfArrayOfNumberOnly instantiates a new ArrayOfArrayOfNumberOnly 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 + +### NewArrayOfArrayOfNumberOnlyWithDefaults + +`func NewArrayOfArrayOfNumberOnlyWithDefaults() *ArrayOfArrayOfNumberOnly` + +NewArrayOfArrayOfNumberOnlyWithDefaults instantiates a new ArrayOfArrayOfNumberOnly 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 + +### GetArrayArrayNumber + +`func (o *ArrayOfArrayOfNumberOnly) GetArrayArrayNumber() [][]float32` + +GetArrayArrayNumber returns the ArrayArrayNumber field if non-nil, zero value otherwise. + +### GetArrayArrayNumberOk + +`func (o *ArrayOfArrayOfNumberOnly) GetArrayArrayNumberOk() (*[][]float32, bool)` + +GetArrayArrayNumberOk returns a tuple with the ArrayArrayNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayArrayNumber + +`func (o *ArrayOfArrayOfNumberOnly) SetArrayArrayNumber(v [][]float32)` + +SetArrayArrayNumber sets ArrayArrayNumber field to given value. + +### HasArrayArrayNumber + +`func (o *ArrayOfArrayOfNumberOnly) HasArrayArrayNumber() bool` + +HasArrayArrayNumber 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) + + diff --git a/samples/client/petstore/go/go-petstore/ArrayOfNumberOnly.md b/samples/client/petstore/go/go-petstore/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..f0aaaa443b3 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/ArrayOfNumberOnly.md @@ -0,0 +1,56 @@ +# ArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayNumber** | Pointer to **[]float32** | | [optional] + +## Methods + +### NewArrayOfNumberOnly + +`func NewArrayOfNumberOnly() *ArrayOfNumberOnly` + +NewArrayOfNumberOnly instantiates a new ArrayOfNumberOnly 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 + +### NewArrayOfNumberOnlyWithDefaults + +`func NewArrayOfNumberOnlyWithDefaults() *ArrayOfNumberOnly` + +NewArrayOfNumberOnlyWithDefaults instantiates a new ArrayOfNumberOnly 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 + +### GetArrayNumber + +`func (o *ArrayOfNumberOnly) GetArrayNumber() []float32` + +GetArrayNumber returns the ArrayNumber field if non-nil, zero value otherwise. + +### GetArrayNumberOk + +`func (o *ArrayOfNumberOnly) GetArrayNumberOk() (*[]float32, bool)` + +GetArrayNumberOk returns a tuple with the ArrayNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayNumber + +`func (o *ArrayOfNumberOnly) SetArrayNumber(v []float32)` + +SetArrayNumber sets ArrayNumber field to given value. + +### HasArrayNumber + +`func (o *ArrayOfNumberOnly) HasArrayNumber() bool` + +HasArrayNumber 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) + + diff --git a/samples/client/petstore/go/go-petstore/ArrayTest.md b/samples/client/petstore/go/go-petstore/ArrayTest.md new file mode 100644 index 00000000000..a0f8d7528c3 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/ArrayTest.md @@ -0,0 +1,108 @@ +# ArrayTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayOfString** | Pointer to **[]string** | | [optional] +**ArrayArrayOfInteger** | Pointer to [**[][]int64**](array.md) | | [optional] +**ArrayArrayOfModel** | Pointer to [**[][]ReadOnlyFirst**](array.md) | | [optional] + +## Methods + +### NewArrayTest + +`func NewArrayTest() *ArrayTest` + +NewArrayTest instantiates a new ArrayTest 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 + +### NewArrayTestWithDefaults + +`func NewArrayTestWithDefaults() *ArrayTest` + +NewArrayTestWithDefaults instantiates a new ArrayTest 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 + +### GetArrayOfString + +`func (o *ArrayTest) GetArrayOfString() []string` + +GetArrayOfString returns the ArrayOfString field if non-nil, zero value otherwise. + +### GetArrayOfStringOk + +`func (o *ArrayTest) GetArrayOfStringOk() (*[]string, bool)` + +GetArrayOfStringOk returns a tuple with the ArrayOfString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayOfString + +`func (o *ArrayTest) SetArrayOfString(v []string)` + +SetArrayOfString sets ArrayOfString field to given value. + +### HasArrayOfString + +`func (o *ArrayTest) HasArrayOfString() bool` + +HasArrayOfString returns a boolean if a field has been set. + +### GetArrayArrayOfInteger + +`func (o *ArrayTest) GetArrayArrayOfInteger() [][]int64` + +GetArrayArrayOfInteger returns the ArrayArrayOfInteger field if non-nil, zero value otherwise. + +### GetArrayArrayOfIntegerOk + +`func (o *ArrayTest) GetArrayArrayOfIntegerOk() (*[][]int64, bool)` + +GetArrayArrayOfIntegerOk returns a tuple with the ArrayArrayOfInteger field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayArrayOfInteger + +`func (o *ArrayTest) SetArrayArrayOfInteger(v [][]int64)` + +SetArrayArrayOfInteger sets ArrayArrayOfInteger field to given value. + +### HasArrayArrayOfInteger + +`func (o *ArrayTest) HasArrayArrayOfInteger() bool` + +HasArrayArrayOfInteger returns a boolean if a field has been set. + +### GetArrayArrayOfModel + +`func (o *ArrayTest) GetArrayArrayOfModel() [][]ReadOnlyFirst` + +GetArrayArrayOfModel returns the ArrayArrayOfModel field if non-nil, zero value otherwise. + +### GetArrayArrayOfModelOk + +`func (o *ArrayTest) GetArrayArrayOfModelOk() (*[][]ReadOnlyFirst, bool)` + +GetArrayArrayOfModelOk returns a tuple with the ArrayArrayOfModel field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayArrayOfModel + +`func (o *ArrayTest) SetArrayArrayOfModel(v [][]ReadOnlyFirst)` + +SetArrayArrayOfModel sets ArrayArrayOfModel field to given value. + +### HasArrayArrayOfModel + +`func (o *ArrayTest) HasArrayArrayOfModel() bool` + +HasArrayArrayOfModel 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) + + diff --git a/samples/client/petstore/go/go-petstore/BigCat.md b/samples/client/petstore/go/go-petstore/BigCat.md new file mode 100644 index 00000000000..fb9db929939 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/BigCat.md @@ -0,0 +1,56 @@ +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Kind** | Pointer to **string** | | [optional] + +## Methods + +### NewBigCat + +`func NewBigCat() *BigCat` + +NewBigCat instantiates a new BigCat 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 + +### NewBigCatWithDefaults + +`func NewBigCatWithDefaults() *BigCat` + +NewBigCatWithDefaults instantiates a new BigCat 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 + +### GetKind + +`func (o *BigCat) GetKind() string` + +GetKind returns the Kind field if non-nil, zero value otherwise. + +### GetKindOk + +`func (o *BigCat) GetKindOk() (*string, bool)` + +GetKindOk returns a tuple with the Kind field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKind + +`func (o *BigCat) SetKind(v string)` + +SetKind sets Kind field to given value. + +### HasKind + +`func (o *BigCat) HasKind() bool` + +HasKind 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) + + diff --git a/samples/client/petstore/go/go-petstore/BigCatAllOf.md b/samples/client/petstore/go/go-petstore/BigCatAllOf.md new file mode 100644 index 00000000000..b237a6b2144 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/BigCatAllOf.md @@ -0,0 +1,56 @@ +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Kind** | Pointer to **string** | | [optional] + +## Methods + +### NewBigCatAllOf + +`func NewBigCatAllOf() *BigCatAllOf` + +NewBigCatAllOf instantiates a new BigCatAllOf 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 + +### NewBigCatAllOfWithDefaults + +`func NewBigCatAllOfWithDefaults() *BigCatAllOf` + +NewBigCatAllOfWithDefaults instantiates a new BigCatAllOf 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 + +### GetKind + +`func (o *BigCatAllOf) GetKind() string` + +GetKind returns the Kind field if non-nil, zero value otherwise. + +### GetKindOk + +`func (o *BigCatAllOf) GetKindOk() (*string, bool)` + +GetKindOk returns a tuple with the Kind field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKind + +`func (o *BigCatAllOf) SetKind(v string)` + +SetKind sets Kind field to given value. + +### HasKind + +`func (o *BigCatAllOf) HasKind() bool` + +HasKind 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) + + diff --git a/samples/client/petstore/go/go-petstore/Capitalization.md b/samples/client/petstore/go/go-petstore/Capitalization.md new file mode 100644 index 00000000000..3f37bb13e00 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/Capitalization.md @@ -0,0 +1,186 @@ +# Capitalization + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SmallCamel** | Pointer to **string** | | [optional] +**CapitalCamel** | Pointer to **string** | | [optional] +**SmallSnake** | Pointer to **string** | | [optional] +**CapitalSnake** | Pointer to **string** | | [optional] +**SCAETHFlowPoints** | Pointer to **string** | | [optional] +**ATT_NAME** | Pointer to **string** | Name of the pet | [optional] + +## Methods + +### NewCapitalization + +`func NewCapitalization() *Capitalization` + +NewCapitalization instantiates a new Capitalization 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 + +### NewCapitalizationWithDefaults + +`func NewCapitalizationWithDefaults() *Capitalization` + +NewCapitalizationWithDefaults instantiates a new Capitalization 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 + +### GetSmallCamel + +`func (o *Capitalization) GetSmallCamel() string` + +GetSmallCamel returns the SmallCamel field if non-nil, zero value otherwise. + +### GetSmallCamelOk + +`func (o *Capitalization) GetSmallCamelOk() (*string, bool)` + +GetSmallCamelOk returns a tuple with the SmallCamel field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSmallCamel + +`func (o *Capitalization) SetSmallCamel(v string)` + +SetSmallCamel sets SmallCamel field to given value. + +### HasSmallCamel + +`func (o *Capitalization) HasSmallCamel() bool` + +HasSmallCamel returns a boolean if a field has been set. + +### GetCapitalCamel + +`func (o *Capitalization) GetCapitalCamel() string` + +GetCapitalCamel returns the CapitalCamel field if non-nil, zero value otherwise. + +### GetCapitalCamelOk + +`func (o *Capitalization) GetCapitalCamelOk() (*string, bool)` + +GetCapitalCamelOk returns a tuple with the CapitalCamel field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCapitalCamel + +`func (o *Capitalization) SetCapitalCamel(v string)` + +SetCapitalCamel sets CapitalCamel field to given value. + +### HasCapitalCamel + +`func (o *Capitalization) HasCapitalCamel() bool` + +HasCapitalCamel returns a boolean if a field has been set. + +### GetSmallSnake + +`func (o *Capitalization) GetSmallSnake() string` + +GetSmallSnake returns the SmallSnake field if non-nil, zero value otherwise. + +### GetSmallSnakeOk + +`func (o *Capitalization) GetSmallSnakeOk() (*string, bool)` + +GetSmallSnakeOk returns a tuple with the SmallSnake field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSmallSnake + +`func (o *Capitalization) SetSmallSnake(v string)` + +SetSmallSnake sets SmallSnake field to given value. + +### HasSmallSnake + +`func (o *Capitalization) HasSmallSnake() bool` + +HasSmallSnake returns a boolean if a field has been set. + +### GetCapitalSnake + +`func (o *Capitalization) GetCapitalSnake() string` + +GetCapitalSnake returns the CapitalSnake field if non-nil, zero value otherwise. + +### GetCapitalSnakeOk + +`func (o *Capitalization) GetCapitalSnakeOk() (*string, bool)` + +GetCapitalSnakeOk returns a tuple with the CapitalSnake field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCapitalSnake + +`func (o *Capitalization) SetCapitalSnake(v string)` + +SetCapitalSnake sets CapitalSnake field to given value. + +### HasCapitalSnake + +`func (o *Capitalization) HasCapitalSnake() bool` + +HasCapitalSnake returns a boolean if a field has been set. + +### GetSCAETHFlowPoints + +`func (o *Capitalization) GetSCAETHFlowPoints() string` + +GetSCAETHFlowPoints returns the SCAETHFlowPoints field if non-nil, zero value otherwise. + +### GetSCAETHFlowPointsOk + +`func (o *Capitalization) GetSCAETHFlowPointsOk() (*string, bool)` + +GetSCAETHFlowPointsOk returns a tuple with the SCAETHFlowPoints field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSCAETHFlowPoints + +`func (o *Capitalization) SetSCAETHFlowPoints(v string)` + +SetSCAETHFlowPoints sets SCAETHFlowPoints field to given value. + +### HasSCAETHFlowPoints + +`func (o *Capitalization) HasSCAETHFlowPoints() bool` + +HasSCAETHFlowPoints returns a boolean if a field has been set. + +### GetATT_NAME + +`func (o *Capitalization) GetATT_NAME() string` + +GetATT_NAME returns the ATT_NAME field if non-nil, zero value otherwise. + +### GetATT_NAMEOk + +`func (o *Capitalization) GetATT_NAMEOk() (*string, bool)` + +GetATT_NAMEOk returns a tuple with the ATT_NAME field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetATT_NAME + +`func (o *Capitalization) SetATT_NAME(v string)` + +SetATT_NAME sets ATT_NAME field to given value. + +### HasATT_NAME + +`func (o *Capitalization) HasATT_NAME() bool` + +HasATT_NAME 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) + + diff --git a/samples/client/petstore/go/go-petstore/Cat.md b/samples/client/petstore/go/go-petstore/Cat.md new file mode 100644 index 00000000000..9f7f4f783cb --- /dev/null +++ b/samples/client/petstore/go/go-petstore/Cat.md @@ -0,0 +1,56 @@ +# Cat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Declawed** | Pointer to **bool** | | [optional] + +## Methods + +### NewCat + +`func NewCat() *Cat` + +NewCat instantiates a new Cat 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 + +### NewCatWithDefaults + +`func NewCatWithDefaults() *Cat` + +NewCatWithDefaults instantiates a new Cat 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 + +### GetDeclawed + +`func (o *Cat) GetDeclawed() bool` + +GetDeclawed returns the Declawed field if non-nil, zero value otherwise. + +### GetDeclawedOk + +`func (o *Cat) GetDeclawedOk() (*bool, bool)` + +GetDeclawedOk returns a tuple with the Declawed field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDeclawed + +`func (o *Cat) SetDeclawed(v bool)` + +SetDeclawed sets Declawed field to given value. + +### HasDeclawed + +`func (o *Cat) HasDeclawed() bool` + +HasDeclawed 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) + + diff --git a/samples/client/petstore/go/go-petstore/CatAllOf.md b/samples/client/petstore/go/go-petstore/CatAllOf.md new file mode 100644 index 00000000000..be0cc6c8519 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/CatAllOf.md @@ -0,0 +1,56 @@ +# CatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Declawed** | Pointer to **bool** | | [optional] + +## Methods + +### NewCatAllOf + +`func NewCatAllOf() *CatAllOf` + +NewCatAllOf instantiates a new CatAllOf 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 + +### NewCatAllOfWithDefaults + +`func NewCatAllOfWithDefaults() *CatAllOf` + +NewCatAllOfWithDefaults instantiates a new CatAllOf 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 + +### GetDeclawed + +`func (o *CatAllOf) GetDeclawed() bool` + +GetDeclawed returns the Declawed field if non-nil, zero value otherwise. + +### GetDeclawedOk + +`func (o *CatAllOf) GetDeclawedOk() (*bool, bool)` + +GetDeclawedOk returns a tuple with the Declawed field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDeclawed + +`func (o *CatAllOf) SetDeclawed(v bool)` + +SetDeclawed sets Declawed field to given value. + +### HasDeclawed + +`func (o *CatAllOf) HasDeclawed() bool` + +HasDeclawed 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) + + diff --git a/samples/client/petstore/go/go-petstore/Category.md b/samples/client/petstore/go/go-petstore/Category.md new file mode 100644 index 00000000000..0d3f6d4ff22 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/Category.md @@ -0,0 +1,77 @@ +# Category + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int64** | | [optional] +**Name** | **string** | | [default to "default-name"] + +## Methods + +### NewCategory + +`func NewCategory(name string, ) *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. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/ClassModel.md b/samples/client/petstore/go/go-petstore/ClassModel.md new file mode 100644 index 00000000000..51954107bc0 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/ClassModel.md @@ -0,0 +1,56 @@ +# ClassModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Class** | Pointer to **string** | | [optional] + +## Methods + +### NewClassModel + +`func NewClassModel() *ClassModel` + +NewClassModel instantiates a new ClassModel 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 + +### NewClassModelWithDefaults + +`func NewClassModelWithDefaults() *ClassModel` + +NewClassModelWithDefaults instantiates a new ClassModel 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 + +### GetClass + +`func (o *ClassModel) GetClass() string` + +GetClass returns the Class field if non-nil, zero value otherwise. + +### GetClassOk + +`func (o *ClassModel) GetClassOk() (*string, bool)` + +GetClassOk returns a tuple with the Class field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetClass + +`func (o *ClassModel) SetClass(v string)` + +SetClass sets Class field to given value. + +### HasClass + +`func (o *ClassModel) HasClass() bool` + +HasClass 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) + + diff --git a/samples/client/petstore/go/go-petstore/Client.md b/samples/client/petstore/go/go-petstore/Client.md new file mode 100644 index 00000000000..e24e7c05be5 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/Client.md @@ -0,0 +1,56 @@ +# Client + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Client** | Pointer to **string** | | [optional] + +## Methods + +### NewClient + +`func NewClient() *Client` + +NewClient instantiates a new Client 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 + +### NewClientWithDefaults + +`func NewClientWithDefaults() *Client` + +NewClientWithDefaults instantiates a new Client 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 + +### GetClient + +`func (o *Client) GetClient() string` + +GetClient returns the Client field if non-nil, zero value otherwise. + +### GetClientOk + +`func (o *Client) GetClientOk() (*string, bool)` + +GetClientOk returns a tuple with the Client field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetClient + +`func (o *Client) SetClient(v string)` + +SetClient sets Client field to given value. + +### HasClient + +`func (o *Client) HasClient() bool` + +HasClient 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) + + diff --git a/samples/client/petstore/go/go-petstore/Dog.md b/samples/client/petstore/go/go-petstore/Dog.md new file mode 100644 index 00000000000..edf746aaf55 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/Dog.md @@ -0,0 +1,56 @@ +# Dog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Breed** | Pointer to **string** | | [optional] + +## Methods + +### NewDog + +`func NewDog() *Dog` + +NewDog instantiates a new Dog 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 + +### NewDogWithDefaults + +`func NewDogWithDefaults() *Dog` + +NewDogWithDefaults instantiates a new Dog 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 + +### GetBreed + +`func (o *Dog) GetBreed() string` + +GetBreed returns the Breed field if non-nil, zero value otherwise. + +### GetBreedOk + +`func (o *Dog) GetBreedOk() (*string, bool)` + +GetBreedOk returns a tuple with the Breed field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBreed + +`func (o *Dog) SetBreed(v string)` + +SetBreed sets Breed field to given value. + +### HasBreed + +`func (o *Dog) HasBreed() bool` + +HasBreed 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) + + diff --git a/samples/client/petstore/go/go-petstore/DogAllOf.md b/samples/client/petstore/go/go-petstore/DogAllOf.md new file mode 100644 index 00000000000..3ed4dfa5ea2 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/DogAllOf.md @@ -0,0 +1,56 @@ +# DogAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Breed** | Pointer to **string** | | [optional] + +## Methods + +### NewDogAllOf + +`func NewDogAllOf() *DogAllOf` + +NewDogAllOf instantiates a new DogAllOf 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 + +### NewDogAllOfWithDefaults + +`func NewDogAllOfWithDefaults() *DogAllOf` + +NewDogAllOfWithDefaults instantiates a new DogAllOf 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 + +### GetBreed + +`func (o *DogAllOf) GetBreed() string` + +GetBreed returns the Breed field if non-nil, zero value otherwise. + +### GetBreedOk + +`func (o *DogAllOf) GetBreedOk() (*string, bool)` + +GetBreedOk returns a tuple with the Breed field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBreed + +`func (o *DogAllOf) SetBreed(v string)` + +SetBreed sets Breed field to given value. + +### HasBreed + +`func (o *DogAllOf) HasBreed() bool` + +HasBreed 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) + + diff --git a/samples/client/petstore/go/go-petstore/EnumArrays.md b/samples/client/petstore/go/go-petstore/EnumArrays.md new file mode 100644 index 00000000000..28011e23f56 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/EnumArrays.md @@ -0,0 +1,82 @@ +# EnumArrays + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustSymbol** | Pointer to **string** | | [optional] +**ArrayEnum** | Pointer to **[]string** | | [optional] + +## Methods + +### NewEnumArrays + +`func NewEnumArrays() *EnumArrays` + +NewEnumArrays instantiates a new EnumArrays 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 + +### NewEnumArraysWithDefaults + +`func NewEnumArraysWithDefaults() *EnumArrays` + +NewEnumArraysWithDefaults instantiates a new EnumArrays 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 + +### GetJustSymbol + +`func (o *EnumArrays) GetJustSymbol() string` + +GetJustSymbol returns the JustSymbol field if non-nil, zero value otherwise. + +### GetJustSymbolOk + +`func (o *EnumArrays) GetJustSymbolOk() (*string, bool)` + +GetJustSymbolOk returns a tuple with the JustSymbol field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetJustSymbol + +`func (o *EnumArrays) SetJustSymbol(v string)` + +SetJustSymbol sets JustSymbol field to given value. + +### HasJustSymbol + +`func (o *EnumArrays) HasJustSymbol() bool` + +HasJustSymbol returns a boolean if a field has been set. + +### GetArrayEnum + +`func (o *EnumArrays) GetArrayEnum() []string` + +GetArrayEnum returns the ArrayEnum field if non-nil, zero value otherwise. + +### GetArrayEnumOk + +`func (o *EnumArrays) GetArrayEnumOk() (*[]string, bool)` + +GetArrayEnumOk returns a tuple with the ArrayEnum field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayEnum + +`func (o *EnumArrays) SetArrayEnum(v []string)` + +SetArrayEnum sets ArrayEnum field to given value. + +### HasArrayEnum + +`func (o *EnumArrays) HasArrayEnum() bool` + +HasArrayEnum 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) + + diff --git a/samples/client/petstore/go/go-petstore/EnumClass.md b/samples/client/petstore/go/go-petstore/EnumClass.md new file mode 100644 index 00000000000..e231f94bd73 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/EnumClass.md @@ -0,0 +1,11 @@ +# EnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/EnumTest.md b/samples/client/petstore/go/go-petstore/EnumTest.md new file mode 100644 index 00000000000..131b8e110a0 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/EnumTest.md @@ -0,0 +1,155 @@ +# EnumTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumString** | Pointer to **string** | | [optional] +**EnumStringRequired** | **string** | | +**EnumInteger** | Pointer to **int32** | | [optional] +**EnumNumber** | Pointer to **float64** | | [optional] +**OuterEnum** | Pointer to [**OuterEnum**](OuterEnum.md) | | [optional] + +## Methods + +### NewEnumTest + +`func NewEnumTest(enumStringRequired string, ) *EnumTest` + +NewEnumTest instantiates a new EnumTest 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 + +### NewEnumTestWithDefaults + +`func NewEnumTestWithDefaults() *EnumTest` + +NewEnumTestWithDefaults instantiates a new EnumTest 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 + +### GetEnumString + +`func (o *EnumTest) GetEnumString() string` + +GetEnumString returns the EnumString field if non-nil, zero value otherwise. + +### GetEnumStringOk + +`func (o *EnumTest) GetEnumStringOk() (*string, bool)` + +GetEnumStringOk returns a tuple with the EnumString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnumString + +`func (o *EnumTest) SetEnumString(v string)` + +SetEnumString sets EnumString field to given value. + +### HasEnumString + +`func (o *EnumTest) HasEnumString() bool` + +HasEnumString returns a boolean if a field has been set. + +### GetEnumStringRequired + +`func (o *EnumTest) GetEnumStringRequired() string` + +GetEnumStringRequired returns the EnumStringRequired field if non-nil, zero value otherwise. + +### GetEnumStringRequiredOk + +`func (o *EnumTest) GetEnumStringRequiredOk() (*string, bool)` + +GetEnumStringRequiredOk returns a tuple with the EnumStringRequired field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnumStringRequired + +`func (o *EnumTest) SetEnumStringRequired(v string)` + +SetEnumStringRequired sets EnumStringRequired field to given value. + + +### GetEnumInteger + +`func (o *EnumTest) GetEnumInteger() int32` + +GetEnumInteger returns the EnumInteger field if non-nil, zero value otherwise. + +### GetEnumIntegerOk + +`func (o *EnumTest) GetEnumIntegerOk() (*int32, bool)` + +GetEnumIntegerOk returns a tuple with the EnumInteger field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnumInteger + +`func (o *EnumTest) SetEnumInteger(v int32)` + +SetEnumInteger sets EnumInteger field to given value. + +### HasEnumInteger + +`func (o *EnumTest) HasEnumInteger() bool` + +HasEnumInteger returns a boolean if a field has been set. + +### GetEnumNumber + +`func (o *EnumTest) GetEnumNumber() float64` + +GetEnumNumber returns the EnumNumber field if non-nil, zero value otherwise. + +### GetEnumNumberOk + +`func (o *EnumTest) GetEnumNumberOk() (*float64, bool)` + +GetEnumNumberOk returns a tuple with the EnumNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnumNumber + +`func (o *EnumTest) SetEnumNumber(v float64)` + +SetEnumNumber sets EnumNumber field to given value. + +### HasEnumNumber + +`func (o *EnumTest) HasEnumNumber() bool` + +HasEnumNumber returns a boolean if a field has been set. + +### GetOuterEnum + +`func (o *EnumTest) GetOuterEnum() OuterEnum` + +GetOuterEnum returns the OuterEnum field if non-nil, zero value otherwise. + +### GetOuterEnumOk + +`func (o *EnumTest) GetOuterEnumOk() (*OuterEnum, bool)` + +GetOuterEnumOk returns a tuple with the OuterEnum field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOuterEnum + +`func (o *EnumTest) SetOuterEnum(v OuterEnum)` + +SetOuterEnum sets OuterEnum field to given value. + +### HasOuterEnum + +`func (o *EnumTest) HasOuterEnum() bool` + +HasOuterEnum 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) + + diff --git a/samples/client/petstore/go/go-petstore/FakeApi.md b/samples/client/petstore/go/go-petstore/FakeApi.md new file mode 100644 index 00000000000..93be8280eb6 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/FakeApi.md @@ -0,0 +1,984 @@ +# \FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateXmlItem**](FakeApi.md#CreateXmlItem) | **Post** /fake/create_xml_item | creates an XmlItem +[**FakeOuterBooleanSerialize**](FakeApi.md#FakeOuterBooleanSerialize) | **Post** /fake/outer/boolean | +[**FakeOuterCompositeSerialize**](FakeApi.md#FakeOuterCompositeSerialize) | **Post** /fake/outer/composite | +[**FakeOuterNumberSerialize**](FakeApi.md#FakeOuterNumberSerialize) | **Post** /fake/outer/number | +[**FakeOuterStringSerialize**](FakeApi.md#FakeOuterStringSerialize) | **Post** /fake/outer/string | +[**TestBodyWithFileSchema**](FakeApi.md#TestBodyWithFileSchema) | **Put** /fake/body-with-file-schema | +[**TestBodyWithQueryParams**](FakeApi.md#TestBodyWithQueryParams) | **Put** /fake/body-with-query-params | +[**TestClientModel**](FakeApi.md#TestClientModel) | **Patch** /fake | To test \"client\" model +[**TestEndpointParameters**](FakeApi.md#TestEndpointParameters) | **Post** /fake | Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ +[**TestEnumParameters**](FakeApi.md#TestEnumParameters) | **Get** /fake | To test enum parameters +[**TestGroupParameters**](FakeApi.md#TestGroupParameters) | **Delete** /fake | Fake endpoint to test group parameters (optional) +[**TestInlineAdditionalProperties**](FakeApi.md#TestInlineAdditionalProperties) | **Post** /fake/inline-additionalProperties | test inline additionalProperties +[**TestJsonFormData**](FakeApi.md#TestJsonFormData) | **Get** /fake/jsonFormData | test json serialization of form data +[**TestQueryParameterCollectionFormat**](FakeApi.md#TestQueryParameterCollectionFormat) | **Put** /fake/test-query-paramters | + + + +## CreateXmlItem + +> CreateXmlItem(ctx).XmlItem(xmlItem).Execute() + +creates an XmlItem + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + xmlItem := openapiclient.XmlItem{AttributeString: "AttributeString_example", AttributeNumber: 123, AttributeInteger: 123, AttributeBoolean: true, WrappedArray: []int32{123), NameString: "NameString_example", NameNumber: 123, NameInteger: 123, NameBoolean: true, NameArray: []int32{123), NameWrappedArray: []int32{123), PrefixString: "PrefixString_example", PrefixNumber: 123, PrefixInteger: 123, PrefixBoolean: true, PrefixArray: []int32{123), PrefixWrappedArray: []int32{123), NamespaceString: "NamespaceString_example", NamespaceNumber: 123, NamespaceInteger: 123, NamespaceBoolean: true, NamespaceArray: []int32{123), NamespaceWrappedArray: []int32{123), PrefixNsString: "PrefixNsString_example", PrefixNsNumber: 123, PrefixNsInteger: 123, PrefixNsBoolean: true, PrefixNsArray: []int32{123), PrefixNsWrappedArray: []int32{123)} // XmlItem | XmlItem Body + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.CreateXmlItem(context.Background(), xmlItem).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.CreateXmlItem``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateXmlItemRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xmlItem** | [**XmlItem**](XmlItem.md) | XmlItem Body | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 +- **Accept**: Not defined + +[[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) + + +## FakeOuterBooleanSerialize + +> bool FakeOuterBooleanSerialize(ctx).Body(body).Execute() + + + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := true // bool | Input boolean as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterBooleanSerialize(context.Background(), ).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterBooleanSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterBooleanSerialize`: bool + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterBooleanSerialize`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFakeOuterBooleanSerializeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **bool** | Input boolean as post body | + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +[[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) + + +## FakeOuterCompositeSerialize + +> OuterComposite FakeOuterCompositeSerialize(ctx).Body(body).Execute() + + + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.OuterComposite{MyNumber: 123, MyString: "MyString_example", MyBoolean: false} // OuterComposite | Input composite as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterCompositeSerialize(context.Background(), ).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterCompositeSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterCompositeSerialize`: OuterComposite + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterCompositeSerialize`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFakeOuterCompositeSerializeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md) | Input composite as post body | + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +[[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) + + +## FakeOuterNumberSerialize + +> float32 FakeOuterNumberSerialize(ctx).Body(body).Execute() + + + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := 987 // float32 | Input number as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterNumberSerialize(context.Background(), ).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterNumberSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterNumberSerialize`: float32 + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterNumberSerialize`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFakeOuterNumberSerializeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **float32** | Input number as post body | + +### Return type + +**float32** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +[[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) + + +## FakeOuterStringSerialize + +> string FakeOuterStringSerialize(ctx).Body(body).Execute() + + + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := "body_example" // string | Input string as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterStringSerialize(context.Background(), ).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterStringSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterStringSerialize`: string + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterStringSerialize`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFakeOuterStringSerializeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **string** | Input string as post body | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +[[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) + + +## TestBodyWithFileSchema + +> TestBodyWithFileSchema(ctx).Body(body).Execute() + + + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.FileSchemaTestClass{File: openapiclient.File{SourceURI: "SourceURI_example"}, Files: []File{openapiclient.File{SourceURI: "SourceURI_example"})} // FileSchemaTestClass | + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestBodyWithFileSchema(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestBodyWithFileSchema``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestBodyWithFileSchemaRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md) | | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[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) + + +## TestBodyWithQueryParams + +> TestBodyWithQueryParams(ctx).Query(query).Body(body).Execute() + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + query := "query_example" // string | + body := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123} // User | + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestBodyWithQueryParams(context.Background(), query, body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestBodyWithQueryParams``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestBodyWithQueryParamsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **string** | | + **body** | [**User**](User.md) | | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[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) + + +## TestClientModel + +> Client TestClientModel(ctx).Body(body).Execute() + +To test \"client\" model + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.Client{Client: "Client_example"} // Client | client model + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestClientModel(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestClientModel``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestClientModel`: Client + fmt.Fprintf(os.Stdout, "Response from `FakeApi.TestClientModel`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestClientModelRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md) | client model | + +### Return type + +[**Client**](Client.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) + + +## TestEndpointParameters + +> TestEndpointParameters(ctx).Number(number).Double(double).PatternWithoutDelimiter(patternWithoutDelimiter).Byte_(byte_).Integer(integer).Int32_(int32_).Int64_(int64_).Float(float).String_(string_).Binary(binary).Date(date).DateTime(dateTime).Password(password).Callback(callback).Execute() + +Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + number := 987 // float32 | None + double := 987 // float64 | None + patternWithoutDelimiter := "patternWithoutDelimiter_example" // string | None + byte_ := 987 // string | None + integer := 987 // int32 | None (optional) + int32_ := 987 // int32 | None (optional) + int64_ := 987 // int64 | None (optional) + float := 987 // float32 | None (optional) + string_ := "string__example" // string | None (optional) + binary := 987 // *os.File | None (optional) + date := Get-Date // string | None (optional) + dateTime := Get-Date // time.Time | None (optional) + password := "password_example" // string | None (optional) + callback := "callback_example" // string | None (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestEndpointParameters(context.Background(), number, double, patternWithoutDelimiter, byte_).Integer(integer).Int32_(int32_).Int64_(int64_).Float(float).String_(string_).Binary(binary).Date(date).DateTime(dateTime).Password(password).Callback(callback).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestEndpointParameters``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestEndpointParametersRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **float32** | None | + **double** | **float64** | None | + **patternWithoutDelimiter** | **string** | None | + **byte_** | **string** | None | + **integer** | **int32** | None | + **int32_** | **int32** | None | + **int64_** | **int64** | None | + **float** | **float32** | None | + **string_** | **string** | None | + **binary** | ***os.File** | None | + **date** | **string** | None | + **dateTime** | **time.Time** | None | + **password** | **string** | None | + **callback** | **string** | None | + +### Return type + + (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +[[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) + + +## TestEnumParameters + +> TestEnumParameters(ctx).EnumHeaderStringArray(enumHeaderStringArray).EnumHeaderString(enumHeaderString).EnumQueryStringArray(enumQueryStringArray).EnumQueryString(enumQueryString).EnumQueryInteger(enumQueryInteger).EnumQueryDouble(enumQueryDouble).EnumFormStringArray(enumFormStringArray).EnumFormString(enumFormString).Execute() + +To test enum parameters + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + enumHeaderStringArray := []string{"EnumHeaderStringArray_example"} // []string | Header parameter enum test (string array) (optional) + enumHeaderString := "enumHeaderString_example" // string | Header parameter enum test (string) (optional) (default to "-efg") + enumQueryStringArray := []string{"EnumQueryStringArray_example"} // []string | Query parameter enum test (string array) (optional) + enumQueryString := "enumQueryString_example" // string | Query parameter enum test (string) (optional) (default to "-efg") + enumQueryInteger := 987 // int32 | Query parameter enum test (double) (optional) + enumQueryDouble := 987 // float64 | Query parameter enum test (double) (optional) + enumFormStringArray := []string{"Inner_example"} // []string | Form parameter enum test (string array) (optional) (default to "$") + enumFormString := "enumFormString_example" // string | Form parameter enum test (string) (optional) (default to "-efg") + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestEnumParameters(context.Background(), ).EnumHeaderStringArray(enumHeaderStringArray).EnumHeaderString(enumHeaderString).EnumQueryStringArray(enumQueryStringArray).EnumQueryString(enumQueryString).EnumQueryInteger(enumQueryInteger).EnumQueryDouble(enumQueryDouble).EnumFormStringArray(enumFormStringArray).EnumFormString(enumFormString).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestEnumParameters``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestEnumParametersRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**[]string**](string.md) | Header parameter enum test (string array) | + **enumHeaderString** | **string** | Header parameter enum test (string) | [default to "-efg"] + **enumQueryStringArray** | [**[]string**](string.md) | Query parameter enum test (string array) | + **enumQueryString** | **string** | Query parameter enum test (string) | [default to "-efg"] + **enumQueryInteger** | **int32** | Query parameter enum test (double) | + **enumQueryDouble** | **float64** | Query parameter enum test (double) | + **enumFormStringArray** | [**[]string**](string.md) | Form parameter enum test (string array) | [default to "$"] + **enumFormString** | **string** | Form parameter enum test (string) | [default to "-efg"] + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +[[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) + + +## TestGroupParameters + +> TestGroupParameters(ctx).RequiredStringGroup(requiredStringGroup).RequiredBooleanGroup(requiredBooleanGroup).RequiredInt64Group(requiredInt64Group).StringGroup(stringGroup).BooleanGroup(booleanGroup).Int64Group(int64Group).Execute() + +Fake endpoint to test group parameters (optional) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + requiredStringGroup := 987 // int32 | Required String in group parameters + requiredBooleanGroup := true // bool | Required Boolean in group parameters + requiredInt64Group := 987 // int64 | Required Integer in group parameters + stringGroup := 987 // int32 | String in group parameters (optional) + booleanGroup := true // bool | Boolean in group parameters (optional) + int64Group := 987 // int64 | Integer in group parameters (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestGroupParameters(context.Background(), requiredStringGroup, requiredBooleanGroup, requiredInt64Group).StringGroup(stringGroup).BooleanGroup(booleanGroup).Int64Group(int64Group).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestGroupParameters``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestGroupParametersRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | **int32** | Required String in group parameters | + **requiredBooleanGroup** | **bool** | Required Boolean in group parameters | + **requiredInt64Group** | **int64** | Required Integer in group parameters | + **stringGroup** | **int32** | String in group parameters | + **booleanGroup** | **bool** | Boolean in group parameters | + **int64Group** | **int64** | Integer in group parameters | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## TestInlineAdditionalProperties + +> TestInlineAdditionalProperties(ctx).Param(param).Execute() + +test inline additionalProperties + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + param := map[string]string{ "Key" = "Value" } // map[string]string | request body + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestInlineAdditionalProperties(context.Background(), param).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestInlineAdditionalProperties``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestInlineAdditionalPropertiesRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | [**map[string]string**](string.md) | request body | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[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) + + +## TestJsonFormData + +> TestJsonFormData(ctx).Param(param).Param2(param2).Execute() + +test json serialization of form data + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + param := "param_example" // string | field1 + param2 := "param2_example" // string | field2 + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestJsonFormData(context.Background(), param, param2).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestJsonFormData``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestJsonFormDataRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **string** | field1 | + **param2** | **string** | field2 | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +[[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) + + +## TestQueryParameterCollectionFormat + +> TestQueryParameterCollectionFormat(ctx).Pipe(pipe).Ioutil(ioutil).Http(http).Url(url).Context(context).Execute() + + + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + pipe := []string{"Inner_example"} // []string | + ioutil := []string{"Inner_example"} // []string | + http := []string{"Inner_example"} // []string | + url := []string{"Inner_example"} // []string | + context := []string{"Inner_example"} // []string | + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestQueryParameterCollectionFormat(context.Background(), pipe, ioutil, http, url, context).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestQueryParameterCollectionFormat``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestQueryParameterCollectionFormatRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**[]string**](string.md) | | + **ioutil** | [**[]string**](string.md) | | + **http** | [**[]string**](string.md) | | + **url** | [**[]string**](string.md) | | + **context** | [**[]string**](string.md) | | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/samples/client/petstore/go/go-petstore/FakeClassnameTags123Api.md b/samples/client/petstore/go/go-petstore/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..3f8d0a41de3 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/FakeClassnameTags123Api.md @@ -0,0 +1,75 @@ +# \FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestClassname**](FakeClassnameTags123Api.md#TestClassname) | **Patch** /fake_classname_test | To test class name in snake case + + + +## TestClassname + +> Client TestClassname(ctx).Body(body).Execute() + +To test class name in snake case + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.Client{Client: "Client_example"} // Client | client model + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeClassnameTags123Api.TestClassname(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeClassnameTags123Api.TestClassname``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestClassname`: Client + fmt.Fprintf(os.Stdout, "Response from `FakeClassnameTags123Api.TestClassname`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestClassnameRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md) | client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### 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) + diff --git a/samples/client/petstore/go/go-petstore/File.md b/samples/client/petstore/go/go-petstore/File.md new file mode 100644 index 00000000000..91fe90e06f1 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/File.md @@ -0,0 +1,56 @@ +# File + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SourceURI** | Pointer to **string** | Test capitalization | [optional] + +## Methods + +### NewFile + +`func NewFile() *File` + +NewFile instantiates a new File 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 + +### NewFileWithDefaults + +`func NewFileWithDefaults() *File` + +NewFileWithDefaults instantiates a new File 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 + +### GetSourceURI + +`func (o *File) GetSourceURI() string` + +GetSourceURI returns the SourceURI field if non-nil, zero value otherwise. + +### GetSourceURIOk + +`func (o *File) GetSourceURIOk() (*string, bool)` + +GetSourceURIOk returns a tuple with the SourceURI field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSourceURI + +`func (o *File) SetSourceURI(v string)` + +SetSourceURI sets SourceURI field to given value. + +### HasSourceURI + +`func (o *File) HasSourceURI() bool` + +HasSourceURI 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) + + diff --git a/samples/client/petstore/go/go-petstore/FileSchemaTestClass.md b/samples/client/petstore/go/go-petstore/FileSchemaTestClass.md new file mode 100644 index 00000000000..2db8eb31902 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/FileSchemaTestClass.md @@ -0,0 +1,82 @@ +# FileSchemaTestClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | Pointer to [**File**](File.md) | | [optional] +**Files** | Pointer to [**[]File**](File.md) | | [optional] + +## Methods + +### NewFileSchemaTestClass + +`func NewFileSchemaTestClass() *FileSchemaTestClass` + +NewFileSchemaTestClass instantiates a new FileSchemaTestClass 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 + +### NewFileSchemaTestClassWithDefaults + +`func NewFileSchemaTestClassWithDefaults() *FileSchemaTestClass` + +NewFileSchemaTestClassWithDefaults instantiates a new FileSchemaTestClass 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 + +### GetFile + +`func (o *FileSchemaTestClass) GetFile() File` + +GetFile returns the File field if non-nil, zero value otherwise. + +### GetFileOk + +`func (o *FileSchemaTestClass) GetFileOk() (*File, bool)` + +GetFileOk returns a tuple with the File field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFile + +`func (o *FileSchemaTestClass) SetFile(v File)` + +SetFile sets File field to given value. + +### HasFile + +`func (o *FileSchemaTestClass) HasFile() bool` + +HasFile returns a boolean if a field has been set. + +### GetFiles + +`func (o *FileSchemaTestClass) GetFiles() []File` + +GetFiles returns the Files field if non-nil, zero value otherwise. + +### GetFilesOk + +`func (o *FileSchemaTestClass) GetFilesOk() (*[]File, bool)` + +GetFilesOk returns a tuple with the Files field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFiles + +`func (o *FileSchemaTestClass) SetFiles(v []File)` + +SetFiles sets Files field to given value. + +### HasFiles + +`func (o *FileSchemaTestClass) HasFiles() bool` + +HasFiles 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) + + diff --git a/samples/client/petstore/go/go-petstore/FormatTest.md b/samples/client/petstore/go/go-petstore/FormatTest.md new file mode 100644 index 00000000000..9235479afc1 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/FormatTest.md @@ -0,0 +1,374 @@ +# FormatTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Integer** | Pointer to **int32** | | [optional] +**Int32** | Pointer to **int32** | | [optional] +**Int64** | Pointer to **int64** | | [optional] +**Number** | **float32** | | +**Float** | Pointer to **float32** | | [optional] +**Double** | Pointer to **float64** | | [optional] +**String** | Pointer to **string** | | [optional] +**Byte** | **string** | | +**Binary** | Pointer to [***os.File**](*os.File.md) | | [optional] +**Date** | **string** | | +**DateTime** | Pointer to [**time.Time**](time.Time.md) | | [optional] +**Uuid** | Pointer to **string** | | [optional] +**Password** | **string** | | +**BigDecimal** | Pointer to **float64** | | [optional] + +## Methods + +### NewFormatTest + +`func NewFormatTest(number float32, byte_ string, date string, password string, ) *FormatTest` + +NewFormatTest instantiates a new FormatTest 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 + +### NewFormatTestWithDefaults + +`func NewFormatTestWithDefaults() *FormatTest` + +NewFormatTestWithDefaults instantiates a new FormatTest 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 + +### GetInteger + +`func (o *FormatTest) GetInteger() int32` + +GetInteger returns the Integer field if non-nil, zero value otherwise. + +### GetIntegerOk + +`func (o *FormatTest) GetIntegerOk() (*int32, bool)` + +GetIntegerOk returns a tuple with the Integer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInteger + +`func (o *FormatTest) SetInteger(v int32)` + +SetInteger sets Integer field to given value. + +### HasInteger + +`func (o *FormatTest) HasInteger() bool` + +HasInteger returns a boolean if a field has been set. + +### GetInt32 + +`func (o *FormatTest) GetInt32() int32` + +GetInt32 returns the Int32 field if non-nil, zero value otherwise. + +### GetInt32Ok + +`func (o *FormatTest) GetInt32Ok() (*int32, bool)` + +GetInt32Ok returns a tuple with the Int32 field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInt32 + +`func (o *FormatTest) SetInt32(v int32)` + +SetInt32 sets Int32 field to given value. + +### HasInt32 + +`func (o *FormatTest) HasInt32() bool` + +HasInt32 returns a boolean if a field has been set. + +### GetInt64 + +`func (o *FormatTest) GetInt64() int64` + +GetInt64 returns the Int64 field if non-nil, zero value otherwise. + +### GetInt64Ok + +`func (o *FormatTest) GetInt64Ok() (*int64, bool)` + +GetInt64Ok returns a tuple with the Int64 field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInt64 + +`func (o *FormatTest) SetInt64(v int64)` + +SetInt64 sets Int64 field to given value. + +### HasInt64 + +`func (o *FormatTest) HasInt64() bool` + +HasInt64 returns a boolean if a field has been set. + +### GetNumber + +`func (o *FormatTest) GetNumber() float32` + +GetNumber returns the Number field if non-nil, zero value otherwise. + +### GetNumberOk + +`func (o *FormatTest) 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 *FormatTest) SetNumber(v float32)` + +SetNumber sets Number field to given value. + + +### GetFloat + +`func (o *FormatTest) GetFloat() float32` + +GetFloat returns the Float field if non-nil, zero value otherwise. + +### GetFloatOk + +`func (o *FormatTest) 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 *FormatTest) SetFloat(v float32)` + +SetFloat sets Float field to given value. + +### HasFloat + +`func (o *FormatTest) HasFloat() bool` + +HasFloat returns a boolean if a field has been set. + +### GetDouble + +`func (o *FormatTest) GetDouble() float64` + +GetDouble returns the Double field if non-nil, zero value otherwise. + +### GetDoubleOk + +`func (o *FormatTest) 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 *FormatTest) SetDouble(v float64)` + +SetDouble sets Double field to given value. + +### HasDouble + +`func (o *FormatTest) HasDouble() bool` + +HasDouble returns a boolean if a field has been set. + +### GetString + +`func (o *FormatTest) GetString() string` + +GetString returns the String field if non-nil, zero value otherwise. + +### GetStringOk + +`func (o *FormatTest) GetStringOk() (*string, bool)` + +GetStringOk returns a tuple with the String field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetString + +`func (o *FormatTest) SetString(v string)` + +SetString sets String field to given value. + +### HasString + +`func (o *FormatTest) HasString() bool` + +HasString returns a boolean if a field has been set. + +### GetByte + +`func (o *FormatTest) GetByte() string` + +GetByte returns the Byte field if non-nil, zero value otherwise. + +### GetByteOk + +`func (o *FormatTest) GetByteOk() (*string, bool)` + +GetByteOk returns a tuple with the Byte field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetByte + +`func (o *FormatTest) SetByte(v string)` + +SetByte sets Byte field to given value. + + +### GetBinary + +`func (o *FormatTest) GetBinary() *os.File` + +GetBinary returns the Binary field if non-nil, zero value otherwise. + +### GetBinaryOk + +`func (o *FormatTest) GetBinaryOk() (**os.File, bool)` + +GetBinaryOk returns a tuple with the Binary field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBinary + +`func (o *FormatTest) SetBinary(v *os.File)` + +SetBinary sets Binary field to given value. + +### HasBinary + +`func (o *FormatTest) HasBinary() bool` + +HasBinary returns a boolean if a field has been set. + +### GetDate + +`func (o *FormatTest) GetDate() string` + +GetDate returns the Date field if non-nil, zero value otherwise. + +### GetDateOk + +`func (o *FormatTest) GetDateOk() (*string, 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 *FormatTest) SetDate(v string)` + +SetDate sets Date field to given value. + + +### GetDateTime + +`func (o *FormatTest) GetDateTime() time.Time` + +GetDateTime returns the DateTime field if non-nil, zero value otherwise. + +### GetDateTimeOk + +`func (o *FormatTest) GetDateTimeOk() (*time.Time, bool)` + +GetDateTimeOk returns a tuple with the DateTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDateTime + +`func (o *FormatTest) SetDateTime(v time.Time)` + +SetDateTime sets DateTime field to given value. + +### HasDateTime + +`func (o *FormatTest) HasDateTime() bool` + +HasDateTime returns a boolean if a field has been set. + +### GetUuid + +`func (o *FormatTest) GetUuid() string` + +GetUuid returns the Uuid field if non-nil, zero value otherwise. + +### GetUuidOk + +`func (o *FormatTest) GetUuidOk() (*string, bool)` + +GetUuidOk returns a tuple with the Uuid field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUuid + +`func (o *FormatTest) SetUuid(v string)` + +SetUuid sets Uuid field to given value. + +### HasUuid + +`func (o *FormatTest) HasUuid() bool` + +HasUuid returns a boolean if a field has been set. + +### GetPassword + +`func (o *FormatTest) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *FormatTest) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *FormatTest) SetPassword(v string)` + +SetPassword sets Password field to given value. + + +### GetBigDecimal + +`func (o *FormatTest) GetBigDecimal() float64` + +GetBigDecimal returns the BigDecimal field if non-nil, zero value otherwise. + +### GetBigDecimalOk + +`func (o *FormatTest) GetBigDecimalOk() (*float64, bool)` + +GetBigDecimalOk returns a tuple with the BigDecimal field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBigDecimal + +`func (o *FormatTest) SetBigDecimal(v float64)` + +SetBigDecimal sets BigDecimal field to given value. + +### HasBigDecimal + +`func (o *FormatTest) HasBigDecimal() bool` + +HasBigDecimal 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) + + diff --git a/samples/client/petstore/go/go-petstore/HasOnlyReadOnly.md b/samples/client/petstore/go/go-petstore/HasOnlyReadOnly.md new file mode 100644 index 00000000000..7f54d772840 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/HasOnlyReadOnly.md @@ -0,0 +1,82 @@ +# HasOnlyReadOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | Pointer to **string** | | [optional] [readonly] +**Foo** | Pointer to **string** | | [optional] [readonly] + +## Methods + +### NewHasOnlyReadOnly + +`func NewHasOnlyReadOnly() *HasOnlyReadOnly` + +NewHasOnlyReadOnly instantiates a new HasOnlyReadOnly 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 + +### NewHasOnlyReadOnlyWithDefaults + +`func NewHasOnlyReadOnlyWithDefaults() *HasOnlyReadOnly` + +NewHasOnlyReadOnlyWithDefaults instantiates a new HasOnlyReadOnly 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 + +### GetBar + +`func (o *HasOnlyReadOnly) GetBar() string` + +GetBar returns the Bar field if non-nil, zero value otherwise. + +### GetBarOk + +`func (o *HasOnlyReadOnly) GetBarOk() (*string, bool)` + +GetBarOk returns a tuple with the Bar field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBar + +`func (o *HasOnlyReadOnly) SetBar(v string)` + +SetBar sets Bar field to given value. + +### HasBar + +`func (o *HasOnlyReadOnly) HasBar() bool` + +HasBar returns a boolean if a field has been set. + +### GetFoo + +`func (o *HasOnlyReadOnly) GetFoo() string` + +GetFoo returns the Foo field if non-nil, zero value otherwise. + +### GetFooOk + +`func (o *HasOnlyReadOnly) GetFooOk() (*string, bool)` + +GetFooOk returns a tuple with the Foo field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFoo + +`func (o *HasOnlyReadOnly) SetFoo(v string)` + +SetFoo sets Foo field to given value. + +### HasFoo + +`func (o *HasOnlyReadOnly) HasFoo() bool` + +HasFoo 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) + + diff --git a/samples/client/petstore/go/go-petstore/List.md b/samples/client/petstore/go/go-petstore/List.md new file mode 100644 index 00000000000..271c8236a8b --- /dev/null +++ b/samples/client/petstore/go/go-petstore/List.md @@ -0,0 +1,56 @@ +# List + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Var123List** | Pointer to **string** | | [optional] + +## Methods + +### NewList + +`func NewList() *List` + +NewList instantiates a new List 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 + +### NewListWithDefaults + +`func NewListWithDefaults() *List` + +NewListWithDefaults instantiates a new List 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 + +### GetVar123List + +`func (o *List) GetVar123List() string` + +GetVar123List returns the Var123List field if non-nil, zero value otherwise. + +### GetVar123ListOk + +`func (o *List) GetVar123ListOk() (*string, bool)` + +GetVar123ListOk returns a tuple with the Var123List field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVar123List + +`func (o *List) SetVar123List(v string)` + +SetVar123List sets Var123List field to given value. + +### HasVar123List + +`func (o *List) HasVar123List() bool` + +HasVar123List 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) + + diff --git a/samples/client/petstore/go/go-petstore/MapTest.md b/samples/client/petstore/go/go-petstore/MapTest.md new file mode 100644 index 00000000000..6b35263c4e3 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/MapTest.md @@ -0,0 +1,134 @@ +# MapTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MapMapOfString** | Pointer to [**map[string]map[string]string**](map.md) | | [optional] +**MapOfEnumString** | Pointer to **map[string]string** | | [optional] +**DirectMap** | Pointer to **map[string]bool** | | [optional] +**IndirectMap** | Pointer to **map[string]bool** | | [optional] + +## Methods + +### NewMapTest + +`func NewMapTest() *MapTest` + +NewMapTest instantiates a new MapTest 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 + +### NewMapTestWithDefaults + +`func NewMapTestWithDefaults() *MapTest` + +NewMapTestWithDefaults instantiates a new MapTest 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 + +### GetMapMapOfString + +`func (o *MapTest) GetMapMapOfString() map[string]map[string]string` + +GetMapMapOfString returns the MapMapOfString field if non-nil, zero value otherwise. + +### GetMapMapOfStringOk + +`func (o *MapTest) GetMapMapOfStringOk() (*map[string]map[string]string, bool)` + +GetMapMapOfStringOk returns a tuple with the MapMapOfString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMapMapOfString + +`func (o *MapTest) SetMapMapOfString(v map[string]map[string]string)` + +SetMapMapOfString sets MapMapOfString field to given value. + +### HasMapMapOfString + +`func (o *MapTest) HasMapMapOfString() bool` + +HasMapMapOfString returns a boolean if a field has been set. + +### GetMapOfEnumString + +`func (o *MapTest) GetMapOfEnumString() map[string]string` + +GetMapOfEnumString returns the MapOfEnumString field if non-nil, zero value otherwise. + +### GetMapOfEnumStringOk + +`func (o *MapTest) GetMapOfEnumStringOk() (*map[string]string, bool)` + +GetMapOfEnumStringOk returns a tuple with the MapOfEnumString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMapOfEnumString + +`func (o *MapTest) SetMapOfEnumString(v map[string]string)` + +SetMapOfEnumString sets MapOfEnumString field to given value. + +### HasMapOfEnumString + +`func (o *MapTest) HasMapOfEnumString() bool` + +HasMapOfEnumString returns a boolean if a field has been set. + +### GetDirectMap + +`func (o *MapTest) GetDirectMap() map[string]bool` + +GetDirectMap returns the DirectMap field if non-nil, zero value otherwise. + +### GetDirectMapOk + +`func (o *MapTest) GetDirectMapOk() (*map[string]bool, bool)` + +GetDirectMapOk returns a tuple with the DirectMap field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDirectMap + +`func (o *MapTest) SetDirectMap(v map[string]bool)` + +SetDirectMap sets DirectMap field to given value. + +### HasDirectMap + +`func (o *MapTest) HasDirectMap() bool` + +HasDirectMap returns a boolean if a field has been set. + +### GetIndirectMap + +`func (o *MapTest) GetIndirectMap() map[string]bool` + +GetIndirectMap returns the IndirectMap field if non-nil, zero value otherwise. + +### GetIndirectMapOk + +`func (o *MapTest) GetIndirectMapOk() (*map[string]bool, bool)` + +GetIndirectMapOk returns a tuple with the IndirectMap field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIndirectMap + +`func (o *MapTest) SetIndirectMap(v map[string]bool)` + +SetIndirectMap sets IndirectMap field to given value. + +### HasIndirectMap + +`func (o *MapTest) HasIndirectMap() bool` + +HasIndirectMap 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) + + diff --git a/samples/client/petstore/go/go-petstore/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/go/go-petstore/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..f726ffe63e1 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,108 @@ +# MixedPropertiesAndAdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Uuid** | Pointer to **string** | | [optional] +**DateTime** | Pointer to [**time.Time**](time.Time.md) | | [optional] +**Map** | Pointer to [**map[string]Animal**](Animal.md) | | [optional] + +## Methods + +### NewMixedPropertiesAndAdditionalPropertiesClass + +`func NewMixedPropertiesAndAdditionalPropertiesClass() *MixedPropertiesAndAdditionalPropertiesClass` + +NewMixedPropertiesAndAdditionalPropertiesClass instantiates a new MixedPropertiesAndAdditionalPropertiesClass 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 + +### NewMixedPropertiesAndAdditionalPropertiesClassWithDefaults + +`func NewMixedPropertiesAndAdditionalPropertiesClassWithDefaults() *MixedPropertiesAndAdditionalPropertiesClass` + +NewMixedPropertiesAndAdditionalPropertiesClassWithDefaults instantiates a new MixedPropertiesAndAdditionalPropertiesClass 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 + +### GetUuid + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) GetUuid() string` + +GetUuid returns the Uuid field if non-nil, zero value otherwise. + +### GetUuidOk + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) GetUuidOk() (*string, bool)` + +GetUuidOk returns a tuple with the Uuid field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUuid + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) SetUuid(v string)` + +SetUuid sets Uuid field to given value. + +### HasUuid + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) HasUuid() bool` + +HasUuid returns a boolean if a field has been set. + +### GetDateTime + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) GetDateTime() time.Time` + +GetDateTime returns the DateTime field if non-nil, zero value otherwise. + +### GetDateTimeOk + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) GetDateTimeOk() (*time.Time, bool)` + +GetDateTimeOk returns a tuple with the DateTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDateTime + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) SetDateTime(v time.Time)` + +SetDateTime sets DateTime field to given value. + +### HasDateTime + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) HasDateTime() bool` + +HasDateTime returns a boolean if a field has been set. + +### GetMap + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) GetMap() map[string]Animal` + +GetMap returns the Map field if non-nil, zero value otherwise. + +### GetMapOk + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) GetMapOk() (*map[string]Animal, bool)` + +GetMapOk returns a tuple with the Map field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMap + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) SetMap(v map[string]Animal)` + +SetMap sets Map field to given value. + +### HasMap + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) HasMap() bool` + +HasMap 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) + + diff --git a/samples/client/petstore/go/go-petstore/Name.md b/samples/client/petstore/go/go-petstore/Name.md new file mode 100644 index 00000000000..18cf04789d6 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/Name.md @@ -0,0 +1,129 @@ +# Name + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **int32** | | +**SnakeCase** | Pointer to **int32** | | [optional] [readonly] +**Property** | Pointer to **string** | | [optional] +**Var123Number** | Pointer to **int32** | | [optional] [readonly] + +## Methods + +### NewName + +`func NewName(name int32, ) *Name` + +NewName instantiates a new Name 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 + +### NewNameWithDefaults + +`func NewNameWithDefaults() *Name` + +NewNameWithDefaults instantiates a new Name 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 + +### GetName + +`func (o *Name) GetName() int32` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Name) GetNameOk() (*int32, 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 *Name) SetName(v int32)` + +SetName sets Name field to given value. + + +### GetSnakeCase + +`func (o *Name) GetSnakeCase() int32` + +GetSnakeCase returns the SnakeCase field if non-nil, zero value otherwise. + +### GetSnakeCaseOk + +`func (o *Name) GetSnakeCaseOk() (*int32, bool)` + +GetSnakeCaseOk returns a tuple with the SnakeCase field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSnakeCase + +`func (o *Name) SetSnakeCase(v int32)` + +SetSnakeCase sets SnakeCase field to given value. + +### HasSnakeCase + +`func (o *Name) HasSnakeCase() bool` + +HasSnakeCase returns a boolean if a field has been set. + +### GetProperty + +`func (o *Name) GetProperty() string` + +GetProperty returns the Property field if non-nil, zero value otherwise. + +### GetPropertyOk + +`func (o *Name) GetPropertyOk() (*string, bool)` + +GetPropertyOk returns a tuple with the Property field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProperty + +`func (o *Name) SetProperty(v string)` + +SetProperty sets Property field to given value. + +### HasProperty + +`func (o *Name) HasProperty() bool` + +HasProperty returns a boolean if a field has been set. + +### GetVar123Number + +`func (o *Name) GetVar123Number() int32` + +GetVar123Number returns the Var123Number field if non-nil, zero value otherwise. + +### GetVar123NumberOk + +`func (o *Name) GetVar123NumberOk() (*int32, bool)` + +GetVar123NumberOk returns a tuple with the Var123Number field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVar123Number + +`func (o *Name) SetVar123Number(v int32)` + +SetVar123Number sets Var123Number field to given value. + +### HasVar123Number + +`func (o *Name) HasVar123Number() bool` + +HasVar123Number 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) + + diff --git a/samples/client/petstore/go/go-petstore/NumberOnly.md b/samples/client/petstore/go/go-petstore/NumberOnly.md new file mode 100644 index 00000000000..81941828b62 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/NumberOnly.md @@ -0,0 +1,56 @@ +# NumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustNumber** | Pointer to **float32** | | [optional] + +## Methods + +### NewNumberOnly + +`func NewNumberOnly() *NumberOnly` + +NewNumberOnly instantiates a new NumberOnly 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 + +### NewNumberOnlyWithDefaults + +`func NewNumberOnlyWithDefaults() *NumberOnly` + +NewNumberOnlyWithDefaults instantiates a new NumberOnly 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 + +### GetJustNumber + +`func (o *NumberOnly) GetJustNumber() float32` + +GetJustNumber returns the JustNumber field if non-nil, zero value otherwise. + +### GetJustNumberOk + +`func (o *NumberOnly) GetJustNumberOk() (*float32, bool)` + +GetJustNumberOk returns a tuple with the JustNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetJustNumber + +`func (o *NumberOnly) SetJustNumber(v float32)` + +SetJustNumber sets JustNumber field to given value. + +### HasJustNumber + +`func (o *NumberOnly) HasJustNumber() bool` + +HasJustNumber 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) + + diff --git a/samples/client/petstore/go/go-petstore/Order.md b/samples/client/petstore/go/go-petstore/Order.md new file mode 100644 index 00000000000..78cace2f229 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/Order.md @@ -0,0 +1,186 @@ +# Order + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int64** | | [optional] +**PetId** | Pointer to **int64** | | [optional] +**Quantity** | Pointer to **int32** | | [optional] +**ShipDate** | Pointer to [**time.Time**](time.Time.md) | | [optional] +**Status** | Pointer to **string** | Order Status | [optional] +**Complete** | Pointer to **bool** | | [optional] [default to false] + +## Methods + +### NewOrder + +`func NewOrder() *Order` + +NewOrder instantiates a new Order 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 + +### NewOrderWithDefaults + +`func NewOrderWithDefaults() *Order` + +NewOrderWithDefaults instantiates a new Order 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 *Order) GetId() int64` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Order) 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 *Order) SetId(v int64)` + +SetId sets Id field to given value. + +### HasId + +`func (o *Order) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetPetId + +`func (o *Order) GetPetId() int64` + +GetPetId returns the PetId field if non-nil, zero value otherwise. + +### GetPetIdOk + +`func (o *Order) GetPetIdOk() (*int64, bool)` + +GetPetIdOk returns a tuple with the PetId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPetId + +`func (o *Order) SetPetId(v int64)` + +SetPetId sets PetId field to given value. + +### HasPetId + +`func (o *Order) HasPetId() bool` + +HasPetId returns a boolean if a field has been set. + +### GetQuantity + +`func (o *Order) GetQuantity() int32` + +GetQuantity returns the Quantity field if non-nil, zero value otherwise. + +### GetQuantityOk + +`func (o *Order) GetQuantityOk() (*int32, bool)` + +GetQuantityOk returns a tuple with the Quantity field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetQuantity + +`func (o *Order) SetQuantity(v int32)` + +SetQuantity sets Quantity field to given value. + +### HasQuantity + +`func (o *Order) HasQuantity() bool` + +HasQuantity returns a boolean if a field has been set. + +### GetShipDate + +`func (o *Order) GetShipDate() time.Time` + +GetShipDate returns the ShipDate field if non-nil, zero value otherwise. + +### GetShipDateOk + +`func (o *Order) GetShipDateOk() (*time.Time, bool)` + +GetShipDateOk returns a tuple with the ShipDate field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShipDate + +`func (o *Order) SetShipDate(v time.Time)` + +SetShipDate sets ShipDate field to given value. + +### HasShipDate + +`func (o *Order) HasShipDate() bool` + +HasShipDate returns a boolean if a field has been set. + +### GetStatus + +`func (o *Order) GetStatus() string` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *Order) 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 *Order) SetStatus(v string)` + +SetStatus sets Status field to given value. + +### HasStatus + +`func (o *Order) HasStatus() bool` + +HasStatus returns a boolean if a field has been set. + +### GetComplete + +`func (o *Order) GetComplete() bool` + +GetComplete returns the Complete field if non-nil, zero value otherwise. + +### GetCompleteOk + +`func (o *Order) GetCompleteOk() (*bool, bool)` + +GetCompleteOk returns a tuple with the Complete field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetComplete + +`func (o *Order) SetComplete(v bool)` + +SetComplete sets Complete field to given value. + +### HasComplete + +`func (o *Order) HasComplete() bool` + +HasComplete 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) + + diff --git a/samples/client/petstore/go/go-petstore/OuterComposite.md b/samples/client/petstore/go/go-petstore/OuterComposite.md new file mode 100644 index 00000000000..1ebf86c0a2e --- /dev/null +++ b/samples/client/petstore/go/go-petstore/OuterComposite.md @@ -0,0 +1,108 @@ +# OuterComposite + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MyNumber** | Pointer to **float32** | | [optional] +**MyString** | Pointer to **string** | | [optional] +**MyBoolean** | Pointer to **bool** | | [optional] + +## Methods + +### NewOuterComposite + +`func NewOuterComposite() *OuterComposite` + +NewOuterComposite instantiates a new OuterComposite 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 + +### NewOuterCompositeWithDefaults + +`func NewOuterCompositeWithDefaults() *OuterComposite` + +NewOuterCompositeWithDefaults instantiates a new OuterComposite 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 + +### GetMyNumber + +`func (o *OuterComposite) GetMyNumber() float32` + +GetMyNumber returns the MyNumber field if non-nil, zero value otherwise. + +### GetMyNumberOk + +`func (o *OuterComposite) GetMyNumberOk() (*float32, bool)` + +GetMyNumberOk returns a tuple with the MyNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMyNumber + +`func (o *OuterComposite) SetMyNumber(v float32)` + +SetMyNumber sets MyNumber field to given value. + +### HasMyNumber + +`func (o *OuterComposite) HasMyNumber() bool` + +HasMyNumber returns a boolean if a field has been set. + +### GetMyString + +`func (o *OuterComposite) GetMyString() string` + +GetMyString returns the MyString field if non-nil, zero value otherwise. + +### GetMyStringOk + +`func (o *OuterComposite) GetMyStringOk() (*string, bool)` + +GetMyStringOk returns a tuple with the MyString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMyString + +`func (o *OuterComposite) SetMyString(v string)` + +SetMyString sets MyString field to given value. + +### HasMyString + +`func (o *OuterComposite) HasMyString() bool` + +HasMyString returns a boolean if a field has been set. + +### GetMyBoolean + +`func (o *OuterComposite) GetMyBoolean() bool` + +GetMyBoolean returns the MyBoolean field if non-nil, zero value otherwise. + +### GetMyBooleanOk + +`func (o *OuterComposite) GetMyBooleanOk() (*bool, bool)` + +GetMyBooleanOk returns a tuple with the MyBoolean field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMyBoolean + +`func (o *OuterComposite) SetMyBoolean(v bool)` + +SetMyBoolean sets MyBoolean field to given value. + +### HasMyBoolean + +`func (o *OuterComposite) HasMyBoolean() bool` + +HasMyBoolean 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) + + diff --git a/samples/client/petstore/go/go-petstore/OuterEnum.md b/samples/client/petstore/go/go-petstore/OuterEnum.md new file mode 100644 index 00000000000..13bed2d17fd --- /dev/null +++ b/samples/client/petstore/go/go-petstore/OuterEnum.md @@ -0,0 +1,11 @@ +# OuterEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/Pet.md b/samples/client/petstore/go/go-petstore/Pet.md new file mode 100644 index 00000000000..a6eae34657d --- /dev/null +++ b/samples/client/petstore/go/go-petstore/Pet.md @@ -0,0 +1,176 @@ +# Pet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int64** | | [optional] +**Category** | Pointer to [**Category**](Category.md) | | [optional] +**Name** | **string** | | +**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. + +### 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. + +### 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. + + +### 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) + + diff --git a/samples/client/petstore/go/go-petstore/PetApi.md b/samples/client/petstore/go/go-petstore/PetApi.md new file mode 100644 index 00000000000..c2559ac673a --- /dev/null +++ b/samples/client/petstore/go/go-petstore/PetApi.md @@ -0,0 +1,625 @@ +# \PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AddPet**](PetApi.md#AddPet) | **Post** /pet | Add a new pet to the store +[**DeletePet**](PetApi.md#DeletePet) | **Delete** /pet/{petId} | Deletes a pet +[**FindPetsByStatus**](PetApi.md#FindPetsByStatus) | **Get** /pet/findByStatus | Finds Pets by status +[**FindPetsByTags**](PetApi.md#FindPetsByTags) | **Get** /pet/findByTags | Finds Pets by tags +[**GetPetById**](PetApi.md#GetPetById) | **Get** /pet/{petId} | Find pet by ID +[**UpdatePet**](PetApi.md#UpdatePet) | **Put** /pet | Update an existing pet +[**UpdatePetWithForm**](PetApi.md#UpdatePetWithForm) | **Post** /pet/{petId} | Updates a pet in the store with form data +[**UploadFile**](PetApi.md#UploadFile) | **Post** /pet/{petId}/uploadImage | uploads an image +[**UploadFileWithRequiredFile**](PetApi.md#UploadFileWithRequiredFile) | **Post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + + +## AddPet + +> AddPet(ctx).Body(body).Execute() + +Add a new pet to the store + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.Pet{Id: int64(123), Category: openapiclient.Category{Id: int64(123), Name: "Name_example"}, Name: "Name_example", PhotoUrls: []string{"PhotoUrls_example"), Tags: []Tag{openapiclient.Tag{Id: int64(123), Name: "Name_example"}), Status: "Status_example"} // Pet | Pet object that needs to be added to the store + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.AddPet(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.AddPet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiAddPetRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +[[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) + + +## DeletePet + +> DeletePet(ctx, petId).ApiKey(apiKey).Execute() + +Deletes a pet + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | Pet id to delete + apiKey := "apiKey_example" // string | (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.DeletePet(context.Background(), petId).ApiKey(apiKey).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.DeletePet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64** | Pet id to delete | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeletePetRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **apiKey** | **string** | | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## FindPetsByStatus + +> []Pet FindPetsByStatus(ctx).Status(status).Execute() + +Finds Pets by status + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + status := []string{"Status_example"} // []string | Status values that need to be considered for filter + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.FindPetsByStatus(context.Background(), status).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.FindPetsByStatus``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FindPetsByStatus`: []Pet + fmt.Fprintf(os.Stdout, "Response from `PetApi.FindPetsByStatus`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFindPetsByStatusRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**[]string**](string.md) | Status values that need to be considered for filter | + +### Return type + +[**[]Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, 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) + + +## FindPetsByTags + +> []Pet FindPetsByTags(ctx).Tags(tags).Execute() + +Finds Pets by tags + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + tags := []string{"Inner_example"} // []string | Tags to filter by + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.FindPetsByTags(context.Background(), tags).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.FindPetsByTags``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FindPetsByTags`: []Pet + fmt.Fprintf(os.Stdout, "Response from `PetApi.FindPetsByTags`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFindPetsByTagsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**[]string**](string.md) | Tags to filter by | + +### Return type + +[**[]Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, 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) + + +## GetPetById + +> Pet GetPetById(ctx, petId).Execute() + +Find pet by ID + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet to return + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.GetPetById(context.Background(), petId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.GetPetById``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetPetById`: Pet + fmt.Fprintf(os.Stdout, "Response from `PetApi.GetPetById`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64** | ID of pet to return | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetPetByIdRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, 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) + + +## UpdatePet + +> UpdatePet(ctx).Body(body).Execute() + +Update an existing pet + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.Pet{Id: int64(123), Category: openapiclient.Category{Id: int64(123), Name: "Name_example"}, Name: "Name_example", PhotoUrls: []string{"PhotoUrls_example"), Tags: []Tag{openapiclient.Tag{Id: int64(123), Name: "Name_example"}), Status: "Status_example"} // Pet | Pet object that needs to be added to the store + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UpdatePet(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UpdatePet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdatePetRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +[[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) + + +## UpdatePetWithForm + +> UpdatePetWithForm(ctx, petId).Name(name).Status(status).Execute() + +Updates a pet in the store with form data + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet that needs to be updated + name := "name_example" // string | Updated name of the pet (optional) + status := "status_example" // string | Updated status of the pet (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UpdatePetWithForm(context.Background(), petId).Name(name).Status(status).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UpdatePetWithForm``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64** | ID of pet that needs to be updated | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdatePetWithFormRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **name** | **string** | Updated name of the pet | + **status** | **string** | Updated status of the pet | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +[[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) + + +## UploadFile + +> ApiResponse UploadFile(ctx, petId).AdditionalMetadata(additionalMetadata).File(file).Execute() + +uploads an image + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet to update + additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional) + file := 987 // *os.File | file to upload (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UploadFile(context.Background(), petId).AdditionalMetadata(additionalMetadata).File(file).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UploadFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UploadFile`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `PetApi.UploadFile`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64** | ID of pet to update | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUploadFileRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **additionalMetadata** | **string** | Additional data to pass to server | + **file** | ***os.File** | file to upload | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **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) + + +## UploadFileWithRequiredFile + +> ApiResponse UploadFileWithRequiredFile(ctx, petId).RequiredFile(requiredFile).AdditionalMetadata(additionalMetadata).Execute() + +uploads an image (required) + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet to update + requiredFile := 987 // *os.File | file to upload + additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UploadFileWithRequiredFile(context.Background(), petId, requiredFile).AdditionalMetadata(additionalMetadata).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UploadFileWithRequiredFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UploadFileWithRequiredFile`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `PetApi.UploadFileWithRequiredFile`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64** | ID of pet to update | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUploadFileWithRequiredFileRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **requiredFile** | ***os.File** | file to upload | + **additionalMetadata** | **string** | Additional data to pass to server | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **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) + diff --git a/samples/client/petstore/go/go-petstore/ReadOnlyFirst.md b/samples/client/petstore/go/go-petstore/ReadOnlyFirst.md new file mode 100644 index 00000000000..2e25d6d230e --- /dev/null +++ b/samples/client/petstore/go/go-petstore/ReadOnlyFirst.md @@ -0,0 +1,82 @@ +# ReadOnlyFirst + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | Pointer to **string** | | [optional] [readonly] +**Baz** | Pointer to **string** | | [optional] + +## Methods + +### NewReadOnlyFirst + +`func NewReadOnlyFirst() *ReadOnlyFirst` + +NewReadOnlyFirst instantiates a new ReadOnlyFirst 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 + +### NewReadOnlyFirstWithDefaults + +`func NewReadOnlyFirstWithDefaults() *ReadOnlyFirst` + +NewReadOnlyFirstWithDefaults instantiates a new ReadOnlyFirst 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 + +### GetBar + +`func (o *ReadOnlyFirst) GetBar() string` + +GetBar returns the Bar field if non-nil, zero value otherwise. + +### GetBarOk + +`func (o *ReadOnlyFirst) GetBarOk() (*string, bool)` + +GetBarOk returns a tuple with the Bar field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBar + +`func (o *ReadOnlyFirst) SetBar(v string)` + +SetBar sets Bar field to given value. + +### HasBar + +`func (o *ReadOnlyFirst) HasBar() bool` + +HasBar returns a boolean if a field has been set. + +### GetBaz + +`func (o *ReadOnlyFirst) GetBaz() string` + +GetBaz returns the Baz field if non-nil, zero value otherwise. + +### GetBazOk + +`func (o *ReadOnlyFirst) GetBazOk() (*string, bool)` + +GetBazOk returns a tuple with the Baz field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBaz + +`func (o *ReadOnlyFirst) SetBaz(v string)` + +SetBaz sets Baz field to given value. + +### HasBaz + +`func (o *ReadOnlyFirst) HasBaz() bool` + +HasBaz 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) + + diff --git a/samples/client/petstore/go/go-petstore/Return.md b/samples/client/petstore/go/go-petstore/Return.md new file mode 100644 index 00000000000..d6be5a42f31 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/Return.md @@ -0,0 +1,56 @@ +# Return + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Return** | Pointer to **int32** | | [optional] + +## Methods + +### NewReturn + +`func NewReturn() *Return` + +NewReturn instantiates a new Return 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 + +### NewReturnWithDefaults + +`func NewReturnWithDefaults() *Return` + +NewReturnWithDefaults instantiates a new Return 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 + +### GetReturn + +`func (o *Return) GetReturn() int32` + +GetReturn returns the Return field if non-nil, zero value otherwise. + +### GetReturnOk + +`func (o *Return) GetReturnOk() (*int32, bool)` + +GetReturnOk returns a tuple with the Return field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetReturn + +`func (o *Return) SetReturn(v int32)` + +SetReturn sets Return field to given value. + +### HasReturn + +`func (o *Return) HasReturn() bool` + +HasReturn 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) + + diff --git a/samples/client/petstore/go/go-petstore/StoreApi.md b/samples/client/petstore/go/go-petstore/StoreApi.md new file mode 100644 index 00000000000..58a65c02215 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/StoreApi.md @@ -0,0 +1,275 @@ +# \StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**DeleteOrder**](StoreApi.md#DeleteOrder) | **Delete** /store/order/{order_id} | Delete purchase order by ID +[**GetInventory**](StoreApi.md#GetInventory) | **Get** /store/inventory | Returns pet inventories by status +[**GetOrderById**](StoreApi.md#GetOrderById) | **Get** /store/order/{order_id} | Find purchase order by ID +[**PlaceOrder**](StoreApi.md#PlaceOrder) | **Post** /store/order | Place an order for a pet + + + +## DeleteOrder + +> DeleteOrder(ctx, orderId).Execute() + +Delete purchase order by ID + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + orderId := "orderId_example" // string | ID of the order that needs to be deleted + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.DeleteOrder(context.Background(), orderId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.DeleteOrder``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**orderId** | **string** | ID of the order that needs to be deleted | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteOrderRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## GetInventory + +> map[string]int32 GetInventory(ctx).Execute() + +Returns pet inventories by status + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.GetInventory(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.GetInventory``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetInventory`: map[string]int32 + fmt.Fprintf(os.Stdout, "Response from `StoreApi.GetInventory`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetInventoryRequest struct via the builder pattern + + +### Return type + +**map[string]int32** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetOrderById + +> Order GetOrderById(ctx, orderId).Execute() + +Find purchase order by ID + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + orderId := 987 // int64 | ID of pet that needs to be fetched + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.GetOrderById(context.Background(), orderId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.GetOrderById``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetOrderById`: Order + fmt.Fprintf(os.Stdout, "Response from `StoreApi.GetOrderById`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**orderId** | **int64** | ID of pet that needs to be fetched | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetOrderByIdRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, 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) + + +## PlaceOrder + +> Order PlaceOrder(ctx).Body(body).Execute() + +Place an order for a pet + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.Order{Id: int64(123), PetId: int64(123), Quantity: 123, ShipDate: "TODO", Status: "Status_example", Complete: false} // Order | order placed for purchasing the pet + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.PlaceOrder(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.PlaceOrder``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `PlaceOrder`: Order + fmt.Fprintf(os.Stdout, "Response from `StoreApi.PlaceOrder`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiPlaceOrderRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md) | order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, 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) + diff --git a/samples/client/petstore/go/go-petstore/Tag.md b/samples/client/petstore/go/go-petstore/Tag.md new file mode 100644 index 00000000000..391be6b4900 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/Tag.md @@ -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) + + diff --git a/samples/client/petstore/go/go-petstore/TypeHolderDefault.md b/samples/client/petstore/go/go-petstore/TypeHolderDefault.md new file mode 100644 index 00000000000..34b38a6065f --- /dev/null +++ b/samples/client/petstore/go/go-petstore/TypeHolderDefault.md @@ -0,0 +1,135 @@ +# TypeHolderDefault + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**StringItem** | **string** | | [default to "what"] +**NumberItem** | **float32** | | +**IntegerItem** | **int32** | | +**BoolItem** | **bool** | | [default to true] +**ArrayItem** | **[]int32** | | + +## Methods + +### NewTypeHolderDefault + +`func NewTypeHolderDefault(stringItem string, numberItem float32, integerItem int32, boolItem bool, arrayItem []int32, ) *TypeHolderDefault` + +NewTypeHolderDefault instantiates a new TypeHolderDefault 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 + +### NewTypeHolderDefaultWithDefaults + +`func NewTypeHolderDefaultWithDefaults() *TypeHolderDefault` + +NewTypeHolderDefaultWithDefaults instantiates a new TypeHolderDefault 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 + +### GetStringItem + +`func (o *TypeHolderDefault) GetStringItem() string` + +GetStringItem returns the StringItem field if non-nil, zero value otherwise. + +### GetStringItemOk + +`func (o *TypeHolderDefault) GetStringItemOk() (*string, bool)` + +GetStringItemOk returns a tuple with the StringItem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStringItem + +`func (o *TypeHolderDefault) SetStringItem(v string)` + +SetStringItem sets StringItem field to given value. + + +### GetNumberItem + +`func (o *TypeHolderDefault) GetNumberItem() float32` + +GetNumberItem returns the NumberItem field if non-nil, zero value otherwise. + +### GetNumberItemOk + +`func (o *TypeHolderDefault) GetNumberItemOk() (*float32, bool)` + +GetNumberItemOk returns a tuple with the NumberItem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNumberItem + +`func (o *TypeHolderDefault) SetNumberItem(v float32)` + +SetNumberItem sets NumberItem field to given value. + + +### GetIntegerItem + +`func (o *TypeHolderDefault) GetIntegerItem() int32` + +GetIntegerItem returns the IntegerItem field if non-nil, zero value otherwise. + +### GetIntegerItemOk + +`func (o *TypeHolderDefault) GetIntegerItemOk() (*int32, bool)` + +GetIntegerItemOk returns a tuple with the IntegerItem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIntegerItem + +`func (o *TypeHolderDefault) SetIntegerItem(v int32)` + +SetIntegerItem sets IntegerItem field to given value. + + +### GetBoolItem + +`func (o *TypeHolderDefault) GetBoolItem() bool` + +GetBoolItem returns the BoolItem field if non-nil, zero value otherwise. + +### GetBoolItemOk + +`func (o *TypeHolderDefault) GetBoolItemOk() (*bool, bool)` + +GetBoolItemOk returns a tuple with the BoolItem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBoolItem + +`func (o *TypeHolderDefault) SetBoolItem(v bool)` + +SetBoolItem sets BoolItem field to given value. + + +### GetArrayItem + +`func (o *TypeHolderDefault) GetArrayItem() []int32` + +GetArrayItem returns the ArrayItem field if non-nil, zero value otherwise. + +### GetArrayItemOk + +`func (o *TypeHolderDefault) GetArrayItemOk() (*[]int32, bool)` + +GetArrayItemOk returns a tuple with the ArrayItem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayItem + +`func (o *TypeHolderDefault) SetArrayItem(v []int32)` + +SetArrayItem sets ArrayItem field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/TypeHolderExample.md b/samples/client/petstore/go/go-petstore/TypeHolderExample.md new file mode 100644 index 00000000000..259aae8df56 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/TypeHolderExample.md @@ -0,0 +1,156 @@ +# TypeHolderExample + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**StringItem** | **string** | | +**NumberItem** | **float32** | | +**FloatItem** | **float32** | | +**IntegerItem** | **int32** | | +**BoolItem** | **bool** | | +**ArrayItem** | **[]int32** | | + +## Methods + +### NewTypeHolderExample + +`func NewTypeHolderExample(stringItem string, numberItem float32, floatItem float32, integerItem int32, boolItem bool, arrayItem []int32, ) *TypeHolderExample` + +NewTypeHolderExample instantiates a new TypeHolderExample 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 + +### NewTypeHolderExampleWithDefaults + +`func NewTypeHolderExampleWithDefaults() *TypeHolderExample` + +NewTypeHolderExampleWithDefaults instantiates a new TypeHolderExample 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 + +### GetStringItem + +`func (o *TypeHolderExample) GetStringItem() string` + +GetStringItem returns the StringItem field if non-nil, zero value otherwise. + +### GetStringItemOk + +`func (o *TypeHolderExample) GetStringItemOk() (*string, bool)` + +GetStringItemOk returns a tuple with the StringItem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStringItem + +`func (o *TypeHolderExample) SetStringItem(v string)` + +SetStringItem sets StringItem field to given value. + + +### GetNumberItem + +`func (o *TypeHolderExample) GetNumberItem() float32` + +GetNumberItem returns the NumberItem field if non-nil, zero value otherwise. + +### GetNumberItemOk + +`func (o *TypeHolderExample) GetNumberItemOk() (*float32, bool)` + +GetNumberItemOk returns a tuple with the NumberItem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNumberItem + +`func (o *TypeHolderExample) SetNumberItem(v float32)` + +SetNumberItem sets NumberItem field to given value. + + +### GetFloatItem + +`func (o *TypeHolderExample) GetFloatItem() float32` + +GetFloatItem returns the FloatItem field if non-nil, zero value otherwise. + +### GetFloatItemOk + +`func (o *TypeHolderExample) GetFloatItemOk() (*float32, bool)` + +GetFloatItemOk returns a tuple with the FloatItem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFloatItem + +`func (o *TypeHolderExample) SetFloatItem(v float32)` + +SetFloatItem sets FloatItem field to given value. + + +### GetIntegerItem + +`func (o *TypeHolderExample) GetIntegerItem() int32` + +GetIntegerItem returns the IntegerItem field if non-nil, zero value otherwise. + +### GetIntegerItemOk + +`func (o *TypeHolderExample) GetIntegerItemOk() (*int32, bool)` + +GetIntegerItemOk returns a tuple with the IntegerItem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIntegerItem + +`func (o *TypeHolderExample) SetIntegerItem(v int32)` + +SetIntegerItem sets IntegerItem field to given value. + + +### GetBoolItem + +`func (o *TypeHolderExample) GetBoolItem() bool` + +GetBoolItem returns the BoolItem field if non-nil, zero value otherwise. + +### GetBoolItemOk + +`func (o *TypeHolderExample) GetBoolItemOk() (*bool, bool)` + +GetBoolItemOk returns a tuple with the BoolItem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBoolItem + +`func (o *TypeHolderExample) SetBoolItem(v bool)` + +SetBoolItem sets BoolItem field to given value. + + +### GetArrayItem + +`func (o *TypeHolderExample) GetArrayItem() []int32` + +GetArrayItem returns the ArrayItem field if non-nil, zero value otherwise. + +### GetArrayItemOk + +`func (o *TypeHolderExample) GetArrayItemOk() (*[]int32, bool)` + +GetArrayItemOk returns a tuple with the ArrayItem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayItem + +`func (o *TypeHolderExample) SetArrayItem(v []int32)` + +SetArrayItem sets ArrayItem field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/User.md b/samples/client/petstore/go/go-petstore/User.md new file mode 100644 index 00000000000..a6bea41030b --- /dev/null +++ b/samples/client/petstore/go/go-petstore/User.md @@ -0,0 +1,238 @@ +# User + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int64** | | [optional] +**Username** | Pointer to **string** | | [optional] +**FirstName** | Pointer to **string** | | [optional] +**LastName** | Pointer to **string** | | [optional] +**Email** | Pointer to **string** | | [optional] +**Password** | Pointer to **string** | | [optional] +**Phone** | Pointer to **string** | | [optional] +**UserStatus** | Pointer to **int32** | User Status | [optional] + +## Methods + +### NewUser + +`func NewUser() *User` + +NewUser instantiates a new User 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 + +### NewUserWithDefaults + +`func NewUserWithDefaults() *User` + +NewUserWithDefaults instantiates a new User 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 *User) GetId() int64` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *User) 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 *User) SetId(v int64)` + +SetId sets Id field to given value. + +### HasId + +`func (o *User) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetUsername + +`func (o *User) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *User) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *User) SetUsername(v string)` + +SetUsername sets Username field to given value. + +### HasUsername + +`func (o *User) HasUsername() bool` + +HasUsername returns a boolean if a field has been set. + +### GetFirstName + +`func (o *User) GetFirstName() string` + +GetFirstName returns the FirstName field if non-nil, zero value otherwise. + +### GetFirstNameOk + +`func (o *User) GetFirstNameOk() (*string, bool)` + +GetFirstNameOk returns a tuple with the FirstName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFirstName + +`func (o *User) SetFirstName(v string)` + +SetFirstName sets FirstName field to given value. + +### HasFirstName + +`func (o *User) HasFirstName() bool` + +HasFirstName returns a boolean if a field has been set. + +### GetLastName + +`func (o *User) GetLastName() string` + +GetLastName returns the LastName field if non-nil, zero value otherwise. + +### GetLastNameOk + +`func (o *User) GetLastNameOk() (*string, bool)` + +GetLastNameOk returns a tuple with the LastName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastName + +`func (o *User) SetLastName(v string)` + +SetLastName sets LastName field to given value. + +### HasLastName + +`func (o *User) HasLastName() bool` + +HasLastName returns a boolean if a field has been set. + +### GetEmail + +`func (o *User) GetEmail() string` + +GetEmail returns the Email field if non-nil, zero value otherwise. + +### GetEmailOk + +`func (o *User) GetEmailOk() (*string, bool)` + +GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEmail + +`func (o *User) SetEmail(v string)` + +SetEmail sets Email field to given value. + +### HasEmail + +`func (o *User) HasEmail() bool` + +HasEmail returns a boolean if a field has been set. + +### GetPassword + +`func (o *User) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *User) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *User) SetPassword(v string)` + +SetPassword sets Password field to given value. + +### HasPassword + +`func (o *User) HasPassword() bool` + +HasPassword returns a boolean if a field has been set. + +### GetPhone + +`func (o *User) GetPhone() string` + +GetPhone returns the Phone field if non-nil, zero value otherwise. + +### GetPhoneOk + +`func (o *User) GetPhoneOk() (*string, bool)` + +GetPhoneOk returns a tuple with the Phone field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPhone + +`func (o *User) SetPhone(v string)` + +SetPhone sets Phone field to given value. + +### HasPhone + +`func (o *User) HasPhone() bool` + +HasPhone returns a boolean if a field has been set. + +### GetUserStatus + +`func (o *User) GetUserStatus() int32` + +GetUserStatus returns the UserStatus field if non-nil, zero value otherwise. + +### GetUserStatusOk + +`func (o *User) GetUserStatusOk() (*int32, bool)` + +GetUserStatusOk returns a tuple with the UserStatus field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUserStatus + +`func (o *User) SetUserStatus(v int32)` + +SetUserStatus sets UserStatus field to given value. + +### HasUserStatus + +`func (o *User) HasUserStatus() bool` + +HasUserStatus 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) + + diff --git a/samples/client/petstore/go/go-petstore/UserApi.md b/samples/client/petstore/go/go-petstore/UserApi.md new file mode 100644 index 00000000000..761b86e84be --- /dev/null +++ b/samples/client/petstore/go/go-petstore/UserApi.md @@ -0,0 +1,533 @@ +# \UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateUser**](UserApi.md#CreateUser) | **Post** /user | Create user +[**CreateUsersWithArrayInput**](UserApi.md#CreateUsersWithArrayInput) | **Post** /user/createWithArray | Creates list of users with given input array +[**CreateUsersWithListInput**](UserApi.md#CreateUsersWithListInput) | **Post** /user/createWithList | Creates list of users with given input array +[**DeleteUser**](UserApi.md#DeleteUser) | **Delete** /user/{username} | Delete user +[**GetUserByName**](UserApi.md#GetUserByName) | **Get** /user/{username} | Get user by user name +[**LoginUser**](UserApi.md#LoginUser) | **Get** /user/login | Logs user into the system +[**LogoutUser**](UserApi.md#LogoutUser) | **Get** /user/logout | Logs out current logged in user session +[**UpdateUser**](UserApi.md#UpdateUser) | **Put** /user/{username} | Updated user + + + +## CreateUser + +> CreateUser(ctx).Body(body).Execute() + +Create user + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123} // User | Created user object + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.CreateUser(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md) | Created user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## CreateUsersWithArrayInput + +> CreateUsersWithArrayInput(ctx).Body(body).Execute() + +Creates list of users with given input array + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := []User{openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123}} // []User | List of user object + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.CreateUsersWithArrayInput(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUsersWithArrayInput``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUsersWithArrayInputRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**[]User**](User.md) | List of user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## CreateUsersWithListInput + +> CreateUsersWithListInput(ctx).Body(body).Execute() + +Creates list of users with given input array + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := []User{} // []User | List of user object + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.CreateUsersWithListInput(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUsersWithListInput``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUsersWithListInputRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**[]User**](User.md) | List of user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## DeleteUser + +> DeleteUser(ctx, username).Execute() + +Delete user + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The name that needs to be deleted + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.DeleteUser(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.DeleteUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | The name that needs to be deleted | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## GetUserByName + +> User GetUserByName(ctx, username).Execute() + +Get user by user name + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The name that needs to be fetched. Use user1 for testing. + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.GetUserByName(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.GetUserByName``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserByName`: User + fmt.Fprintf(os.Stdout, "Response from `UserApi.GetUserByName`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | The name that needs to be fetched. Use user1 for testing. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserByNameRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, 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) + + +## LoginUser + +> string LoginUser(ctx).Username(username).Password(password).Execute() + +Logs user into the system + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The user name for login + password := "password_example" // string | The password for login in clear text + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.LoginUser(context.Background(), username, password).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.LoginUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LoginUser`: string + fmt.Fprintf(os.Stdout, "Response from `UserApi.LoginUser`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiLoginUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string** | The user name for login | + **password** | **string** | The password for login in clear text | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, 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) + + +## LogoutUser + +> LogoutUser(ctx).Execute() + +Logs out current logged in user session + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.LogoutUser(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.LogoutUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiLogoutUserRequest struct via the builder pattern + + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## UpdateUser + +> UpdateUser(ctx, username).Body(body).Execute() + +Updated user + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | name that need to be deleted + body := // User | Updated user object + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.UpdateUser(context.Background(), username, body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.UpdateUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | name that need to be deleted | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **body** | [**User**](User.md) | Updated user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/samples/client/petstore/go/go-petstore/XmlItem.md b/samples/client/petstore/go/go-petstore/XmlItem.md new file mode 100644 index 00000000000..b309819923e --- /dev/null +++ b/samples/client/petstore/go/go-petstore/XmlItem.md @@ -0,0 +1,784 @@ +# XmlItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AttributeString** | Pointer to **string** | | [optional] +**AttributeNumber** | Pointer to **float32** | | [optional] +**AttributeInteger** | Pointer to **int32** | | [optional] +**AttributeBoolean** | Pointer to **bool** | | [optional] +**WrappedArray** | Pointer to **[]int32** | | [optional] +**NameString** | Pointer to **string** | | [optional] +**NameNumber** | Pointer to **float32** | | [optional] +**NameInteger** | Pointer to **int32** | | [optional] +**NameBoolean** | Pointer to **bool** | | [optional] +**NameArray** | Pointer to **[]int32** | | [optional] +**NameWrappedArray** | Pointer to **[]int32** | | [optional] +**PrefixString** | Pointer to **string** | | [optional] +**PrefixNumber** | Pointer to **float32** | | [optional] +**PrefixInteger** | Pointer to **int32** | | [optional] +**PrefixBoolean** | Pointer to **bool** | | [optional] +**PrefixArray** | Pointer to **[]int32** | | [optional] +**PrefixWrappedArray** | Pointer to **[]int32** | | [optional] +**NamespaceString** | Pointer to **string** | | [optional] +**NamespaceNumber** | Pointer to **float32** | | [optional] +**NamespaceInteger** | Pointer to **int32** | | [optional] +**NamespaceBoolean** | Pointer to **bool** | | [optional] +**NamespaceArray** | Pointer to **[]int32** | | [optional] +**NamespaceWrappedArray** | Pointer to **[]int32** | | [optional] +**PrefixNsString** | Pointer to **string** | | [optional] +**PrefixNsNumber** | Pointer to **float32** | | [optional] +**PrefixNsInteger** | Pointer to **int32** | | [optional] +**PrefixNsBoolean** | Pointer to **bool** | | [optional] +**PrefixNsArray** | Pointer to **[]int32** | | [optional] +**PrefixNsWrappedArray** | Pointer to **[]int32** | | [optional] + +## Methods + +### NewXmlItem + +`func NewXmlItem() *XmlItem` + +NewXmlItem instantiates a new XmlItem 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 + +### NewXmlItemWithDefaults + +`func NewXmlItemWithDefaults() *XmlItem` + +NewXmlItemWithDefaults instantiates a new XmlItem 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 + +### GetAttributeString + +`func (o *XmlItem) GetAttributeString() string` + +GetAttributeString returns the AttributeString field if non-nil, zero value otherwise. + +### GetAttributeStringOk + +`func (o *XmlItem) GetAttributeStringOk() (*string, bool)` + +GetAttributeStringOk returns a tuple with the AttributeString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAttributeString + +`func (o *XmlItem) SetAttributeString(v string)` + +SetAttributeString sets AttributeString field to given value. + +### HasAttributeString + +`func (o *XmlItem) HasAttributeString() bool` + +HasAttributeString returns a boolean if a field has been set. + +### GetAttributeNumber + +`func (o *XmlItem) GetAttributeNumber() float32` + +GetAttributeNumber returns the AttributeNumber field if non-nil, zero value otherwise. + +### GetAttributeNumberOk + +`func (o *XmlItem) GetAttributeNumberOk() (*float32, bool)` + +GetAttributeNumberOk returns a tuple with the AttributeNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAttributeNumber + +`func (o *XmlItem) SetAttributeNumber(v float32)` + +SetAttributeNumber sets AttributeNumber field to given value. + +### HasAttributeNumber + +`func (o *XmlItem) HasAttributeNumber() bool` + +HasAttributeNumber returns a boolean if a field has been set. + +### GetAttributeInteger + +`func (o *XmlItem) GetAttributeInteger() int32` + +GetAttributeInteger returns the AttributeInteger field if non-nil, zero value otherwise. + +### GetAttributeIntegerOk + +`func (o *XmlItem) GetAttributeIntegerOk() (*int32, bool)` + +GetAttributeIntegerOk returns a tuple with the AttributeInteger field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAttributeInteger + +`func (o *XmlItem) SetAttributeInteger(v int32)` + +SetAttributeInteger sets AttributeInteger field to given value. + +### HasAttributeInteger + +`func (o *XmlItem) HasAttributeInteger() bool` + +HasAttributeInteger returns a boolean if a field has been set. + +### GetAttributeBoolean + +`func (o *XmlItem) GetAttributeBoolean() bool` + +GetAttributeBoolean returns the AttributeBoolean field if non-nil, zero value otherwise. + +### GetAttributeBooleanOk + +`func (o *XmlItem) GetAttributeBooleanOk() (*bool, bool)` + +GetAttributeBooleanOk returns a tuple with the AttributeBoolean field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAttributeBoolean + +`func (o *XmlItem) SetAttributeBoolean(v bool)` + +SetAttributeBoolean sets AttributeBoolean field to given value. + +### HasAttributeBoolean + +`func (o *XmlItem) HasAttributeBoolean() bool` + +HasAttributeBoolean returns a boolean if a field has been set. + +### GetWrappedArray + +`func (o *XmlItem) GetWrappedArray() []int32` + +GetWrappedArray returns the WrappedArray field if non-nil, zero value otherwise. + +### GetWrappedArrayOk + +`func (o *XmlItem) GetWrappedArrayOk() (*[]int32, bool)` + +GetWrappedArrayOk returns a tuple with the WrappedArray field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetWrappedArray + +`func (o *XmlItem) SetWrappedArray(v []int32)` + +SetWrappedArray sets WrappedArray field to given value. + +### HasWrappedArray + +`func (o *XmlItem) HasWrappedArray() bool` + +HasWrappedArray returns a boolean if a field has been set. + +### GetNameString + +`func (o *XmlItem) GetNameString() string` + +GetNameString returns the NameString field if non-nil, zero value otherwise. + +### GetNameStringOk + +`func (o *XmlItem) GetNameStringOk() (*string, bool)` + +GetNameStringOk returns a tuple with the NameString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNameString + +`func (o *XmlItem) SetNameString(v string)` + +SetNameString sets NameString field to given value. + +### HasNameString + +`func (o *XmlItem) HasNameString() bool` + +HasNameString returns a boolean if a field has been set. + +### GetNameNumber + +`func (o *XmlItem) GetNameNumber() float32` + +GetNameNumber returns the NameNumber field if non-nil, zero value otherwise. + +### GetNameNumberOk + +`func (o *XmlItem) GetNameNumberOk() (*float32, bool)` + +GetNameNumberOk returns a tuple with the NameNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNameNumber + +`func (o *XmlItem) SetNameNumber(v float32)` + +SetNameNumber sets NameNumber field to given value. + +### HasNameNumber + +`func (o *XmlItem) HasNameNumber() bool` + +HasNameNumber returns a boolean if a field has been set. + +### GetNameInteger + +`func (o *XmlItem) GetNameInteger() int32` + +GetNameInteger returns the NameInteger field if non-nil, zero value otherwise. + +### GetNameIntegerOk + +`func (o *XmlItem) GetNameIntegerOk() (*int32, bool)` + +GetNameIntegerOk returns a tuple with the NameInteger field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNameInteger + +`func (o *XmlItem) SetNameInteger(v int32)` + +SetNameInteger sets NameInteger field to given value. + +### HasNameInteger + +`func (o *XmlItem) HasNameInteger() bool` + +HasNameInteger returns a boolean if a field has been set. + +### GetNameBoolean + +`func (o *XmlItem) GetNameBoolean() bool` + +GetNameBoolean returns the NameBoolean field if non-nil, zero value otherwise. + +### GetNameBooleanOk + +`func (o *XmlItem) GetNameBooleanOk() (*bool, bool)` + +GetNameBooleanOk returns a tuple with the NameBoolean field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNameBoolean + +`func (o *XmlItem) SetNameBoolean(v bool)` + +SetNameBoolean sets NameBoolean field to given value. + +### HasNameBoolean + +`func (o *XmlItem) HasNameBoolean() bool` + +HasNameBoolean returns a boolean if a field has been set. + +### GetNameArray + +`func (o *XmlItem) GetNameArray() []int32` + +GetNameArray returns the NameArray field if non-nil, zero value otherwise. + +### GetNameArrayOk + +`func (o *XmlItem) GetNameArrayOk() (*[]int32, bool)` + +GetNameArrayOk returns a tuple with the NameArray field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNameArray + +`func (o *XmlItem) SetNameArray(v []int32)` + +SetNameArray sets NameArray field to given value. + +### HasNameArray + +`func (o *XmlItem) HasNameArray() bool` + +HasNameArray returns a boolean if a field has been set. + +### GetNameWrappedArray + +`func (o *XmlItem) GetNameWrappedArray() []int32` + +GetNameWrappedArray returns the NameWrappedArray field if non-nil, zero value otherwise. + +### GetNameWrappedArrayOk + +`func (o *XmlItem) GetNameWrappedArrayOk() (*[]int32, bool)` + +GetNameWrappedArrayOk returns a tuple with the NameWrappedArray field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNameWrappedArray + +`func (o *XmlItem) SetNameWrappedArray(v []int32)` + +SetNameWrappedArray sets NameWrappedArray field to given value. + +### HasNameWrappedArray + +`func (o *XmlItem) HasNameWrappedArray() bool` + +HasNameWrappedArray returns a boolean if a field has been set. + +### GetPrefixString + +`func (o *XmlItem) GetPrefixString() string` + +GetPrefixString returns the PrefixString field if non-nil, zero value otherwise. + +### GetPrefixStringOk + +`func (o *XmlItem) GetPrefixStringOk() (*string, bool)` + +GetPrefixStringOk returns a tuple with the PrefixString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefixString + +`func (o *XmlItem) SetPrefixString(v string)` + +SetPrefixString sets PrefixString field to given value. + +### HasPrefixString + +`func (o *XmlItem) HasPrefixString() bool` + +HasPrefixString returns a boolean if a field has been set. + +### GetPrefixNumber + +`func (o *XmlItem) GetPrefixNumber() float32` + +GetPrefixNumber returns the PrefixNumber field if non-nil, zero value otherwise. + +### GetPrefixNumberOk + +`func (o *XmlItem) GetPrefixNumberOk() (*float32, bool)` + +GetPrefixNumberOk returns a tuple with the PrefixNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefixNumber + +`func (o *XmlItem) SetPrefixNumber(v float32)` + +SetPrefixNumber sets PrefixNumber field to given value. + +### HasPrefixNumber + +`func (o *XmlItem) HasPrefixNumber() bool` + +HasPrefixNumber returns a boolean if a field has been set. + +### GetPrefixInteger + +`func (o *XmlItem) GetPrefixInteger() int32` + +GetPrefixInteger returns the PrefixInteger field if non-nil, zero value otherwise. + +### GetPrefixIntegerOk + +`func (o *XmlItem) GetPrefixIntegerOk() (*int32, bool)` + +GetPrefixIntegerOk returns a tuple with the PrefixInteger field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefixInteger + +`func (o *XmlItem) SetPrefixInteger(v int32)` + +SetPrefixInteger sets PrefixInteger field to given value. + +### HasPrefixInteger + +`func (o *XmlItem) HasPrefixInteger() bool` + +HasPrefixInteger returns a boolean if a field has been set. + +### GetPrefixBoolean + +`func (o *XmlItem) GetPrefixBoolean() bool` + +GetPrefixBoolean returns the PrefixBoolean field if non-nil, zero value otherwise. + +### GetPrefixBooleanOk + +`func (o *XmlItem) GetPrefixBooleanOk() (*bool, bool)` + +GetPrefixBooleanOk returns a tuple with the PrefixBoolean field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefixBoolean + +`func (o *XmlItem) SetPrefixBoolean(v bool)` + +SetPrefixBoolean sets PrefixBoolean field to given value. + +### HasPrefixBoolean + +`func (o *XmlItem) HasPrefixBoolean() bool` + +HasPrefixBoolean returns a boolean if a field has been set. + +### GetPrefixArray + +`func (o *XmlItem) GetPrefixArray() []int32` + +GetPrefixArray returns the PrefixArray field if non-nil, zero value otherwise. + +### GetPrefixArrayOk + +`func (o *XmlItem) GetPrefixArrayOk() (*[]int32, bool)` + +GetPrefixArrayOk returns a tuple with the PrefixArray field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefixArray + +`func (o *XmlItem) SetPrefixArray(v []int32)` + +SetPrefixArray sets PrefixArray field to given value. + +### HasPrefixArray + +`func (o *XmlItem) HasPrefixArray() bool` + +HasPrefixArray returns a boolean if a field has been set. + +### GetPrefixWrappedArray + +`func (o *XmlItem) GetPrefixWrappedArray() []int32` + +GetPrefixWrappedArray returns the PrefixWrappedArray field if non-nil, zero value otherwise. + +### GetPrefixWrappedArrayOk + +`func (o *XmlItem) GetPrefixWrappedArrayOk() (*[]int32, bool)` + +GetPrefixWrappedArrayOk returns a tuple with the PrefixWrappedArray field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefixWrappedArray + +`func (o *XmlItem) SetPrefixWrappedArray(v []int32)` + +SetPrefixWrappedArray sets PrefixWrappedArray field to given value. + +### HasPrefixWrappedArray + +`func (o *XmlItem) HasPrefixWrappedArray() bool` + +HasPrefixWrappedArray returns a boolean if a field has been set. + +### GetNamespaceString + +`func (o *XmlItem) GetNamespaceString() string` + +GetNamespaceString returns the NamespaceString field if non-nil, zero value otherwise. + +### GetNamespaceStringOk + +`func (o *XmlItem) GetNamespaceStringOk() (*string, bool)` + +GetNamespaceStringOk returns a tuple with the NamespaceString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNamespaceString + +`func (o *XmlItem) SetNamespaceString(v string)` + +SetNamespaceString sets NamespaceString field to given value. + +### HasNamespaceString + +`func (o *XmlItem) HasNamespaceString() bool` + +HasNamespaceString returns a boolean if a field has been set. + +### GetNamespaceNumber + +`func (o *XmlItem) GetNamespaceNumber() float32` + +GetNamespaceNumber returns the NamespaceNumber field if non-nil, zero value otherwise. + +### GetNamespaceNumberOk + +`func (o *XmlItem) GetNamespaceNumberOk() (*float32, bool)` + +GetNamespaceNumberOk returns a tuple with the NamespaceNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNamespaceNumber + +`func (o *XmlItem) SetNamespaceNumber(v float32)` + +SetNamespaceNumber sets NamespaceNumber field to given value. + +### HasNamespaceNumber + +`func (o *XmlItem) HasNamespaceNumber() bool` + +HasNamespaceNumber returns a boolean if a field has been set. + +### GetNamespaceInteger + +`func (o *XmlItem) GetNamespaceInteger() int32` + +GetNamespaceInteger returns the NamespaceInteger field if non-nil, zero value otherwise. + +### GetNamespaceIntegerOk + +`func (o *XmlItem) GetNamespaceIntegerOk() (*int32, bool)` + +GetNamespaceIntegerOk returns a tuple with the NamespaceInteger field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNamespaceInteger + +`func (o *XmlItem) SetNamespaceInteger(v int32)` + +SetNamespaceInteger sets NamespaceInteger field to given value. + +### HasNamespaceInteger + +`func (o *XmlItem) HasNamespaceInteger() bool` + +HasNamespaceInteger returns a boolean if a field has been set. + +### GetNamespaceBoolean + +`func (o *XmlItem) GetNamespaceBoolean() bool` + +GetNamespaceBoolean returns the NamespaceBoolean field if non-nil, zero value otherwise. + +### GetNamespaceBooleanOk + +`func (o *XmlItem) GetNamespaceBooleanOk() (*bool, bool)` + +GetNamespaceBooleanOk returns a tuple with the NamespaceBoolean field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNamespaceBoolean + +`func (o *XmlItem) SetNamespaceBoolean(v bool)` + +SetNamespaceBoolean sets NamespaceBoolean field to given value. + +### HasNamespaceBoolean + +`func (o *XmlItem) HasNamespaceBoolean() bool` + +HasNamespaceBoolean returns a boolean if a field has been set. + +### GetNamespaceArray + +`func (o *XmlItem) GetNamespaceArray() []int32` + +GetNamespaceArray returns the NamespaceArray field if non-nil, zero value otherwise. + +### GetNamespaceArrayOk + +`func (o *XmlItem) GetNamespaceArrayOk() (*[]int32, bool)` + +GetNamespaceArrayOk returns a tuple with the NamespaceArray field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNamespaceArray + +`func (o *XmlItem) SetNamespaceArray(v []int32)` + +SetNamespaceArray sets NamespaceArray field to given value. + +### HasNamespaceArray + +`func (o *XmlItem) HasNamespaceArray() bool` + +HasNamespaceArray returns a boolean if a field has been set. + +### GetNamespaceWrappedArray + +`func (o *XmlItem) GetNamespaceWrappedArray() []int32` + +GetNamespaceWrappedArray returns the NamespaceWrappedArray field if non-nil, zero value otherwise. + +### GetNamespaceWrappedArrayOk + +`func (o *XmlItem) GetNamespaceWrappedArrayOk() (*[]int32, bool)` + +GetNamespaceWrappedArrayOk returns a tuple with the NamespaceWrappedArray field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNamespaceWrappedArray + +`func (o *XmlItem) SetNamespaceWrappedArray(v []int32)` + +SetNamespaceWrappedArray sets NamespaceWrappedArray field to given value. + +### HasNamespaceWrappedArray + +`func (o *XmlItem) HasNamespaceWrappedArray() bool` + +HasNamespaceWrappedArray returns a boolean if a field has been set. + +### GetPrefixNsString + +`func (o *XmlItem) GetPrefixNsString() string` + +GetPrefixNsString returns the PrefixNsString field if non-nil, zero value otherwise. + +### GetPrefixNsStringOk + +`func (o *XmlItem) GetPrefixNsStringOk() (*string, bool)` + +GetPrefixNsStringOk returns a tuple with the PrefixNsString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefixNsString + +`func (o *XmlItem) SetPrefixNsString(v string)` + +SetPrefixNsString sets PrefixNsString field to given value. + +### HasPrefixNsString + +`func (o *XmlItem) HasPrefixNsString() bool` + +HasPrefixNsString returns a boolean if a field has been set. + +### GetPrefixNsNumber + +`func (o *XmlItem) GetPrefixNsNumber() float32` + +GetPrefixNsNumber returns the PrefixNsNumber field if non-nil, zero value otherwise. + +### GetPrefixNsNumberOk + +`func (o *XmlItem) GetPrefixNsNumberOk() (*float32, bool)` + +GetPrefixNsNumberOk returns a tuple with the PrefixNsNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefixNsNumber + +`func (o *XmlItem) SetPrefixNsNumber(v float32)` + +SetPrefixNsNumber sets PrefixNsNumber field to given value. + +### HasPrefixNsNumber + +`func (o *XmlItem) HasPrefixNsNumber() bool` + +HasPrefixNsNumber returns a boolean if a field has been set. + +### GetPrefixNsInteger + +`func (o *XmlItem) GetPrefixNsInteger() int32` + +GetPrefixNsInteger returns the PrefixNsInteger field if non-nil, zero value otherwise. + +### GetPrefixNsIntegerOk + +`func (o *XmlItem) GetPrefixNsIntegerOk() (*int32, bool)` + +GetPrefixNsIntegerOk returns a tuple with the PrefixNsInteger field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefixNsInteger + +`func (o *XmlItem) SetPrefixNsInteger(v int32)` + +SetPrefixNsInteger sets PrefixNsInteger field to given value. + +### HasPrefixNsInteger + +`func (o *XmlItem) HasPrefixNsInteger() bool` + +HasPrefixNsInteger returns a boolean if a field has been set. + +### GetPrefixNsBoolean + +`func (o *XmlItem) GetPrefixNsBoolean() bool` + +GetPrefixNsBoolean returns the PrefixNsBoolean field if non-nil, zero value otherwise. + +### GetPrefixNsBooleanOk + +`func (o *XmlItem) GetPrefixNsBooleanOk() (*bool, bool)` + +GetPrefixNsBooleanOk returns a tuple with the PrefixNsBoolean field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefixNsBoolean + +`func (o *XmlItem) SetPrefixNsBoolean(v bool)` + +SetPrefixNsBoolean sets PrefixNsBoolean field to given value. + +### HasPrefixNsBoolean + +`func (o *XmlItem) HasPrefixNsBoolean() bool` + +HasPrefixNsBoolean returns a boolean if a field has been set. + +### GetPrefixNsArray + +`func (o *XmlItem) GetPrefixNsArray() []int32` + +GetPrefixNsArray returns the PrefixNsArray field if non-nil, zero value otherwise. + +### GetPrefixNsArrayOk + +`func (o *XmlItem) GetPrefixNsArrayOk() (*[]int32, bool)` + +GetPrefixNsArrayOk returns a tuple with the PrefixNsArray field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefixNsArray + +`func (o *XmlItem) SetPrefixNsArray(v []int32)` + +SetPrefixNsArray sets PrefixNsArray field to given value. + +### HasPrefixNsArray + +`func (o *XmlItem) HasPrefixNsArray() bool` + +HasPrefixNsArray returns a boolean if a field has been set. + +### GetPrefixNsWrappedArray + +`func (o *XmlItem) GetPrefixNsWrappedArray() []int32` + +GetPrefixNsWrappedArray returns the PrefixNsWrappedArray field if non-nil, zero value otherwise. + +### GetPrefixNsWrappedArrayOk + +`func (o *XmlItem) GetPrefixNsWrappedArrayOk() (*[]int32, bool)` + +GetPrefixNsWrappedArrayOk returns a tuple with the PrefixNsWrappedArray field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefixNsWrappedArray + +`func (o *XmlItem) SetPrefixNsWrappedArray(v []int32)` + +SetPrefixNsWrappedArray sets PrefixNsWrappedArray field to given value. + +### HasPrefixNsWrappedArray + +`func (o *XmlItem) HasPrefixNsWrappedArray() bool` + +HasPrefixNsWrappedArray 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) + + diff --git a/samples/client/petstore/go/go-petstore/petstore/api_another_fake.go b/samples/client/petstore/go/go-petstore/petstore/api_another_fake.go new file mode 100644 index 00000000000..cbcbcd620d2 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/api_another_fake.go @@ -0,0 +1,131 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" +) + +// Linger please +var ( + _ _context.Context +) + +// AnotherFakeApiService AnotherFakeApi service +type AnotherFakeApiService service + +type apiCall123TestSpecialTagsRequest struct { + ctx _context.Context + apiService *AnotherFakeApiService + body *Client +} + +func (r apiCall123TestSpecialTagsRequest) Body(body Client) apiCall123TestSpecialTagsRequest { + r.body = &body + return r +} +/* +Call123TestSpecialTags To test special tags +To test special tags and operation ID starting with number + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiCall123TestSpecialTagsRequest +*/ +func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context) apiCall123TestSpecialTagsRequest { + return apiCall123TestSpecialTagsRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return Client +*/ +func (r apiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Client + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "AnotherFakeApiService.Call123TestSpecialTags") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/another-fake/dummy" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } + + // 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.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/client/petstore/go/go-petstore/petstore/api_fake.go b/samples/client/petstore/go/go-petstore/petstore/api_fake.go new file mode 100644 index 00000000000..773eb594fbf --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/api_fake.go @@ -0,0 +1,1671 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "os" + "time" + "reflect" +) + +// Linger please +var ( + _ _context.Context +) + +// FakeApiService FakeApi service +type FakeApiService service + +type apiCreateXmlItemRequest struct { + ctx _context.Context + apiService *FakeApiService + xmlItem *XmlItem +} + +func (r apiCreateXmlItemRequest) XmlItem(xmlItem XmlItem) apiCreateXmlItemRequest { + r.xmlItem = &xmlItem + return r +} +/* +CreateXmlItem creates an XmlItem +this route creates an XmlItem + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiCreateXmlItemRequest +*/ +func (a *FakeApiService) CreateXmlItem(ctx _context.Context) apiCreateXmlItemRequest { + return apiCreateXmlItemRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiCreateXmlItemRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.CreateXmlItem") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/create_xml_item" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.xmlItem == nil { + return nil, reportError("xmlItem is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.xmlItem + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiFakeOuterBooleanSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + body *bool +} + +func (r apiFakeOuterBooleanSerializeRequest) Body(body bool) apiFakeOuterBooleanSerializeRequest { + r.body = &body + return r +} +/* +FakeOuterBooleanSerialize Method for FakeOuterBooleanSerialize +Test serialization of outer boolean types + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiFakeOuterBooleanSerializeRequest +*/ +func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context) apiFakeOuterBooleanSerializeRequest { + return apiFakeOuterBooleanSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return bool +*/ +func (r apiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue bool + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterBooleanSerialize") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/outer/boolean" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiFakeOuterCompositeSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + body *OuterComposite +} + +func (r apiFakeOuterCompositeSerializeRequest) Body(body OuterComposite) apiFakeOuterCompositeSerializeRequest { + r.body = &body + return r +} +/* +FakeOuterCompositeSerialize Method for FakeOuterCompositeSerialize +Test serialization of object with outer number type + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiFakeOuterCompositeSerializeRequest +*/ +func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context) apiFakeOuterCompositeSerializeRequest { + return apiFakeOuterCompositeSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return OuterComposite +*/ +func (r apiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue OuterComposite + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterCompositeSerialize") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/outer/composite" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiFakeOuterNumberSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + body *float32 +} + +func (r apiFakeOuterNumberSerializeRequest) Body(body float32) apiFakeOuterNumberSerializeRequest { + r.body = &body + return r +} +/* +FakeOuterNumberSerialize Method for FakeOuterNumberSerialize +Test serialization of outer number types + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiFakeOuterNumberSerializeRequest +*/ +func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context) apiFakeOuterNumberSerializeRequest { + return apiFakeOuterNumberSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return float32 +*/ +func (r apiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue float32 + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterNumberSerialize") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/outer/number" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiFakeOuterStringSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + body *string +} + +func (r apiFakeOuterStringSerializeRequest) Body(body string) apiFakeOuterStringSerializeRequest { + r.body = &body + return r +} +/* +FakeOuterStringSerialize Method for FakeOuterStringSerialize +Test serialization of outer string types + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiFakeOuterStringSerializeRequest +*/ +func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context) apiFakeOuterStringSerializeRequest { + return apiFakeOuterStringSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return string +*/ +func (r apiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue string + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterStringSerialize") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/outer/string" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiTestBodyWithFileSchemaRequest struct { + ctx _context.Context + apiService *FakeApiService + body *FileSchemaTestClass +} + +func (r apiTestBodyWithFileSchemaRequest) Body(body FileSchemaTestClass) apiTestBodyWithFileSchemaRequest { + r.body = &body + return r +} +/* +TestBodyWithFileSchema Method for TestBodyWithFileSchema +For this test, the body for this request much reference a schema named `File`. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestBodyWithFileSchemaRequest +*/ +func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context) apiTestBodyWithFileSchemaRequest { + return apiTestBodyWithFileSchemaRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestBodyWithFileSchemaRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithFileSchema") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/body-with-file-schema" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return nil, reportError("body is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiTestBodyWithQueryParamsRequest struct { + ctx _context.Context + apiService *FakeApiService + query *string + body *User +} + +func (r apiTestBodyWithQueryParamsRequest) Query(query string) apiTestBodyWithQueryParamsRequest { + r.query = &query + return r +} +func (r apiTestBodyWithQueryParamsRequest) Body(body User) apiTestBodyWithQueryParamsRequest { + r.body = &body + return r +} +/* +TestBodyWithQueryParams Method for TestBodyWithQueryParams + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestBodyWithQueryParamsRequest +*/ +func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context) apiTestBodyWithQueryParamsRequest { + return apiTestBodyWithQueryParamsRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestBodyWithQueryParamsRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithQueryParams") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/body-with-query-params" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.query == nil { + return nil, reportError("query is required and must be specified") + } + if r.body == nil { + return nil, reportError("body is required and must be specified") + } + + localVarQueryParams.Add("query", parameterToString(*r.query, "")) + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiTestClientModelRequest struct { + ctx _context.Context + apiService *FakeApiService + body *Client +} + +func (r apiTestClientModelRequest) Body(body Client) apiTestClientModelRequest { + r.body = &body + return r +} +/* +TestClientModel To test \"client\" model +To test "client" model + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestClientModelRequest +*/ +func (a *FakeApiService) TestClientModel(ctx _context.Context) apiTestClientModelRequest { + return apiTestClientModelRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return Client +*/ +func (r apiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Client + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestClientModel") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } + + // 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.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiTestEndpointParametersRequest struct { + ctx _context.Context + apiService *FakeApiService + number *float32 + double *float64 + patternWithoutDelimiter *string + byte_ *string + integer *int32 + int32_ *int32 + int64_ *int64 + float *float32 + string_ *string + binary **os.File + date *string + dateTime *time.Time + password *string + callback *string +} + +func (r apiTestEndpointParametersRequest) Number(number float32) apiTestEndpointParametersRequest { + r.number = &number + return r +} +func (r apiTestEndpointParametersRequest) Double(double float64) apiTestEndpointParametersRequest { + r.double = &double + return r +} +func (r apiTestEndpointParametersRequest) PatternWithoutDelimiter(patternWithoutDelimiter string) apiTestEndpointParametersRequest { + r.patternWithoutDelimiter = &patternWithoutDelimiter + return r +} +func (r apiTestEndpointParametersRequest) Byte_(byte_ string) apiTestEndpointParametersRequest { + r.byte_ = &byte_ + return r +} +func (r apiTestEndpointParametersRequest) Integer(integer int32) apiTestEndpointParametersRequest { + r.integer = &integer + return r +} +func (r apiTestEndpointParametersRequest) Int32_(int32_ int32) apiTestEndpointParametersRequest { + r.int32_ = &int32_ + return r +} +func (r apiTestEndpointParametersRequest) Int64_(int64_ int64) apiTestEndpointParametersRequest { + r.int64_ = &int64_ + return r +} +func (r apiTestEndpointParametersRequest) Float(float float32) apiTestEndpointParametersRequest { + r.float = &float + return r +} +func (r apiTestEndpointParametersRequest) String_(string_ string) apiTestEndpointParametersRequest { + r.string_ = &string_ + return r +} +func (r apiTestEndpointParametersRequest) Binary(binary *os.File) apiTestEndpointParametersRequest { + r.binary = &binary + return r +} +func (r apiTestEndpointParametersRequest) Date(date string) apiTestEndpointParametersRequest { + r.date = &date + return r +} +func (r apiTestEndpointParametersRequest) DateTime(dateTime time.Time) apiTestEndpointParametersRequest { + r.dateTime = &dateTime + return r +} +func (r apiTestEndpointParametersRequest) Password(password string) apiTestEndpointParametersRequest { + r.password = &password + return r +} +func (r apiTestEndpointParametersRequest) Callback(callback string) apiTestEndpointParametersRequest { + r.callback = &callback + return r +} +/* +TestEndpointParameters Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ +Fake endpoint for testing various parameters + å‡ç«¯é»ž + å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ + 가짜 엔드 í¬ì¸íЏ + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestEndpointParametersRequest +*/ +func (a *FakeApiService) TestEndpointParameters(ctx _context.Context) apiTestEndpointParametersRequest { + return apiTestEndpointParametersRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestEndpointParametersRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEndpointParameters") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.number == nil { + return nil, reportError("number is required and must be specified") + } + if *r.number < 32.1 { + return nil, reportError("number must be greater than 32.1") + } + if *r.number > 543.2 { + return nil, reportError("number must be less than 543.2") + } + if r.double == nil { + return nil, reportError("double is required and must be specified") + } + if *r.double < 67.8 { + return nil, reportError("double must be greater than 67.8") + } + if *r.double > 123.4 { + return nil, reportError("double must be less than 123.4") + } + if r.patternWithoutDelimiter == nil { + return nil, reportError("patternWithoutDelimiter is required and must be specified") + } + if r.byte_ == nil { + return nil, reportError("byte_ is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.integer != nil { + localVarFormParams.Add("integer", parameterToString(*r.integer, "")) + } + if r.int32_ != nil { + localVarFormParams.Add("int32", parameterToString(*r.int32_, "")) + } + if r.int64_ != nil { + localVarFormParams.Add("int64", parameterToString(*r.int64_, "")) + } + localVarFormParams.Add("number", parameterToString(*r.number, "")) + if r.float != nil { + localVarFormParams.Add("float", parameterToString(*r.float, "")) + } + localVarFormParams.Add("double", parameterToString(*r.double, "")) + if r.string_ != nil { + localVarFormParams.Add("string", parameterToString(*r.string_, "")) + } + localVarFormParams.Add("pattern_without_delimiter", parameterToString(*r.patternWithoutDelimiter, "")) + localVarFormParams.Add("byte", parameterToString(*r.byte_, "")) + localVarFormFileName = "binary" + var localVarFile *os.File + if r.binary != nil { + localVarFile = *r.binary + } + if localVarFile != nil { + fbs, _ := _ioutil.ReadAll(localVarFile) + localVarFileBytes = fbs + localVarFileName = localVarFile.Name() + localVarFile.Close() + } + if r.date != nil { + localVarFormParams.Add("date", parameterToString(*r.date, "")) + } + if r.dateTime != nil { + localVarFormParams.Add("dateTime", parameterToString(*r.dateTime, "")) + } + if r.password != nil { + localVarFormParams.Add("password", parameterToString(*r.password, "")) + } + if r.callback != nil { + localVarFormParams.Add("callback", parameterToString(*r.callback, "")) + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiTestEnumParametersRequest struct { + ctx _context.Context + apiService *FakeApiService + enumHeaderStringArray *[]string + enumHeaderString *string + enumQueryStringArray *[]string + enumQueryString *string + enumQueryInteger *int32 + enumQueryDouble *float64 + enumFormStringArray *[]string + enumFormString *string +} + +func (r apiTestEnumParametersRequest) EnumHeaderStringArray(enumHeaderStringArray []string) apiTestEnumParametersRequest { + r.enumHeaderStringArray = &enumHeaderStringArray + return r +} +func (r apiTestEnumParametersRequest) EnumHeaderString(enumHeaderString string) apiTestEnumParametersRequest { + r.enumHeaderString = &enumHeaderString + return r +} +func (r apiTestEnumParametersRequest) EnumQueryStringArray(enumQueryStringArray []string) apiTestEnumParametersRequest { + r.enumQueryStringArray = &enumQueryStringArray + return r +} +func (r apiTestEnumParametersRequest) EnumQueryString(enumQueryString string) apiTestEnumParametersRequest { + r.enumQueryString = &enumQueryString + return r +} +func (r apiTestEnumParametersRequest) EnumQueryInteger(enumQueryInteger int32) apiTestEnumParametersRequest { + r.enumQueryInteger = &enumQueryInteger + return r +} +func (r apiTestEnumParametersRequest) EnumQueryDouble(enumQueryDouble float64) apiTestEnumParametersRequest { + r.enumQueryDouble = &enumQueryDouble + return r +} +func (r apiTestEnumParametersRequest) EnumFormStringArray(enumFormStringArray []string) apiTestEnumParametersRequest { + r.enumFormStringArray = &enumFormStringArray + return r +} +func (r apiTestEnumParametersRequest) EnumFormString(enumFormString string) apiTestEnumParametersRequest { + r.enumFormString = &enumFormString + return r +} +/* +TestEnumParameters To test enum parameters +To test enum parameters + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestEnumParametersRequest +*/ +func (a *FakeApiService) TestEnumParameters(ctx _context.Context) apiTestEnumParametersRequest { + return apiTestEnumParametersRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestEnumParametersRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEnumParameters") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.enumQueryStringArray != nil { + localVarQueryParams.Add("enum_query_string_array", parameterToString(*r.enumQueryStringArray, "csv")) + } + if r.enumQueryString != nil { + localVarQueryParams.Add("enum_query_string", parameterToString(*r.enumQueryString, "")) + } + if r.enumQueryInteger != nil { + localVarQueryParams.Add("enum_query_integer", parameterToString(*r.enumQueryInteger, "")) + } + if r.enumQueryDouble != nil { + localVarQueryParams.Add("enum_query_double", parameterToString(*r.enumQueryDouble, "")) + } + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.enumHeaderStringArray != nil { + localVarHeaderParams["enum_header_string_array"] = parameterToString(*r.enumHeaderStringArray, "csv") + } + if r.enumHeaderString != nil { + localVarHeaderParams["enum_header_string"] = parameterToString(*r.enumHeaderString, "") + } + if r.enumFormStringArray != nil { + localVarFormParams.Add("enum_form_string_array", parameterToString(*r.enumFormStringArray, "csv")) + } + if r.enumFormString != nil { + localVarFormParams.Add("enum_form_string", parameterToString(*r.enumFormString, "")) + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiTestGroupParametersRequest struct { + ctx _context.Context + apiService *FakeApiService + requiredStringGroup *int32 + requiredBooleanGroup *bool + requiredInt64Group *int64 + stringGroup *int32 + booleanGroup *bool + int64Group *int64 +} + +func (r apiTestGroupParametersRequest) RequiredStringGroup(requiredStringGroup int32) apiTestGroupParametersRequest { + r.requiredStringGroup = &requiredStringGroup + return r +} +func (r apiTestGroupParametersRequest) RequiredBooleanGroup(requiredBooleanGroup bool) apiTestGroupParametersRequest { + r.requiredBooleanGroup = &requiredBooleanGroup + return r +} +func (r apiTestGroupParametersRequest) RequiredInt64Group(requiredInt64Group int64) apiTestGroupParametersRequest { + r.requiredInt64Group = &requiredInt64Group + return r +} +func (r apiTestGroupParametersRequest) StringGroup(stringGroup int32) apiTestGroupParametersRequest { + r.stringGroup = &stringGroup + return r +} +func (r apiTestGroupParametersRequest) BooleanGroup(booleanGroup bool) apiTestGroupParametersRequest { + r.booleanGroup = &booleanGroup + return r +} +func (r apiTestGroupParametersRequest) Int64Group(int64Group int64) apiTestGroupParametersRequest { + r.int64Group = &int64Group + return r +} +/* +TestGroupParameters Fake endpoint to test group parameters (optional) +Fake endpoint to test group parameters (optional) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestGroupParametersRequest +*/ +func (a *FakeApiService) TestGroupParameters(ctx _context.Context) apiTestGroupParametersRequest { + return apiTestGroupParametersRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestGroupParametersRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestGroupParameters") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.requiredStringGroup == nil { + return nil, reportError("requiredStringGroup is required and must be specified") + } + if r.requiredBooleanGroup == nil { + return nil, reportError("requiredBooleanGroup is required and must be specified") + } + if r.requiredInt64Group == nil { + return nil, reportError("requiredInt64Group is required and must be specified") + } + + localVarQueryParams.Add("required_string_group", parameterToString(*r.requiredStringGroup, "")) + localVarQueryParams.Add("required_int64_group", parameterToString(*r.requiredInt64Group, "")) + if r.stringGroup != nil { + localVarQueryParams.Add("string_group", parameterToString(*r.stringGroup, "")) + } + if r.int64Group != nil { + localVarQueryParams.Add("int64_group", parameterToString(*r.int64Group, "")) + } + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + localVarHeaderParams["required_boolean_group"] = parameterToString(*r.requiredBooleanGroup, "") + if r.booleanGroup != nil { + localVarHeaderParams["boolean_group"] = parameterToString(*r.booleanGroup, "") + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiTestInlineAdditionalPropertiesRequest struct { + ctx _context.Context + apiService *FakeApiService + param *map[string]string +} + +func (r apiTestInlineAdditionalPropertiesRequest) Param(param map[string]string) apiTestInlineAdditionalPropertiesRequest { + r.param = ¶m + return r +} +/* +TestInlineAdditionalProperties test inline additionalProperties + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestInlineAdditionalPropertiesRequest +*/ +func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context) apiTestInlineAdditionalPropertiesRequest { + return apiTestInlineAdditionalPropertiesRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestInlineAdditionalPropertiesRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestInlineAdditionalProperties") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/inline-additionalProperties" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.param == nil { + return nil, reportError("param is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.param + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiTestJsonFormDataRequest struct { + ctx _context.Context + apiService *FakeApiService + param *string + param2 *string +} + +func (r apiTestJsonFormDataRequest) Param(param string) apiTestJsonFormDataRequest { + r.param = ¶m + return r +} +func (r apiTestJsonFormDataRequest) Param2(param2 string) apiTestJsonFormDataRequest { + r.param2 = ¶m2 + return r +} +/* +TestJsonFormData test json serialization of form data + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestJsonFormDataRequest +*/ +func (a *FakeApiService) TestJsonFormData(ctx _context.Context) apiTestJsonFormDataRequest { + return apiTestJsonFormDataRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestJsonFormDataRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestJsonFormData") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/jsonFormData" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.param == nil { + return nil, reportError("param is required and must be specified") + } + if r.param2 == nil { + return nil, reportError("param2 is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + localVarFormParams.Add("param", parameterToString(*r.param, "")) + localVarFormParams.Add("param2", parameterToString(*r.param2, "")) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiTestQueryParameterCollectionFormatRequest struct { + ctx _context.Context + apiService *FakeApiService + pipe *[]string + ioutil *[]string + http *[]string + url *[]string + context *[]string +} + +func (r apiTestQueryParameterCollectionFormatRequest) Pipe(pipe []string) apiTestQueryParameterCollectionFormatRequest { + r.pipe = &pipe + return r +} +func (r apiTestQueryParameterCollectionFormatRequest) Ioutil(ioutil []string) apiTestQueryParameterCollectionFormatRequest { + r.ioutil = &ioutil + return r +} +func (r apiTestQueryParameterCollectionFormatRequest) Http(http []string) apiTestQueryParameterCollectionFormatRequest { + r.http = &http + return r +} +func (r apiTestQueryParameterCollectionFormatRequest) Url(url []string) apiTestQueryParameterCollectionFormatRequest { + r.url = &url + return r +} +func (r apiTestQueryParameterCollectionFormatRequest) Context(context []string) apiTestQueryParameterCollectionFormatRequest { + r.context = &context + return r +} +/* +TestQueryParameterCollectionFormat Method for TestQueryParameterCollectionFormat +To test the collection format in query parameters + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestQueryParameterCollectionFormatRequest +*/ +func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context) apiTestQueryParameterCollectionFormatRequest { + return apiTestQueryParameterCollectionFormatRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestQueryParameterCollectionFormatRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestQueryParameterCollectionFormat") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/test-query-paramters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pipe == nil { + return nil, reportError("pipe is required and must be specified") + } + if r.ioutil == nil { + return nil, reportError("ioutil is required and must be specified") + } + if r.http == nil { + return nil, reportError("http is required and must be specified") + } + if r.url == nil { + return nil, reportError("url is required and must be specified") + } + if r.context == nil { + return nil, reportError("context is required and must be specified") + } + + localVarQueryParams.Add("pipe", parameterToString(*r.pipe, "csv")) + localVarQueryParams.Add("ioutil", parameterToString(*r.ioutil, "csv")) + localVarQueryParams.Add("http", parameterToString(*r.http, "ssv")) + localVarQueryParams.Add("url", parameterToString(*r.url, "csv")) + { + t := *r.context + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("context", parameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("context", parameterToString(t, "multi")) + } + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/samples/client/petstore/go/go-petstore/petstore/api_fake_classname_tags123.go b/samples/client/petstore/go/go-petstore/petstore/api_fake_classname_tags123.go new file mode 100644 index 00000000000..85275b45138 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/api_fake_classname_tags123.go @@ -0,0 +1,145 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" +) + +// Linger please +var ( + _ _context.Context +) + +// FakeClassnameTags123ApiService FakeClassnameTags123Api service +type FakeClassnameTags123ApiService service + +type apiTestClassnameRequest struct { + ctx _context.Context + apiService *FakeClassnameTags123ApiService + body *Client +} + +func (r apiTestClassnameRequest) Body(body Client) apiTestClassnameRequest { + r.body = &body + return r +} +/* +TestClassname To test class name in snake case +To test class name in snake case + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestClassnameRequest +*/ +func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context) apiTestClassnameRequest { + return apiTestClassnameRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return Client +*/ +func (r apiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Client + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeClassnameTags123ApiService.TestClassname") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake_classname_test" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } + + // 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.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["api_key_query"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarQueryParams.Add("api_key_query", key) + } + } + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/client/petstore/go/go-petstore/petstore/api_pet.go b/samples/client/petstore/go/go-petstore/petstore/api_pet.go new file mode 100644 index 00000000000..65b9d66ad2b --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/api_pet.go @@ -0,0 +1,977 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + "os" +) + +// Linger please +var ( + _ _context.Context +) + +// PetApiService PetApi service +type PetApiService service + +type apiAddPetRequest struct { + ctx _context.Context + apiService *PetApiService + body *Pet +} + +func (r apiAddPetRequest) Body(body Pet) apiAddPetRequest { + r.body = &body + return r +} +/* +AddPet Add a new pet to the store + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiAddPetRequest +*/ +func (a *PetApiService) AddPet(ctx _context.Context) apiAddPetRequest { + return apiAddPetRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiAddPetRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.AddPet") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return nil, reportError("body is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json", "application/xml"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiDeletePetRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + apiKey *string +} + +func (r apiDeletePetRequest) ApiKey(apiKey string) apiDeletePetRequest { + r.apiKey = &apiKey + return r +} +/* +DeletePet Deletes a pet + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId Pet id to delete +@return apiDeletePetRequest +*/ +func (a *PetApiService) DeletePet(ctx _context.Context, petId int64) apiDeletePetRequest { + return apiDeletePetRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request +*/ +func (r apiDeletePetRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.DeletePet") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet/{petId}" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.PathEscape(parameterToString(r.petId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.apiKey != nil { + localVarHeaderParams["api_key"] = parameterToString(*r.apiKey, "") + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiFindPetsByStatusRequest struct { + ctx _context.Context + apiService *PetApiService + status *[]string +} + +func (r apiFindPetsByStatusRequest) Status(status []string) apiFindPetsByStatusRequest { + r.status = &status + return r +} +/* +FindPetsByStatus Finds Pets by status +Multiple status values can be provided with comma separated strings + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiFindPetsByStatusRequest +*/ +func (a *PetApiService) FindPetsByStatus(ctx _context.Context) apiFindPetsByStatusRequest { + return apiFindPetsByStatusRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return []Pet +*/ +func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []Pet + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByStatus") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet/findByStatus" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.status == nil { + return localVarReturnValue, nil, reportError("status is required and must be specified") + } + + localVarQueryParams.Add("status", parameterToString(*r.status, "csv")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/xml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiFindPetsByTagsRequest struct { + ctx _context.Context + apiService *PetApiService + tags *[]string +} + +func (r apiFindPetsByTagsRequest) Tags(tags []string) apiFindPetsByTagsRequest { + r.tags = &tags + return r +} +/* +FindPetsByTags Finds Pets by tags +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiFindPetsByTagsRequest +*/ +func (a *PetApiService) FindPetsByTags(ctx _context.Context) apiFindPetsByTagsRequest { + return apiFindPetsByTagsRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return []Pet +*/ +func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []Pet + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByTags") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet/findByTags" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.tags == nil { + return localVarReturnValue, nil, reportError("tags is required and must be specified") + } + + localVarQueryParams.Add("tags", parameterToString(*r.tags, "csv")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/xml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiGetPetByIdRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 +} + +/* +GetPetById Find pet by ID +Returns a single pet + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId ID of pet to return +@return apiGetPetByIdRequest +*/ +func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) apiGetPetByIdRequest { + return apiGetPetByIdRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request +@return Pet +*/ +func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Pet + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.GetPetById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet/{petId}" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.PathEscape(parameterToString(r.petId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"application/xml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["api_key"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["api_key"] = key + } + } + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiUpdatePetRequest struct { + ctx _context.Context + apiService *PetApiService + body *Pet +} + +func (r apiUpdatePetRequest) Body(body Pet) apiUpdatePetRequest { + r.body = &body + return r +} +/* +UpdatePet Update an existing pet + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiUpdatePetRequest +*/ +func (a *PetApiService) UpdatePet(ctx _context.Context) apiUpdatePetRequest { + return apiUpdatePetRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiUpdatePetRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePet") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return nil, reportError("body is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json", "application/xml"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiUpdatePetWithFormRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + name *string + status *string +} + +func (r apiUpdatePetWithFormRequest) Name(name string) apiUpdatePetWithFormRequest { + r.name = &name + return r +} +func (r apiUpdatePetWithFormRequest) Status(status string) apiUpdatePetWithFormRequest { + r.status = &status + return r +} +/* +UpdatePetWithForm Updates a pet in the store with form data + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId ID of pet that needs to be updated +@return apiUpdatePetWithFormRequest +*/ +func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64) apiUpdatePetWithFormRequest { + return apiUpdatePetWithFormRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request +*/ +func (r apiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePetWithForm") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet/{petId}" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.PathEscape(parameterToString(r.petId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.name != nil { + localVarFormParams.Add("name", parameterToString(*r.name, "")) + } + if r.status != nil { + localVarFormParams.Add("status", parameterToString(*r.status, "")) + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiUploadFileRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + additionalMetadata *string + file **os.File +} + +func (r apiUploadFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileRequest { + r.additionalMetadata = &additionalMetadata + return r +} +func (r apiUploadFileRequest) File(file *os.File) apiUploadFileRequest { + r.file = &file + return r +} +/* +UploadFile uploads an image + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId ID of pet to update +@return apiUploadFileRequest +*/ +func (a *PetApiService) UploadFile(ctx _context.Context, petId int64) apiUploadFileRequest { + return apiUploadFileRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request +@return ApiResponse +*/ +func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ApiResponse + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFile") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet/{petId}/uploadImage" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.PathEscape(parameterToString(r.petId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // 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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.additionalMetadata != nil { + localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, "")) + } + localVarFormFileName = "file" + var localVarFile *os.File + if r.file != nil { + localVarFile = *r.file + } + if localVarFile != nil { + fbs, _ := _ioutil.ReadAll(localVarFile) + localVarFileBytes = fbs + localVarFileName = localVarFile.Name() + localVarFile.Close() + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiUploadFileWithRequiredFileRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + requiredFile **os.File + additionalMetadata *string +} + +func (r apiUploadFileWithRequiredFileRequest) RequiredFile(requiredFile *os.File) apiUploadFileWithRequiredFileRequest { + r.requiredFile = &requiredFile + return r +} +func (r apiUploadFileWithRequiredFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileWithRequiredFileRequest { + r.additionalMetadata = &additionalMetadata + return r +} +/* +UploadFileWithRequiredFile uploads an image (required) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId ID of pet to update +@return apiUploadFileWithRequiredFileRequest +*/ +func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64) apiUploadFileWithRequiredFileRequest { + return apiUploadFileWithRequiredFileRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request +@return ApiResponse +*/ +func (r apiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ApiResponse + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFileWithRequiredFile") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/{petId}/uploadImageWithRequiredFile" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.PathEscape(parameterToString(r.petId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.requiredFile == nil { + return localVarReturnValue, nil, reportError("requiredFile 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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.additionalMetadata != nil { + localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, "")) + } + localVarFormFileName = "requiredFile" + localVarFile := *r.requiredFile + if localVarFile != nil { + fbs, _ := _ioutil.ReadAll(localVarFile) + localVarFileBytes = fbs + localVarFileName = localVarFile.Name() + localVarFile.Close() + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/client/petstore/go/go-petstore/petstore/api_store.go b/samples/client/petstore/go/go-petstore/petstore/api_store.go new file mode 100644 index 00000000000..7780395b95b --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/api_store.go @@ -0,0 +1,433 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// StoreApiService StoreApi service +type StoreApiService service + +type apiDeleteOrderRequest struct { + ctx _context.Context + apiService *StoreApiService + orderId string +} + +/* +DeleteOrder Delete purchase order by ID +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param orderId ID of the order that needs to be deleted +@return apiDeleteOrderRequest +*/ +func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) apiDeleteOrderRequest { + return apiDeleteOrderRequest{ + apiService: a, + ctx: ctx, + orderId: orderId, + } +} + +/* +Execute executes the request +*/ +func (r apiDeleteOrderRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.DeleteOrder") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/store/order/{order_id}" + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.PathEscape(parameterToString(r.orderId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiGetInventoryRequest struct { + ctx _context.Context + apiService *StoreApiService +} + +/* +GetInventory Returns pet inventories by status +Returns a map of status codes to quantities + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiGetInventoryRequest +*/ +func (a *StoreApiService) GetInventory(ctx _context.Context) apiGetInventoryRequest { + return apiGetInventoryRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return map[string]int32 +*/ +func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]int32 + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetInventory") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/store/inventory" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["api_key"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["api_key"] = key + } + } + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiGetOrderByIdRequest struct { + ctx _context.Context + apiService *StoreApiService + orderId int64 +} + +/* +GetOrderById Find purchase order by ID +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param orderId ID of pet that needs to be fetched +@return apiGetOrderByIdRequest +*/ +func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) apiGetOrderByIdRequest { + return apiGetOrderByIdRequest{ + apiService: a, + ctx: ctx, + orderId: orderId, + } +} + +/* +Execute executes the request +@return Order +*/ +func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Order + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetOrderById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/store/order/{order_id}" + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.PathEscape(parameterToString(r.orderId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.orderId < 1 { + return localVarReturnValue, nil, reportError("orderId must be greater than 1") + } + if r.orderId > 5 { + return localVarReturnValue, nil, reportError("orderId must be less than 5") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/xml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiPlaceOrderRequest struct { + ctx _context.Context + apiService *StoreApiService + body *Order +} + +func (r apiPlaceOrderRequest) Body(body Order) apiPlaceOrderRequest { + r.body = &body + return r +} +/* +PlaceOrder Place an order for a pet + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiPlaceOrderRequest +*/ +func (a *StoreApiService) PlaceOrder(ctx _context.Context) apiPlaceOrderRequest { + return apiPlaceOrderRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return Order +*/ +func (r apiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Order + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.PlaceOrder") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/store/order" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/xml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/client/petstore/go/go-petstore/petstore/api_user.go b/samples/client/petstore/go/go-petstore/petstore/api_user.go new file mode 100644 index 00000000000..6bee2f19b7e --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/api_user.go @@ -0,0 +1,786 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// UserApiService UserApi service +type UserApiService service + +type apiCreateUserRequest struct { + ctx _context.Context + apiService *UserApiService + body *User +} + +func (r apiCreateUserRequest) Body(body User) apiCreateUserRequest { + r.body = &body + return r +} +/* +CreateUser Create user +This can only be done by the logged in user. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiCreateUserRequest +*/ +func (a *UserApiService) CreateUser(ctx _context.Context) apiCreateUserRequest { + return apiCreateUserRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiCreateUserRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUser") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return nil, reportError("body is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiCreateUsersWithArrayInputRequest struct { + ctx _context.Context + apiService *UserApiService + body *[]User +} + +func (r apiCreateUsersWithArrayInputRequest) Body(body []User) apiCreateUsersWithArrayInputRequest { + r.body = &body + return r +} +/* +CreateUsersWithArrayInput Creates list of users with given input array + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiCreateUsersWithArrayInputRequest +*/ +func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context) apiCreateUsersWithArrayInputRequest { + return apiCreateUsersWithArrayInputRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithArrayInput") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/createWithArray" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return nil, reportError("body is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiCreateUsersWithListInputRequest struct { + ctx _context.Context + apiService *UserApiService + body *[]User +} + +func (r apiCreateUsersWithListInputRequest) Body(body []User) apiCreateUsersWithListInputRequest { + r.body = &body + return r +} +/* +CreateUsersWithListInput Creates list of users with given input array + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiCreateUsersWithListInputRequest +*/ +func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context) apiCreateUsersWithListInputRequest { + return apiCreateUsersWithListInputRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithListInput") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/createWithList" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return nil, reportError("body is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiDeleteUserRequest struct { + ctx _context.Context + apiService *UserApiService + username string +} + +/* +DeleteUser Delete user +This can only be done by the logged in user. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param username The name that needs to be deleted +@return apiDeleteUserRequest +*/ +func (a *UserApiService) DeleteUser(ctx _context.Context, username string) apiDeleteUserRequest { + return apiDeleteUserRequest{ + apiService: a, + ctx: ctx, + username: username, + } +} + +/* +Execute executes the request +*/ +func (r apiDeleteUserRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.DeleteUser") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.PathEscape(parameterToString(r.username, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiGetUserByNameRequest struct { + ctx _context.Context + apiService *UserApiService + username string +} + +/* +GetUserByName Get user by user name + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param username The name that needs to be fetched. Use user1 for testing. +@return apiGetUserByNameRequest +*/ +func (a *UserApiService) GetUserByName(ctx _context.Context, username string) apiGetUserByNameRequest { + return apiGetUserByNameRequest{ + apiService: a, + ctx: ctx, + username: username, + } +} + +/* +Execute executes the request +@return User +*/ +func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue User + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.GetUserByName") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.PathEscape(parameterToString(r.username, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"application/xml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiLoginUserRequest struct { + ctx _context.Context + apiService *UserApiService + username *string + password *string +} + +func (r apiLoginUserRequest) Username(username string) apiLoginUserRequest { + r.username = &username + return r +} +func (r apiLoginUserRequest) Password(password string) apiLoginUserRequest { + r.password = &password + return r +} +/* +LoginUser Logs user into the system + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiLoginUserRequest +*/ +func (a *UserApiService) LoginUser(ctx _context.Context) apiLoginUserRequest { + return apiLoginUserRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return string +*/ +func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue string + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LoginUser") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/login" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.username == nil { + return localVarReturnValue, nil, reportError("username is required and must be specified") + } + if r.password == nil { + return localVarReturnValue, nil, reportError("password is required and must be specified") + } + + localVarQueryParams.Add("username", parameterToString(*r.username, "")) + localVarQueryParams.Add("password", parameterToString(*r.password, "")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/xml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiLogoutUserRequest struct { + ctx _context.Context + apiService *UserApiService +} + +/* +LogoutUser Logs out current logged in user session + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiLogoutUserRequest +*/ +func (a *UserApiService) LogoutUser(ctx _context.Context) apiLogoutUserRequest { + return apiLogoutUserRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiLogoutUserRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LogoutUser") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/logout" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiUpdateUserRequest struct { + ctx _context.Context + apiService *UserApiService + username string + body *User +} + +func (r apiUpdateUserRequest) Body(body User) apiUpdateUserRequest { + r.body = &body + return r +} +/* +UpdateUser Updated user +This can only be done by the logged in user. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param username name that need to be deleted +@return apiUpdateUserRequest +*/ +func (a *UserApiService) UpdateUser(ctx _context.Context, username string) apiUpdateUserRequest { + return apiUpdateUserRequest{ + apiService: a, + ctx: ctx, + username: username, + } +} + +/* +Execute executes the request +*/ +func (r apiUpdateUserRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.UpdateUser") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.PathEscape(parameterToString(r.username, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return nil, reportError("body is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/samples/client/petstore/go/go-petstore/petstore/model_200_response.go b/samples/client/petstore/go/go-petstore/petstore/model_200_response.go new file mode 100644 index 00000000000..c23c13c54c2 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_200_response.go @@ -0,0 +1,150 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Model200Response Model for testing model name starting with number +type Model200Response struct { + Name *int32 `json:"name,omitempty"` + Class *string `json:"class,omitempty"` +} + +// NewModel200Response instantiates a new Model200Response 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 NewModel200Response() *Model200Response { + this := Model200Response{} + return &this +} + +// NewModel200ResponseWithDefaults instantiates a new Model200Response 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 NewModel200ResponseWithDefaults() *Model200Response { + this := Model200Response{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Model200Response) GetName() int32 { + if o == nil || o.Name == nil { + var ret int32 + 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 *Model200Response) GetNameOk() (*int32, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Model200Response) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given int32 and assigns it to the Name field. +func (o *Model200Response) SetName(v int32) { + o.Name = &v +} + +// GetClass returns the Class field value if set, zero value otherwise. +func (o *Model200Response) GetClass() string { + if o == nil || o.Class == nil { + var ret string + return ret + } + return *o.Class +} + +// GetClassOk returns a tuple with the Class field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Model200Response) GetClassOk() (*string, bool) { + if o == nil || o.Class == nil { + return nil, false + } + return o.Class, true +} + +// HasClass returns a boolean if a field has been set. +func (o *Model200Response) HasClass() bool { + if o != nil && o.Class != nil { + return true + } + + return false +} + +// SetClass gets a reference to the given string and assigns it to the Class field. +func (o *Model200Response) SetClass(v string) { + o.Class = &v +} + +func (o Model200Response) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Class != nil { + toSerialize["class"] = o.Class + } + return json.Marshal(toSerialize) +} + +type NullableModel200Response struct { + value *Model200Response + isSet bool +} + +func (v NullableModel200Response) Get() *Model200Response { + return v.value +} + +func (v *NullableModel200Response) Set(val *Model200Response) { + v.value = val + v.isSet = true +} + +func (v NullableModel200Response) IsSet() bool { + return v.isSet +} + +func (v *NullableModel200Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModel200Response(val *Model200Response) *NullableModel200Response { + return &NullableModel200Response{value: val, isSet: true} +} + +func (v NullableModel200Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModel200Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_any_type.go b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_any_type.go new file mode 100644 index 00000000000..a511ab6d5be --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_any_type.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// AdditionalPropertiesAnyType struct for AdditionalPropertiesAnyType +type AdditionalPropertiesAnyType struct { + Name *string `json:"name,omitempty"` +} + +// NewAdditionalPropertiesAnyType instantiates a new AdditionalPropertiesAnyType 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 NewAdditionalPropertiesAnyType() *AdditionalPropertiesAnyType { + this := AdditionalPropertiesAnyType{} + return &this +} + +// NewAdditionalPropertiesAnyTypeWithDefaults instantiates a new AdditionalPropertiesAnyType 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 NewAdditionalPropertiesAnyTypeWithDefaults() *AdditionalPropertiesAnyType { + this := AdditionalPropertiesAnyType{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *AdditionalPropertiesAnyType) GetName() string { + if o == nil || o.Name == nil { + 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 *AdditionalPropertiesAnyType) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *AdditionalPropertiesAnyType) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *AdditionalPropertiesAnyType) SetName(v string) { + o.Name = &v +} + +func (o AdditionalPropertiesAnyType) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + return json.Marshal(toSerialize) +} + +type NullableAdditionalPropertiesAnyType struct { + value *AdditionalPropertiesAnyType + isSet bool +} + +func (v NullableAdditionalPropertiesAnyType) Get() *AdditionalPropertiesAnyType { + return v.value +} + +func (v *NullableAdditionalPropertiesAnyType) Set(val *AdditionalPropertiesAnyType) { + v.value = val + v.isSet = true +} + +func (v NullableAdditionalPropertiesAnyType) IsSet() bool { + return v.isSet +} + +func (v *NullableAdditionalPropertiesAnyType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdditionalPropertiesAnyType(val *AdditionalPropertiesAnyType) *NullableAdditionalPropertiesAnyType { + return &NullableAdditionalPropertiesAnyType{value: val, isSet: true} +} + +func (v NullableAdditionalPropertiesAnyType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdditionalPropertiesAnyType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_array.go b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_array.go new file mode 100644 index 00000000000..7952e9cd56a --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_array.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// AdditionalPropertiesArray struct for AdditionalPropertiesArray +type AdditionalPropertiesArray struct { + Name *string `json:"name,omitempty"` +} + +// NewAdditionalPropertiesArray instantiates a new AdditionalPropertiesArray 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 NewAdditionalPropertiesArray() *AdditionalPropertiesArray { + this := AdditionalPropertiesArray{} + return &this +} + +// NewAdditionalPropertiesArrayWithDefaults instantiates a new AdditionalPropertiesArray 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 NewAdditionalPropertiesArrayWithDefaults() *AdditionalPropertiesArray { + this := AdditionalPropertiesArray{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *AdditionalPropertiesArray) GetName() string { + if o == nil || o.Name == nil { + 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 *AdditionalPropertiesArray) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *AdditionalPropertiesArray) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *AdditionalPropertiesArray) SetName(v string) { + o.Name = &v +} + +func (o AdditionalPropertiesArray) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + return json.Marshal(toSerialize) +} + +type NullableAdditionalPropertiesArray struct { + value *AdditionalPropertiesArray + isSet bool +} + +func (v NullableAdditionalPropertiesArray) Get() *AdditionalPropertiesArray { + return v.value +} + +func (v *NullableAdditionalPropertiesArray) Set(val *AdditionalPropertiesArray) { + v.value = val + v.isSet = true +} + +func (v NullableAdditionalPropertiesArray) IsSet() bool { + return v.isSet +} + +func (v *NullableAdditionalPropertiesArray) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdditionalPropertiesArray(val *AdditionalPropertiesArray) *NullableAdditionalPropertiesArray { + return &NullableAdditionalPropertiesArray{value: val, isSet: true} +} + +func (v NullableAdditionalPropertiesArray) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdditionalPropertiesArray) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_boolean.go b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_boolean.go new file mode 100644 index 00000000000..f64d9633a47 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_boolean.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// AdditionalPropertiesBoolean struct for AdditionalPropertiesBoolean +type AdditionalPropertiesBoolean struct { + Name *string `json:"name,omitempty"` +} + +// NewAdditionalPropertiesBoolean instantiates a new AdditionalPropertiesBoolean 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 NewAdditionalPropertiesBoolean() *AdditionalPropertiesBoolean { + this := AdditionalPropertiesBoolean{} + return &this +} + +// NewAdditionalPropertiesBooleanWithDefaults instantiates a new AdditionalPropertiesBoolean 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 NewAdditionalPropertiesBooleanWithDefaults() *AdditionalPropertiesBoolean { + this := AdditionalPropertiesBoolean{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *AdditionalPropertiesBoolean) GetName() string { + if o == nil || o.Name == nil { + 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 *AdditionalPropertiesBoolean) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *AdditionalPropertiesBoolean) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *AdditionalPropertiesBoolean) SetName(v string) { + o.Name = &v +} + +func (o AdditionalPropertiesBoolean) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + return json.Marshal(toSerialize) +} + +type NullableAdditionalPropertiesBoolean struct { + value *AdditionalPropertiesBoolean + isSet bool +} + +func (v NullableAdditionalPropertiesBoolean) Get() *AdditionalPropertiesBoolean { + return v.value +} + +func (v *NullableAdditionalPropertiesBoolean) Set(val *AdditionalPropertiesBoolean) { + v.value = val + v.isSet = true +} + +func (v NullableAdditionalPropertiesBoolean) IsSet() bool { + return v.isSet +} + +func (v *NullableAdditionalPropertiesBoolean) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdditionalPropertiesBoolean(val *AdditionalPropertiesBoolean) *NullableAdditionalPropertiesBoolean { + return &NullableAdditionalPropertiesBoolean{value: val, isSet: true} +} + +func (v NullableAdditionalPropertiesBoolean) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdditionalPropertiesBoolean) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_class.go b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_class.go new file mode 100644 index 00000000000..d60a6889b74 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_class.go @@ -0,0 +1,474 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// AdditionalPropertiesClass struct for AdditionalPropertiesClass +type AdditionalPropertiesClass struct { + MapString *map[string]string `json:"map_string,omitempty"` + MapNumber *map[string]float32 `json:"map_number,omitempty"` + MapInteger *map[string]int32 `json:"map_integer,omitempty"` + MapBoolean *map[string]bool `json:"map_boolean,omitempty"` + MapArrayInteger *map[string][]int32 `json:"map_array_integer,omitempty"` + MapArrayAnytype *map[string][]map[string]interface{} `json:"map_array_anytype,omitempty"` + MapMapString *map[string]map[string]string `json:"map_map_string,omitempty"` + MapMapAnytype *map[string]map[string]map[string]interface{} `json:"map_map_anytype,omitempty"` + Anytype1 *map[string]interface{} `json:"anytype_1,omitempty"` + Anytype2 *map[string]interface{} `json:"anytype_2,omitempty"` + Anytype3 *map[string]interface{} `json:"anytype_3,omitempty"` +} + +// NewAdditionalPropertiesClass instantiates a new AdditionalPropertiesClass 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 NewAdditionalPropertiesClass() *AdditionalPropertiesClass { + this := AdditionalPropertiesClass{} + return &this +} + +// NewAdditionalPropertiesClassWithDefaults instantiates a new AdditionalPropertiesClass 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 NewAdditionalPropertiesClassWithDefaults() *AdditionalPropertiesClass { + this := AdditionalPropertiesClass{} + return &this +} + +// GetMapString returns the MapString field value if set, zero value otherwise. +func (o *AdditionalPropertiesClass) GetMapString() map[string]string { + if o == nil || o.MapString == nil { + var ret map[string]string + return ret + } + return *o.MapString +} + +// GetMapStringOk returns a tuple with the MapString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdditionalPropertiesClass) GetMapStringOk() (*map[string]string, bool) { + if o == nil || o.MapString == nil { + return nil, false + } + return o.MapString, true +} + +// HasMapString returns a boolean if a field has been set. +func (o *AdditionalPropertiesClass) HasMapString() bool { + if o != nil && o.MapString != nil { + return true + } + + return false +} + +// SetMapString gets a reference to the given map[string]string and assigns it to the MapString field. +func (o *AdditionalPropertiesClass) SetMapString(v map[string]string) { + o.MapString = &v +} + +// GetMapNumber returns the MapNumber field value if set, zero value otherwise. +func (o *AdditionalPropertiesClass) GetMapNumber() map[string]float32 { + if o == nil || o.MapNumber == nil { + var ret map[string]float32 + return ret + } + return *o.MapNumber +} + +// GetMapNumberOk returns a tuple with the MapNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdditionalPropertiesClass) GetMapNumberOk() (*map[string]float32, bool) { + if o == nil || o.MapNumber == nil { + return nil, false + } + return o.MapNumber, true +} + +// HasMapNumber returns a boolean if a field has been set. +func (o *AdditionalPropertiesClass) HasMapNumber() bool { + if o != nil && o.MapNumber != nil { + return true + } + + return false +} + +// SetMapNumber gets a reference to the given map[string]float32 and assigns it to the MapNumber field. +func (o *AdditionalPropertiesClass) SetMapNumber(v map[string]float32) { + o.MapNumber = &v +} + +// GetMapInteger returns the MapInteger field value if set, zero value otherwise. +func (o *AdditionalPropertiesClass) GetMapInteger() map[string]int32 { + if o == nil || o.MapInteger == nil { + var ret map[string]int32 + return ret + } + return *o.MapInteger +} + +// GetMapIntegerOk returns a tuple with the MapInteger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdditionalPropertiesClass) GetMapIntegerOk() (*map[string]int32, bool) { + if o == nil || o.MapInteger == nil { + return nil, false + } + return o.MapInteger, true +} + +// HasMapInteger returns a boolean if a field has been set. +func (o *AdditionalPropertiesClass) HasMapInteger() bool { + if o != nil && o.MapInteger != nil { + return true + } + + return false +} + +// SetMapInteger gets a reference to the given map[string]int32 and assigns it to the MapInteger field. +func (o *AdditionalPropertiesClass) SetMapInteger(v map[string]int32) { + o.MapInteger = &v +} + +// GetMapBoolean returns the MapBoolean field value if set, zero value otherwise. +func (o *AdditionalPropertiesClass) GetMapBoolean() map[string]bool { + if o == nil || o.MapBoolean == nil { + var ret map[string]bool + return ret + } + return *o.MapBoolean +} + +// GetMapBooleanOk returns a tuple with the MapBoolean field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdditionalPropertiesClass) GetMapBooleanOk() (*map[string]bool, bool) { + if o == nil || o.MapBoolean == nil { + return nil, false + } + return o.MapBoolean, true +} + +// HasMapBoolean returns a boolean if a field has been set. +func (o *AdditionalPropertiesClass) HasMapBoolean() bool { + if o != nil && o.MapBoolean != nil { + return true + } + + return false +} + +// SetMapBoolean gets a reference to the given map[string]bool and assigns it to the MapBoolean field. +func (o *AdditionalPropertiesClass) SetMapBoolean(v map[string]bool) { + o.MapBoolean = &v +} + +// GetMapArrayInteger returns the MapArrayInteger field value if set, zero value otherwise. +func (o *AdditionalPropertiesClass) GetMapArrayInteger() map[string][]int32 { + if o == nil || o.MapArrayInteger == nil { + var ret map[string][]int32 + return ret + } + return *o.MapArrayInteger +} + +// GetMapArrayIntegerOk returns a tuple with the MapArrayInteger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdditionalPropertiesClass) GetMapArrayIntegerOk() (*map[string][]int32, bool) { + if o == nil || o.MapArrayInteger == nil { + return nil, false + } + return o.MapArrayInteger, true +} + +// HasMapArrayInteger returns a boolean if a field has been set. +func (o *AdditionalPropertiesClass) HasMapArrayInteger() bool { + if o != nil && o.MapArrayInteger != nil { + return true + } + + return false +} + +// SetMapArrayInteger gets a reference to the given map[string][]int32 and assigns it to the MapArrayInteger field. +func (o *AdditionalPropertiesClass) SetMapArrayInteger(v map[string][]int32) { + o.MapArrayInteger = &v +} + +// GetMapArrayAnytype returns the MapArrayAnytype field value if set, zero value otherwise. +func (o *AdditionalPropertiesClass) GetMapArrayAnytype() map[string][]map[string]interface{} { + if o == nil || o.MapArrayAnytype == nil { + var ret map[string][]map[string]interface{} + return ret + } + return *o.MapArrayAnytype +} + +// GetMapArrayAnytypeOk returns a tuple with the MapArrayAnytype field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdditionalPropertiesClass) GetMapArrayAnytypeOk() (*map[string][]map[string]interface{}, bool) { + if o == nil || o.MapArrayAnytype == nil { + return nil, false + } + return o.MapArrayAnytype, true +} + +// HasMapArrayAnytype returns a boolean if a field has been set. +func (o *AdditionalPropertiesClass) HasMapArrayAnytype() bool { + if o != nil && o.MapArrayAnytype != nil { + return true + } + + return false +} + +// SetMapArrayAnytype gets a reference to the given map[string][]map[string]interface{} and assigns it to the MapArrayAnytype field. +func (o *AdditionalPropertiesClass) SetMapArrayAnytype(v map[string][]map[string]interface{}) { + o.MapArrayAnytype = &v +} + +// GetMapMapString returns the MapMapString field value if set, zero value otherwise. +func (o *AdditionalPropertiesClass) GetMapMapString() map[string]map[string]string { + if o == nil || o.MapMapString == nil { + var ret map[string]map[string]string + return ret + } + return *o.MapMapString +} + +// GetMapMapStringOk returns a tuple with the MapMapString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdditionalPropertiesClass) GetMapMapStringOk() (*map[string]map[string]string, bool) { + if o == nil || o.MapMapString == nil { + return nil, false + } + return o.MapMapString, true +} + +// HasMapMapString returns a boolean if a field has been set. +func (o *AdditionalPropertiesClass) HasMapMapString() bool { + if o != nil && o.MapMapString != nil { + return true + } + + return false +} + +// SetMapMapString gets a reference to the given map[string]map[string]string and assigns it to the MapMapString field. +func (o *AdditionalPropertiesClass) SetMapMapString(v map[string]map[string]string) { + o.MapMapString = &v +} + +// GetMapMapAnytype returns the MapMapAnytype field value if set, zero value otherwise. +func (o *AdditionalPropertiesClass) GetMapMapAnytype() map[string]map[string]map[string]interface{} { + if o == nil || o.MapMapAnytype == nil { + var ret map[string]map[string]map[string]interface{} + return ret + } + return *o.MapMapAnytype +} + +// GetMapMapAnytypeOk returns a tuple with the MapMapAnytype field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdditionalPropertiesClass) GetMapMapAnytypeOk() (*map[string]map[string]map[string]interface{}, bool) { + if o == nil || o.MapMapAnytype == nil { + return nil, false + } + return o.MapMapAnytype, true +} + +// HasMapMapAnytype returns a boolean if a field has been set. +func (o *AdditionalPropertiesClass) HasMapMapAnytype() bool { + if o != nil && o.MapMapAnytype != nil { + return true + } + + return false +} + +// SetMapMapAnytype gets a reference to the given map[string]map[string]map[string]interface{} and assigns it to the MapMapAnytype field. +func (o *AdditionalPropertiesClass) SetMapMapAnytype(v map[string]map[string]map[string]interface{}) { + o.MapMapAnytype = &v +} + +// GetAnytype1 returns the Anytype1 field value if set, zero value otherwise. +func (o *AdditionalPropertiesClass) GetAnytype1() map[string]interface{} { + if o == nil || o.Anytype1 == nil { + var ret map[string]interface{} + return ret + } + return *o.Anytype1 +} + +// GetAnytype1Ok returns a tuple with the Anytype1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdditionalPropertiesClass) GetAnytype1Ok() (*map[string]interface{}, bool) { + if o == nil || o.Anytype1 == nil { + return nil, false + } + return o.Anytype1, true +} + +// HasAnytype1 returns a boolean if a field has been set. +func (o *AdditionalPropertiesClass) HasAnytype1() bool { + if o != nil && o.Anytype1 != nil { + return true + } + + return false +} + +// SetAnytype1 gets a reference to the given map[string]interface{} and assigns it to the Anytype1 field. +func (o *AdditionalPropertiesClass) SetAnytype1(v map[string]interface{}) { + o.Anytype1 = &v +} + +// GetAnytype2 returns the Anytype2 field value if set, zero value otherwise. +func (o *AdditionalPropertiesClass) GetAnytype2() map[string]interface{} { + if o == nil || o.Anytype2 == nil { + var ret map[string]interface{} + return ret + } + return *o.Anytype2 +} + +// GetAnytype2Ok returns a tuple with the Anytype2 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdditionalPropertiesClass) GetAnytype2Ok() (*map[string]interface{}, bool) { + if o == nil || o.Anytype2 == nil { + return nil, false + } + return o.Anytype2, true +} + +// HasAnytype2 returns a boolean if a field has been set. +func (o *AdditionalPropertiesClass) HasAnytype2() bool { + if o != nil && o.Anytype2 != nil { + return true + } + + return false +} + +// SetAnytype2 gets a reference to the given map[string]interface{} and assigns it to the Anytype2 field. +func (o *AdditionalPropertiesClass) SetAnytype2(v map[string]interface{}) { + o.Anytype2 = &v +} + +// GetAnytype3 returns the Anytype3 field value if set, zero value otherwise. +func (o *AdditionalPropertiesClass) GetAnytype3() map[string]interface{} { + if o == nil || o.Anytype3 == nil { + var ret map[string]interface{} + return ret + } + return *o.Anytype3 +} + +// GetAnytype3Ok returns a tuple with the Anytype3 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdditionalPropertiesClass) GetAnytype3Ok() (*map[string]interface{}, bool) { + if o == nil || o.Anytype3 == nil { + return nil, false + } + return o.Anytype3, true +} + +// HasAnytype3 returns a boolean if a field has been set. +func (o *AdditionalPropertiesClass) HasAnytype3() bool { + if o != nil && o.Anytype3 != nil { + return true + } + + return false +} + +// SetAnytype3 gets a reference to the given map[string]interface{} and assigns it to the Anytype3 field. +func (o *AdditionalPropertiesClass) SetAnytype3(v map[string]interface{}) { + o.Anytype3 = &v +} + +func (o AdditionalPropertiesClass) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.MapString != nil { + toSerialize["map_string"] = o.MapString + } + if o.MapNumber != nil { + toSerialize["map_number"] = o.MapNumber + } + if o.MapInteger != nil { + toSerialize["map_integer"] = o.MapInteger + } + if o.MapBoolean != nil { + toSerialize["map_boolean"] = o.MapBoolean + } + if o.MapArrayInteger != nil { + toSerialize["map_array_integer"] = o.MapArrayInteger + } + if o.MapArrayAnytype != nil { + toSerialize["map_array_anytype"] = o.MapArrayAnytype + } + if o.MapMapString != nil { + toSerialize["map_map_string"] = o.MapMapString + } + if o.MapMapAnytype != nil { + toSerialize["map_map_anytype"] = o.MapMapAnytype + } + if o.Anytype1 != nil { + toSerialize["anytype_1"] = o.Anytype1 + } + if o.Anytype2 != nil { + toSerialize["anytype_2"] = o.Anytype2 + } + if o.Anytype3 != nil { + toSerialize["anytype_3"] = o.Anytype3 + } + return json.Marshal(toSerialize) +} + +type NullableAdditionalPropertiesClass struct { + value *AdditionalPropertiesClass + isSet bool +} + +func (v NullableAdditionalPropertiesClass) Get() *AdditionalPropertiesClass { + return v.value +} + +func (v *NullableAdditionalPropertiesClass) Set(val *AdditionalPropertiesClass) { + v.value = val + v.isSet = true +} + +func (v NullableAdditionalPropertiesClass) IsSet() bool { + return v.isSet +} + +func (v *NullableAdditionalPropertiesClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdditionalPropertiesClass(val *AdditionalPropertiesClass) *NullableAdditionalPropertiesClass { + return &NullableAdditionalPropertiesClass{value: val, isSet: true} +} + +func (v NullableAdditionalPropertiesClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdditionalPropertiesClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_integer.go b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_integer.go new file mode 100644 index 00000000000..eeb60fc08db --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_integer.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// AdditionalPropertiesInteger struct for AdditionalPropertiesInteger +type AdditionalPropertiesInteger struct { + Name *string `json:"name,omitempty"` +} + +// NewAdditionalPropertiesInteger instantiates a new AdditionalPropertiesInteger 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 NewAdditionalPropertiesInteger() *AdditionalPropertiesInteger { + this := AdditionalPropertiesInteger{} + return &this +} + +// NewAdditionalPropertiesIntegerWithDefaults instantiates a new AdditionalPropertiesInteger 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 NewAdditionalPropertiesIntegerWithDefaults() *AdditionalPropertiesInteger { + this := AdditionalPropertiesInteger{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *AdditionalPropertiesInteger) GetName() string { + if o == nil || o.Name == nil { + 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 *AdditionalPropertiesInteger) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *AdditionalPropertiesInteger) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *AdditionalPropertiesInteger) SetName(v string) { + o.Name = &v +} + +func (o AdditionalPropertiesInteger) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + return json.Marshal(toSerialize) +} + +type NullableAdditionalPropertiesInteger struct { + value *AdditionalPropertiesInteger + isSet bool +} + +func (v NullableAdditionalPropertiesInteger) Get() *AdditionalPropertiesInteger { + return v.value +} + +func (v *NullableAdditionalPropertiesInteger) Set(val *AdditionalPropertiesInteger) { + v.value = val + v.isSet = true +} + +func (v NullableAdditionalPropertiesInteger) IsSet() bool { + return v.isSet +} + +func (v *NullableAdditionalPropertiesInteger) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdditionalPropertiesInteger(val *AdditionalPropertiesInteger) *NullableAdditionalPropertiesInteger { + return &NullableAdditionalPropertiesInteger{value: val, isSet: true} +} + +func (v NullableAdditionalPropertiesInteger) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdditionalPropertiesInteger) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_number.go b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_number.go new file mode 100644 index 00000000000..bd385cbe088 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_number.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// AdditionalPropertiesNumber struct for AdditionalPropertiesNumber +type AdditionalPropertiesNumber struct { + Name *string `json:"name,omitempty"` +} + +// NewAdditionalPropertiesNumber instantiates a new AdditionalPropertiesNumber 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 NewAdditionalPropertiesNumber() *AdditionalPropertiesNumber { + this := AdditionalPropertiesNumber{} + return &this +} + +// NewAdditionalPropertiesNumberWithDefaults instantiates a new AdditionalPropertiesNumber 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 NewAdditionalPropertiesNumberWithDefaults() *AdditionalPropertiesNumber { + this := AdditionalPropertiesNumber{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *AdditionalPropertiesNumber) GetName() string { + if o == nil || o.Name == nil { + 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 *AdditionalPropertiesNumber) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *AdditionalPropertiesNumber) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *AdditionalPropertiesNumber) SetName(v string) { + o.Name = &v +} + +func (o AdditionalPropertiesNumber) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + return json.Marshal(toSerialize) +} + +type NullableAdditionalPropertiesNumber struct { + value *AdditionalPropertiesNumber + isSet bool +} + +func (v NullableAdditionalPropertiesNumber) Get() *AdditionalPropertiesNumber { + return v.value +} + +func (v *NullableAdditionalPropertiesNumber) Set(val *AdditionalPropertiesNumber) { + v.value = val + v.isSet = true +} + +func (v NullableAdditionalPropertiesNumber) IsSet() bool { + return v.isSet +} + +func (v *NullableAdditionalPropertiesNumber) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdditionalPropertiesNumber(val *AdditionalPropertiesNumber) *NullableAdditionalPropertiesNumber { + return &NullableAdditionalPropertiesNumber{value: val, isSet: true} +} + +func (v NullableAdditionalPropertiesNumber) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdditionalPropertiesNumber) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_object.go b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_object.go new file mode 100644 index 00000000000..69fb5e31044 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_object.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// AdditionalPropertiesObject struct for AdditionalPropertiesObject +type AdditionalPropertiesObject struct { + Name *string `json:"name,omitempty"` +} + +// NewAdditionalPropertiesObject instantiates a new AdditionalPropertiesObject 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 NewAdditionalPropertiesObject() *AdditionalPropertiesObject { + this := AdditionalPropertiesObject{} + return &this +} + +// NewAdditionalPropertiesObjectWithDefaults instantiates a new AdditionalPropertiesObject 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 NewAdditionalPropertiesObjectWithDefaults() *AdditionalPropertiesObject { + this := AdditionalPropertiesObject{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *AdditionalPropertiesObject) GetName() string { + if o == nil || o.Name == nil { + 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 *AdditionalPropertiesObject) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *AdditionalPropertiesObject) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *AdditionalPropertiesObject) SetName(v string) { + o.Name = &v +} + +func (o AdditionalPropertiesObject) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + return json.Marshal(toSerialize) +} + +type NullableAdditionalPropertiesObject struct { + value *AdditionalPropertiesObject + isSet bool +} + +func (v NullableAdditionalPropertiesObject) Get() *AdditionalPropertiesObject { + return v.value +} + +func (v *NullableAdditionalPropertiesObject) Set(val *AdditionalPropertiesObject) { + v.value = val + v.isSet = true +} + +func (v NullableAdditionalPropertiesObject) IsSet() bool { + return v.isSet +} + +func (v *NullableAdditionalPropertiesObject) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdditionalPropertiesObject(val *AdditionalPropertiesObject) *NullableAdditionalPropertiesObject { + return &NullableAdditionalPropertiesObject{value: val, isSet: true} +} + +func (v NullableAdditionalPropertiesObject) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdditionalPropertiesObject) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_string.go b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_string.go new file mode 100644 index 00000000000..54928c3a1c9 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_additional_properties_string.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// AdditionalPropertiesString struct for AdditionalPropertiesString +type AdditionalPropertiesString struct { + Name *string `json:"name,omitempty"` +} + +// NewAdditionalPropertiesString instantiates a new AdditionalPropertiesString 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 NewAdditionalPropertiesString() *AdditionalPropertiesString { + this := AdditionalPropertiesString{} + return &this +} + +// NewAdditionalPropertiesStringWithDefaults instantiates a new AdditionalPropertiesString 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 NewAdditionalPropertiesStringWithDefaults() *AdditionalPropertiesString { + this := AdditionalPropertiesString{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *AdditionalPropertiesString) GetName() string { + if o == nil || o.Name == nil { + 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 *AdditionalPropertiesString) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *AdditionalPropertiesString) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *AdditionalPropertiesString) SetName(v string) { + o.Name = &v +} + +func (o AdditionalPropertiesString) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + return json.Marshal(toSerialize) +} + +type NullableAdditionalPropertiesString struct { + value *AdditionalPropertiesString + isSet bool +} + +func (v NullableAdditionalPropertiesString) Get() *AdditionalPropertiesString { + return v.value +} + +func (v *NullableAdditionalPropertiesString) Set(val *AdditionalPropertiesString) { + v.value = val + v.isSet = true +} + +func (v NullableAdditionalPropertiesString) IsSet() bool { + return v.isSet +} + +func (v *NullableAdditionalPropertiesString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdditionalPropertiesString(val *AdditionalPropertiesString) *NullableAdditionalPropertiesString { + return &NullableAdditionalPropertiesString{value: val, isSet: true} +} + +func (v NullableAdditionalPropertiesString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdditionalPropertiesString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_animal.go b/samples/client/petstore/go/go-petstore/petstore/model_animal.go new file mode 100644 index 00000000000..5aa1f60f02f --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_animal.go @@ -0,0 +1,147 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Animal struct for Animal +type Animal struct { + ClassName string `json:"className"` + Color *string `json:"color,omitempty"` +} + +// NewAnimal instantiates a new Animal 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 NewAnimal(className string, ) *Animal { + this := Animal{} + this.ClassName = className + var color string = "red" + this.Color = &color + return &this +} + +// NewAnimalWithDefaults instantiates a new Animal 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 NewAnimalWithDefaults() *Animal { + this := Animal{} + var color string = "red" + this.Color = &color + return &this +} + +// GetClassName returns the ClassName field value +func (o *Animal) GetClassName() string { + if o == nil { + var ret string + return ret + } + + return o.ClassName +} + +// GetClassNameOk returns a tuple with the ClassName field value +// and a boolean to check if the value has been set. +func (o *Animal) GetClassNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClassName, true +} + +// SetClassName sets field value +func (o *Animal) SetClassName(v string) { + o.ClassName = v +} + +// GetColor returns the Color field value if set, zero value otherwise. +func (o *Animal) GetColor() string { + if o == nil || o.Color == nil { + 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 *Animal) GetColorOk() (*string, bool) { + if o == nil || o.Color == nil { + return nil, false + } + return o.Color, true +} + +// HasColor returns a boolean if a field has been set. +func (o *Animal) HasColor() bool { + if o != nil && o.Color != nil { + return true + } + + return false +} + +// SetColor gets a reference to the given string and assigns it to the Color field. +func (o *Animal) SetColor(v string) { + o.Color = &v +} + +func (o Animal) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["className"] = o.ClassName + } + if o.Color != nil { + toSerialize["color"] = o.Color + } + return json.Marshal(toSerialize) +} + +type NullableAnimal struct { + value *Animal + isSet bool +} + +func (v NullableAnimal) Get() *Animal { + return v.value +} + +func (v *NullableAnimal) Set(val *Animal) { + v.value = val + v.isSet = true +} + +func (v NullableAnimal) IsSet() bool { + return v.isSet +} + +func (v *NullableAnimal) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAnimal(val *Animal) *NullableAnimal { + return &NullableAnimal{value: val, isSet: true} +} + +func (v NullableAnimal) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAnimal) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_api_response.go b/samples/client/petstore/go/go-petstore/petstore/model_api_response.go new file mode 100644 index 00000000000..17bf558d1c9 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_api_response.go @@ -0,0 +1,186 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ApiResponse struct for ApiResponse +type ApiResponse struct { + Code *int32 `json:"code,omitempty"` + Type *string `json:"type,omitempty"` + Message *string `json:"message,omitempty"` +} + +// NewApiResponse instantiates a new ApiResponse 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 NewApiResponse() *ApiResponse { + this := ApiResponse{} + return &this +} + +// NewApiResponseWithDefaults instantiates a new ApiResponse 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 NewApiResponseWithDefaults() *ApiResponse { + this := ApiResponse{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *ApiResponse) GetCode() int32 { + if o == nil || o.Code == nil { + var ret int32 + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponse) GetCodeOk() (*int32, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *ApiResponse) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given int32 and assigns it to the Code field. +func (o *ApiResponse) SetCode(v int32) { + o.Code = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ApiResponse) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponse) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ApiResponse) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *ApiResponse) SetType(v string) { + o.Type = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *ApiResponse) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponse) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *ApiResponse) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *ApiResponse) SetMessage(v string) { + o.Message = &v +} + +func (o ApiResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + return json.Marshal(toSerialize) +} + +type NullableApiResponse struct { + value *ApiResponse + isSet bool +} + +func (v NullableApiResponse) Get() *ApiResponse { + return v.value +} + +func (v *NullableApiResponse) Set(val *ApiResponse) { + v.value = val + v.isSet = true +} + +func (v NullableApiResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableApiResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApiResponse(val *ApiResponse) *NullableApiResponse { + return &NullableApiResponse{value: val, isSet: true} +} + +func (v NullableApiResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApiResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_array_of_array_of_number_only.go b/samples/client/petstore/go/go-petstore/petstore/model_array_of_array_of_number_only.go new file mode 100644 index 00000000000..6b81323ac4d --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_array_of_array_of_number_only.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ArrayOfArrayOfNumberOnly struct for ArrayOfArrayOfNumberOnly +type ArrayOfArrayOfNumberOnly struct { + ArrayArrayNumber *[][]float32 `json:"ArrayArrayNumber,omitempty"` +} + +// NewArrayOfArrayOfNumberOnly instantiates a new ArrayOfArrayOfNumberOnly 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 NewArrayOfArrayOfNumberOnly() *ArrayOfArrayOfNumberOnly { + this := ArrayOfArrayOfNumberOnly{} + return &this +} + +// NewArrayOfArrayOfNumberOnlyWithDefaults instantiates a new ArrayOfArrayOfNumberOnly 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 NewArrayOfArrayOfNumberOnlyWithDefaults() *ArrayOfArrayOfNumberOnly { + this := ArrayOfArrayOfNumberOnly{} + return &this +} + +// GetArrayArrayNumber returns the ArrayArrayNumber field value if set, zero value otherwise. +func (o *ArrayOfArrayOfNumberOnly) GetArrayArrayNumber() [][]float32 { + if o == nil || o.ArrayArrayNumber == nil { + var ret [][]float32 + return ret + } + return *o.ArrayArrayNumber +} + +// GetArrayArrayNumberOk returns a tuple with the ArrayArrayNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArrayOfArrayOfNumberOnly) GetArrayArrayNumberOk() (*[][]float32, bool) { + if o == nil || o.ArrayArrayNumber == nil { + return nil, false + } + return o.ArrayArrayNumber, true +} + +// HasArrayArrayNumber returns a boolean if a field has been set. +func (o *ArrayOfArrayOfNumberOnly) HasArrayArrayNumber() bool { + if o != nil && o.ArrayArrayNumber != nil { + return true + } + + return false +} + +// SetArrayArrayNumber gets a reference to the given [][]float32 and assigns it to the ArrayArrayNumber field. +func (o *ArrayOfArrayOfNumberOnly) SetArrayArrayNumber(v [][]float32) { + o.ArrayArrayNumber = &v +} + +func (o ArrayOfArrayOfNumberOnly) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ArrayArrayNumber != nil { + toSerialize["ArrayArrayNumber"] = o.ArrayArrayNumber + } + return json.Marshal(toSerialize) +} + +type NullableArrayOfArrayOfNumberOnly struct { + value *ArrayOfArrayOfNumberOnly + isSet bool +} + +func (v NullableArrayOfArrayOfNumberOnly) Get() *ArrayOfArrayOfNumberOnly { + return v.value +} + +func (v *NullableArrayOfArrayOfNumberOnly) Set(val *ArrayOfArrayOfNumberOnly) { + v.value = val + v.isSet = true +} + +func (v NullableArrayOfArrayOfNumberOnly) IsSet() bool { + return v.isSet +} + +func (v *NullableArrayOfArrayOfNumberOnly) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableArrayOfArrayOfNumberOnly(val *ArrayOfArrayOfNumberOnly) *NullableArrayOfArrayOfNumberOnly { + return &NullableArrayOfArrayOfNumberOnly{value: val, isSet: true} +} + +func (v NullableArrayOfArrayOfNumberOnly) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableArrayOfArrayOfNumberOnly) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_array_of_number_only.go b/samples/client/petstore/go/go-petstore/petstore/model_array_of_number_only.go new file mode 100644 index 00000000000..f43bffc1c87 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_array_of_number_only.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ArrayOfNumberOnly struct for ArrayOfNumberOnly +type ArrayOfNumberOnly struct { + ArrayNumber *[]float32 `json:"ArrayNumber,omitempty"` +} + +// NewArrayOfNumberOnly instantiates a new ArrayOfNumberOnly 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 NewArrayOfNumberOnly() *ArrayOfNumberOnly { + this := ArrayOfNumberOnly{} + return &this +} + +// NewArrayOfNumberOnlyWithDefaults instantiates a new ArrayOfNumberOnly 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 NewArrayOfNumberOnlyWithDefaults() *ArrayOfNumberOnly { + this := ArrayOfNumberOnly{} + return &this +} + +// GetArrayNumber returns the ArrayNumber field value if set, zero value otherwise. +func (o *ArrayOfNumberOnly) GetArrayNumber() []float32 { + if o == nil || o.ArrayNumber == nil { + var ret []float32 + return ret + } + return *o.ArrayNumber +} + +// GetArrayNumberOk returns a tuple with the ArrayNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArrayOfNumberOnly) GetArrayNumberOk() (*[]float32, bool) { + if o == nil || o.ArrayNumber == nil { + return nil, false + } + return o.ArrayNumber, true +} + +// HasArrayNumber returns a boolean if a field has been set. +func (o *ArrayOfNumberOnly) HasArrayNumber() bool { + if o != nil && o.ArrayNumber != nil { + return true + } + + return false +} + +// SetArrayNumber gets a reference to the given []float32 and assigns it to the ArrayNumber field. +func (o *ArrayOfNumberOnly) SetArrayNumber(v []float32) { + o.ArrayNumber = &v +} + +func (o ArrayOfNumberOnly) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ArrayNumber != nil { + toSerialize["ArrayNumber"] = o.ArrayNumber + } + return json.Marshal(toSerialize) +} + +type NullableArrayOfNumberOnly struct { + value *ArrayOfNumberOnly + isSet bool +} + +func (v NullableArrayOfNumberOnly) Get() *ArrayOfNumberOnly { + return v.value +} + +func (v *NullableArrayOfNumberOnly) Set(val *ArrayOfNumberOnly) { + v.value = val + v.isSet = true +} + +func (v NullableArrayOfNumberOnly) IsSet() bool { + return v.isSet +} + +func (v *NullableArrayOfNumberOnly) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableArrayOfNumberOnly(val *ArrayOfNumberOnly) *NullableArrayOfNumberOnly { + return &NullableArrayOfNumberOnly{value: val, isSet: true} +} + +func (v NullableArrayOfNumberOnly) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableArrayOfNumberOnly) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_array_test_.go b/samples/client/petstore/go/go-petstore/petstore/model_array_test_.go new file mode 100644 index 00000000000..42e2be66d62 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_array_test_.go @@ -0,0 +1,186 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ArrayTest struct for ArrayTest +type ArrayTest struct { + ArrayOfString *[]string `json:"array_of_string,omitempty"` + ArrayArrayOfInteger *[][]int64 `json:"array_array_of_integer,omitempty"` + ArrayArrayOfModel *[][]ReadOnlyFirst `json:"array_array_of_model,omitempty"` +} + +// NewArrayTest instantiates a new ArrayTest 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 NewArrayTest() *ArrayTest { + this := ArrayTest{} + return &this +} + +// NewArrayTestWithDefaults instantiates a new ArrayTest 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 NewArrayTestWithDefaults() *ArrayTest { + this := ArrayTest{} + return &this +} + +// GetArrayOfString returns the ArrayOfString field value if set, zero value otherwise. +func (o *ArrayTest) GetArrayOfString() []string { + if o == nil || o.ArrayOfString == nil { + var ret []string + return ret + } + return *o.ArrayOfString +} + +// GetArrayOfStringOk returns a tuple with the ArrayOfString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArrayTest) GetArrayOfStringOk() (*[]string, bool) { + if o == nil || o.ArrayOfString == nil { + return nil, false + } + return o.ArrayOfString, true +} + +// HasArrayOfString returns a boolean if a field has been set. +func (o *ArrayTest) HasArrayOfString() bool { + if o != nil && o.ArrayOfString != nil { + return true + } + + return false +} + +// SetArrayOfString gets a reference to the given []string and assigns it to the ArrayOfString field. +func (o *ArrayTest) SetArrayOfString(v []string) { + o.ArrayOfString = &v +} + +// GetArrayArrayOfInteger returns the ArrayArrayOfInteger field value if set, zero value otherwise. +func (o *ArrayTest) GetArrayArrayOfInteger() [][]int64 { + if o == nil || o.ArrayArrayOfInteger == nil { + var ret [][]int64 + return ret + } + return *o.ArrayArrayOfInteger +} + +// GetArrayArrayOfIntegerOk returns a tuple with the ArrayArrayOfInteger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArrayTest) GetArrayArrayOfIntegerOk() (*[][]int64, bool) { + if o == nil || o.ArrayArrayOfInteger == nil { + return nil, false + } + return o.ArrayArrayOfInteger, true +} + +// HasArrayArrayOfInteger returns a boolean if a field has been set. +func (o *ArrayTest) HasArrayArrayOfInteger() bool { + if o != nil && o.ArrayArrayOfInteger != nil { + return true + } + + return false +} + +// SetArrayArrayOfInteger gets a reference to the given [][]int64 and assigns it to the ArrayArrayOfInteger field. +func (o *ArrayTest) SetArrayArrayOfInteger(v [][]int64) { + o.ArrayArrayOfInteger = &v +} + +// GetArrayArrayOfModel returns the ArrayArrayOfModel field value if set, zero value otherwise. +func (o *ArrayTest) GetArrayArrayOfModel() [][]ReadOnlyFirst { + if o == nil || o.ArrayArrayOfModel == nil { + var ret [][]ReadOnlyFirst + return ret + } + return *o.ArrayArrayOfModel +} + +// GetArrayArrayOfModelOk returns a tuple with the ArrayArrayOfModel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArrayTest) GetArrayArrayOfModelOk() (*[][]ReadOnlyFirst, bool) { + if o == nil || o.ArrayArrayOfModel == nil { + return nil, false + } + return o.ArrayArrayOfModel, true +} + +// HasArrayArrayOfModel returns a boolean if a field has been set. +func (o *ArrayTest) HasArrayArrayOfModel() bool { + if o != nil && o.ArrayArrayOfModel != nil { + return true + } + + return false +} + +// SetArrayArrayOfModel gets a reference to the given [][]ReadOnlyFirst and assigns it to the ArrayArrayOfModel field. +func (o *ArrayTest) SetArrayArrayOfModel(v [][]ReadOnlyFirst) { + o.ArrayArrayOfModel = &v +} + +func (o ArrayTest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ArrayOfString != nil { + toSerialize["array_of_string"] = o.ArrayOfString + } + if o.ArrayArrayOfInteger != nil { + toSerialize["array_array_of_integer"] = o.ArrayArrayOfInteger + } + if o.ArrayArrayOfModel != nil { + toSerialize["array_array_of_model"] = o.ArrayArrayOfModel + } + return json.Marshal(toSerialize) +} + +type NullableArrayTest struct { + value *ArrayTest + isSet bool +} + +func (v NullableArrayTest) Get() *ArrayTest { + return v.value +} + +func (v *NullableArrayTest) Set(val *ArrayTest) { + v.value = val + v.isSet = true +} + +func (v NullableArrayTest) IsSet() bool { + return v.isSet +} + +func (v *NullableArrayTest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableArrayTest(val *ArrayTest) *NullableArrayTest { + return &NullableArrayTest{value: val, isSet: true} +} + +func (v NullableArrayTest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableArrayTest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_big_cat.go b/samples/client/petstore/go/go-petstore/petstore/model_big_cat.go new file mode 100644 index 00000000000..27b8085b241 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_big_cat.go @@ -0,0 +1,123 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// BigCat struct for BigCat +type BigCat struct { + Cat + Kind *string `json:"kind,omitempty"` +} + +// NewBigCat instantiates a new BigCat 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 NewBigCat() *BigCat { + this := BigCat{} + return &this +} + +// NewBigCatWithDefaults instantiates a new BigCat 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 NewBigCatWithDefaults() *BigCat { + this := BigCat{} + return &this +} + +// GetKind returns the Kind field value if set, zero value otherwise. +func (o *BigCat) GetKind() string { + if o == nil || o.Kind == nil { + var ret string + return ret + } + return *o.Kind +} + +// GetKindOk returns a tuple with the Kind field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BigCat) GetKindOk() (*string, bool) { + if o == nil || o.Kind == nil { + return nil, false + } + return o.Kind, true +} + +// HasKind returns a boolean if a field has been set. +func (o *BigCat) HasKind() bool { + if o != nil && o.Kind != nil { + return true + } + + return false +} + +// SetKind gets a reference to the given string and assigns it to the Kind field. +func (o *BigCat) SetKind(v string) { + o.Kind = &v +} + +func (o BigCat) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + serializedCat, errCat := json.Marshal(o.Cat) + if errCat != nil { + return []byte{}, errCat + } + errCat = json.Unmarshal([]byte(serializedCat), &toSerialize) + if errCat != nil { + return []byte{}, errCat + } + if o.Kind != nil { + toSerialize["kind"] = o.Kind + } + return json.Marshal(toSerialize) +} + +type NullableBigCat struct { + value *BigCat + isSet bool +} + +func (v NullableBigCat) Get() *BigCat { + return v.value +} + +func (v *NullableBigCat) Set(val *BigCat) { + v.value = val + v.isSet = true +} + +func (v NullableBigCat) IsSet() bool { + return v.isSet +} + +func (v *NullableBigCat) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBigCat(val *BigCat) *NullableBigCat { + return &NullableBigCat{value: val, isSet: true} +} + +func (v NullableBigCat) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBigCat) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_big_cat_all_of.go b/samples/client/petstore/go/go-petstore/petstore/model_big_cat_all_of.go new file mode 100644 index 00000000000..6434cd11d7c --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_big_cat_all_of.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// BigCatAllOf struct for BigCatAllOf +type BigCatAllOf struct { + Kind *string `json:"kind,omitempty"` +} + +// NewBigCatAllOf instantiates a new BigCatAllOf 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 NewBigCatAllOf() *BigCatAllOf { + this := BigCatAllOf{} + return &this +} + +// NewBigCatAllOfWithDefaults instantiates a new BigCatAllOf 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 NewBigCatAllOfWithDefaults() *BigCatAllOf { + this := BigCatAllOf{} + return &this +} + +// GetKind returns the Kind field value if set, zero value otherwise. +func (o *BigCatAllOf) GetKind() string { + if o == nil || o.Kind == nil { + var ret string + return ret + } + return *o.Kind +} + +// GetKindOk returns a tuple with the Kind field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BigCatAllOf) GetKindOk() (*string, bool) { + if o == nil || o.Kind == nil { + return nil, false + } + return o.Kind, true +} + +// HasKind returns a boolean if a field has been set. +func (o *BigCatAllOf) HasKind() bool { + if o != nil && o.Kind != nil { + return true + } + + return false +} + +// SetKind gets a reference to the given string and assigns it to the Kind field. +func (o *BigCatAllOf) SetKind(v string) { + o.Kind = &v +} + +func (o BigCatAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Kind != nil { + toSerialize["kind"] = o.Kind + } + return json.Marshal(toSerialize) +} + +type NullableBigCatAllOf struct { + value *BigCatAllOf + isSet bool +} + +func (v NullableBigCatAllOf) Get() *BigCatAllOf { + return v.value +} + +func (v *NullableBigCatAllOf) Set(val *BigCatAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableBigCatAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableBigCatAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBigCatAllOf(val *BigCatAllOf) *NullableBigCatAllOf { + return &NullableBigCatAllOf{value: val, isSet: true} +} + +func (v NullableBigCatAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBigCatAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_capitalization.go b/samples/client/petstore/go/go-petstore/petstore/model_capitalization.go new file mode 100644 index 00000000000..7f2c90863e0 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_capitalization.go @@ -0,0 +1,295 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Capitalization struct for Capitalization +type Capitalization struct { + SmallCamel *string `json:"smallCamel,omitempty"` + CapitalCamel *string `json:"CapitalCamel,omitempty"` + SmallSnake *string `json:"small_Snake,omitempty"` + CapitalSnake *string `json:"Capital_Snake,omitempty"` + SCAETHFlowPoints *string `json:"SCA_ETH_Flow_Points,omitempty"` + // Name of the pet + ATT_NAME *string `json:"ATT_NAME,omitempty"` +} + +// NewCapitalization instantiates a new Capitalization 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 NewCapitalization() *Capitalization { + this := Capitalization{} + return &this +} + +// NewCapitalizationWithDefaults instantiates a new Capitalization 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 NewCapitalizationWithDefaults() *Capitalization { + this := Capitalization{} + return &this +} + +// GetSmallCamel returns the SmallCamel field value if set, zero value otherwise. +func (o *Capitalization) GetSmallCamel() string { + if o == nil || o.SmallCamel == nil { + var ret string + return ret + } + return *o.SmallCamel +} + +// GetSmallCamelOk returns a tuple with the SmallCamel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Capitalization) GetSmallCamelOk() (*string, bool) { + if o == nil || o.SmallCamel == nil { + return nil, false + } + return o.SmallCamel, true +} + +// HasSmallCamel returns a boolean if a field has been set. +func (o *Capitalization) HasSmallCamel() bool { + if o != nil && o.SmallCamel != nil { + return true + } + + return false +} + +// SetSmallCamel gets a reference to the given string and assigns it to the SmallCamel field. +func (o *Capitalization) SetSmallCamel(v string) { + o.SmallCamel = &v +} + +// GetCapitalCamel returns the CapitalCamel field value if set, zero value otherwise. +func (o *Capitalization) GetCapitalCamel() string { + if o == nil || o.CapitalCamel == nil { + var ret string + return ret + } + return *o.CapitalCamel +} + +// GetCapitalCamelOk returns a tuple with the CapitalCamel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Capitalization) GetCapitalCamelOk() (*string, bool) { + if o == nil || o.CapitalCamel == nil { + return nil, false + } + return o.CapitalCamel, true +} + +// HasCapitalCamel returns a boolean if a field has been set. +func (o *Capitalization) HasCapitalCamel() bool { + if o != nil && o.CapitalCamel != nil { + return true + } + + return false +} + +// SetCapitalCamel gets a reference to the given string and assigns it to the CapitalCamel field. +func (o *Capitalization) SetCapitalCamel(v string) { + o.CapitalCamel = &v +} + +// GetSmallSnake returns the SmallSnake field value if set, zero value otherwise. +func (o *Capitalization) GetSmallSnake() string { + if o == nil || o.SmallSnake == nil { + var ret string + return ret + } + return *o.SmallSnake +} + +// GetSmallSnakeOk returns a tuple with the SmallSnake field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Capitalization) GetSmallSnakeOk() (*string, bool) { + if o == nil || o.SmallSnake == nil { + return nil, false + } + return o.SmallSnake, true +} + +// HasSmallSnake returns a boolean if a field has been set. +func (o *Capitalization) HasSmallSnake() bool { + if o != nil && o.SmallSnake != nil { + return true + } + + return false +} + +// SetSmallSnake gets a reference to the given string and assigns it to the SmallSnake field. +func (o *Capitalization) SetSmallSnake(v string) { + o.SmallSnake = &v +} + +// GetCapitalSnake returns the CapitalSnake field value if set, zero value otherwise. +func (o *Capitalization) GetCapitalSnake() string { + if o == nil || o.CapitalSnake == nil { + var ret string + return ret + } + return *o.CapitalSnake +} + +// GetCapitalSnakeOk returns a tuple with the CapitalSnake field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Capitalization) GetCapitalSnakeOk() (*string, bool) { + if o == nil || o.CapitalSnake == nil { + return nil, false + } + return o.CapitalSnake, true +} + +// HasCapitalSnake returns a boolean if a field has been set. +func (o *Capitalization) HasCapitalSnake() bool { + if o != nil && o.CapitalSnake != nil { + return true + } + + return false +} + +// SetCapitalSnake gets a reference to the given string and assigns it to the CapitalSnake field. +func (o *Capitalization) SetCapitalSnake(v string) { + o.CapitalSnake = &v +} + +// GetSCAETHFlowPoints returns the SCAETHFlowPoints field value if set, zero value otherwise. +func (o *Capitalization) GetSCAETHFlowPoints() string { + if o == nil || o.SCAETHFlowPoints == nil { + var ret string + return ret + } + return *o.SCAETHFlowPoints +} + +// GetSCAETHFlowPointsOk returns a tuple with the SCAETHFlowPoints field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Capitalization) GetSCAETHFlowPointsOk() (*string, bool) { + if o == nil || o.SCAETHFlowPoints == nil { + return nil, false + } + return o.SCAETHFlowPoints, true +} + +// HasSCAETHFlowPoints returns a boolean if a field has been set. +func (o *Capitalization) HasSCAETHFlowPoints() bool { + if o != nil && o.SCAETHFlowPoints != nil { + return true + } + + return false +} + +// SetSCAETHFlowPoints gets a reference to the given string and assigns it to the SCAETHFlowPoints field. +func (o *Capitalization) SetSCAETHFlowPoints(v string) { + o.SCAETHFlowPoints = &v +} + +// GetATT_NAME returns the ATT_NAME field value if set, zero value otherwise. +func (o *Capitalization) GetATT_NAME() string { + if o == nil || o.ATT_NAME == nil { + var ret string + return ret + } + return *o.ATT_NAME +} + +// GetATT_NAMEOk returns a tuple with the ATT_NAME field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Capitalization) GetATT_NAMEOk() (*string, bool) { + if o == nil || o.ATT_NAME == nil { + return nil, false + } + return o.ATT_NAME, true +} + +// HasATT_NAME returns a boolean if a field has been set. +func (o *Capitalization) HasATT_NAME() bool { + if o != nil && o.ATT_NAME != nil { + return true + } + + return false +} + +// SetATT_NAME gets a reference to the given string and assigns it to the ATT_NAME field. +func (o *Capitalization) SetATT_NAME(v string) { + o.ATT_NAME = &v +} + +func (o Capitalization) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.SmallCamel != nil { + toSerialize["smallCamel"] = o.SmallCamel + } + if o.CapitalCamel != nil { + toSerialize["CapitalCamel"] = o.CapitalCamel + } + if o.SmallSnake != nil { + toSerialize["small_Snake"] = o.SmallSnake + } + if o.CapitalSnake != nil { + toSerialize["Capital_Snake"] = o.CapitalSnake + } + if o.SCAETHFlowPoints != nil { + toSerialize["SCA_ETH_Flow_Points"] = o.SCAETHFlowPoints + } + if o.ATT_NAME != nil { + toSerialize["ATT_NAME"] = o.ATT_NAME + } + return json.Marshal(toSerialize) +} + +type NullableCapitalization struct { + value *Capitalization + isSet bool +} + +func (v NullableCapitalization) Get() *Capitalization { + return v.value +} + +func (v *NullableCapitalization) Set(val *Capitalization) { + v.value = val + v.isSet = true +} + +func (v NullableCapitalization) IsSet() bool { + return v.isSet +} + +func (v *NullableCapitalization) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCapitalization(val *Capitalization) *NullableCapitalization { + return &NullableCapitalization{value: val, isSet: true} +} + +func (v NullableCapitalization) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCapitalization) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_cat.go b/samples/client/petstore/go/go-petstore/petstore/model_cat.go new file mode 100644 index 00000000000..d6573c99bac --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_cat.go @@ -0,0 +1,123 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Cat struct for Cat +type Cat struct { + Animal + Declawed *bool `json:"declawed,omitempty"` +} + +// NewCat instantiates a new Cat 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 NewCat() *Cat { + this := Cat{} + return &this +} + +// NewCatWithDefaults instantiates a new Cat 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 NewCatWithDefaults() *Cat { + this := Cat{} + return &this +} + +// GetDeclawed returns the Declawed field value if set, zero value otherwise. +func (o *Cat) GetDeclawed() bool { + if o == nil || o.Declawed == nil { + var ret bool + return ret + } + return *o.Declawed +} + +// GetDeclawedOk returns a tuple with the Declawed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Cat) GetDeclawedOk() (*bool, bool) { + if o == nil || o.Declawed == nil { + return nil, false + } + return o.Declawed, true +} + +// HasDeclawed returns a boolean if a field has been set. +func (o *Cat) HasDeclawed() bool { + if o != nil && o.Declawed != nil { + return true + } + + return false +} + +// SetDeclawed gets a reference to the given bool and assigns it to the Declawed field. +func (o *Cat) SetDeclawed(v bool) { + o.Declawed = &v +} + +func (o Cat) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + serializedAnimal, errAnimal := json.Marshal(o.Animal) + if errAnimal != nil { + return []byte{}, errAnimal + } + errAnimal = json.Unmarshal([]byte(serializedAnimal), &toSerialize) + if errAnimal != nil { + return []byte{}, errAnimal + } + if o.Declawed != nil { + toSerialize["declawed"] = o.Declawed + } + return json.Marshal(toSerialize) +} + +type NullableCat struct { + value *Cat + isSet bool +} + +func (v NullableCat) Get() *Cat { + return v.value +} + +func (v *NullableCat) Set(val *Cat) { + v.value = val + v.isSet = true +} + +func (v NullableCat) IsSet() bool { + return v.isSet +} + +func (v *NullableCat) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCat(val *Cat) *NullableCat { + return &NullableCat{value: val, isSet: true} +} + +func (v NullableCat) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCat) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_cat_all_of.go b/samples/client/petstore/go/go-petstore/petstore/model_cat_all_of.go new file mode 100644 index 00000000000..643ba03973f --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_cat_all_of.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// CatAllOf struct for CatAllOf +type CatAllOf struct { + Declawed *bool `json:"declawed,omitempty"` +} + +// NewCatAllOf instantiates a new CatAllOf 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 NewCatAllOf() *CatAllOf { + this := CatAllOf{} + return &this +} + +// NewCatAllOfWithDefaults instantiates a new CatAllOf 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 NewCatAllOfWithDefaults() *CatAllOf { + this := CatAllOf{} + return &this +} + +// GetDeclawed returns the Declawed field value if set, zero value otherwise. +func (o *CatAllOf) GetDeclawed() bool { + if o == nil || o.Declawed == nil { + var ret bool + return ret + } + return *o.Declawed +} + +// GetDeclawedOk returns a tuple with the Declawed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatAllOf) GetDeclawedOk() (*bool, bool) { + if o == nil || o.Declawed == nil { + return nil, false + } + return o.Declawed, true +} + +// HasDeclawed returns a boolean if a field has been set. +func (o *CatAllOf) HasDeclawed() bool { + if o != nil && o.Declawed != nil { + return true + } + + return false +} + +// SetDeclawed gets a reference to the given bool and assigns it to the Declawed field. +func (o *CatAllOf) SetDeclawed(v bool) { + o.Declawed = &v +} + +func (o CatAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Declawed != nil { + toSerialize["declawed"] = o.Declawed + } + return json.Marshal(toSerialize) +} + +type NullableCatAllOf struct { + value *CatAllOf + isSet bool +} + +func (v NullableCatAllOf) Get() *CatAllOf { + return v.value +} + +func (v *NullableCatAllOf) Set(val *CatAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableCatAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableCatAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCatAllOf(val *CatAllOf) *NullableCatAllOf { + return &NullableCatAllOf{value: val, isSet: true} +} + +func (v NullableCatAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCatAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_category.go b/samples/client/petstore/go/go-petstore/petstore/model_category.go new file mode 100644 index 00000000000..0c462889533 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_category.go @@ -0,0 +1,145 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Category struct for Category +type Category struct { + Id *int64 `json:"id,omitempty"` + Name string `json:"name"` +} + +// 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(name string, ) *Category { + this := Category{} + this.Name = name + 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{} + var name string = "default-name" + this.Name = name + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Category) GetId() int64 { + if o == nil || o.Id == nil { + 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 || o.Id == nil { + 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 && o.Id != nil { + 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 +func (o *Category) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Category) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Category) SetName(v string) { + o.Name = v +} + +func (o Category) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if true { + toSerialize["name"] = o.Name + } + return json.Marshal(toSerialize) +} + +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) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_class_model.go b/samples/client/petstore/go/go-petstore/petstore/model_class_model.go new file mode 100644 index 00000000000..7236de0ee07 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_class_model.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ClassModel Model for testing model with \"_class\" property +type ClassModel struct { + Class *string `json:"_class,omitempty"` +} + +// NewClassModel instantiates a new ClassModel 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 NewClassModel() *ClassModel { + this := ClassModel{} + return &this +} + +// NewClassModelWithDefaults instantiates a new ClassModel 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 NewClassModelWithDefaults() *ClassModel { + this := ClassModel{} + return &this +} + +// GetClass returns the Class field value if set, zero value otherwise. +func (o *ClassModel) GetClass() string { + if o == nil || o.Class == nil { + var ret string + return ret + } + return *o.Class +} + +// GetClassOk returns a tuple with the Class field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ClassModel) GetClassOk() (*string, bool) { + if o == nil || o.Class == nil { + return nil, false + } + return o.Class, true +} + +// HasClass returns a boolean if a field has been set. +func (o *ClassModel) HasClass() bool { + if o != nil && o.Class != nil { + return true + } + + return false +} + +// SetClass gets a reference to the given string and assigns it to the Class field. +func (o *ClassModel) SetClass(v string) { + o.Class = &v +} + +func (o ClassModel) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Class != nil { + toSerialize["_class"] = o.Class + } + return json.Marshal(toSerialize) +} + +type NullableClassModel struct { + value *ClassModel + isSet bool +} + +func (v NullableClassModel) Get() *ClassModel { + return v.value +} + +func (v *NullableClassModel) Set(val *ClassModel) { + v.value = val + v.isSet = true +} + +func (v NullableClassModel) IsSet() bool { + return v.isSet +} + +func (v *NullableClassModel) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClassModel(val *ClassModel) *NullableClassModel { + return &NullableClassModel{value: val, isSet: true} +} + +func (v NullableClassModel) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClassModel) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_client.go b/samples/client/petstore/go/go-petstore/petstore/model_client.go new file mode 100644 index 00000000000..edfdde067ef --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_client.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Client struct for Client +type Client struct { + Client *string `json:"client,omitempty"` +} + +// NewClient instantiates a new Client 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 NewClient() *Client { + this := Client{} + return &this +} + +// NewClientWithDefaults instantiates a new Client 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 NewClientWithDefaults() *Client { + this := Client{} + return &this +} + +// GetClient returns the Client field value if set, zero value otherwise. +func (o *Client) GetClient() string { + if o == nil || o.Client == nil { + var ret string + return ret + } + return *o.Client +} + +// GetClientOk returns a tuple with the Client field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Client) GetClientOk() (*string, bool) { + if o == nil || o.Client == nil { + return nil, false + } + return o.Client, true +} + +// HasClient returns a boolean if a field has been set. +func (o *Client) HasClient() bool { + if o != nil && o.Client != nil { + return true + } + + return false +} + +// SetClient gets a reference to the given string and assigns it to the Client field. +func (o *Client) SetClient(v string) { + o.Client = &v +} + +func (o Client) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Client != nil { + toSerialize["client"] = o.Client + } + return json.Marshal(toSerialize) +} + +type NullableClient struct { + value *Client + isSet bool +} + +func (v NullableClient) Get() *Client { + return v.value +} + +func (v *NullableClient) Set(val *Client) { + v.value = val + v.isSet = true +} + +func (v NullableClient) IsSet() bool { + return v.isSet +} + +func (v *NullableClient) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClient(val *Client) *NullableClient { + return &NullableClient{value: val, isSet: true} +} + +func (v NullableClient) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClient) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_dog.go b/samples/client/petstore/go/go-petstore/petstore/model_dog.go new file mode 100644 index 00000000000..ebbedeec53e --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_dog.go @@ -0,0 +1,123 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Dog struct for Dog +type Dog struct { + Animal + Breed *string `json:"breed,omitempty"` +} + +// NewDog instantiates a new Dog 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 NewDog() *Dog { + this := Dog{} + return &this +} + +// NewDogWithDefaults instantiates a new Dog 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 NewDogWithDefaults() *Dog { + this := Dog{} + return &this +} + +// GetBreed returns the Breed field value if set, zero value otherwise. +func (o *Dog) GetBreed() string { + if o == nil || o.Breed == nil { + var ret string + return ret + } + return *o.Breed +} + +// GetBreedOk returns a tuple with the Breed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dog) GetBreedOk() (*string, bool) { + if o == nil || o.Breed == nil { + return nil, false + } + return o.Breed, true +} + +// HasBreed returns a boolean if a field has been set. +func (o *Dog) HasBreed() bool { + if o != nil && o.Breed != nil { + return true + } + + return false +} + +// SetBreed gets a reference to the given string and assigns it to the Breed field. +func (o *Dog) SetBreed(v string) { + o.Breed = &v +} + +func (o Dog) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + serializedAnimal, errAnimal := json.Marshal(o.Animal) + if errAnimal != nil { + return []byte{}, errAnimal + } + errAnimal = json.Unmarshal([]byte(serializedAnimal), &toSerialize) + if errAnimal != nil { + return []byte{}, errAnimal + } + if o.Breed != nil { + toSerialize["breed"] = o.Breed + } + return json.Marshal(toSerialize) +} + +type NullableDog struct { + value *Dog + isSet bool +} + +func (v NullableDog) Get() *Dog { + return v.value +} + +func (v *NullableDog) Set(val *Dog) { + v.value = val + v.isSet = true +} + +func (v NullableDog) IsSet() bool { + return v.isSet +} + +func (v *NullableDog) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDog(val *Dog) *NullableDog { + return &NullableDog{value: val, isSet: true} +} + +func (v NullableDog) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDog) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_dog_all_of.go b/samples/client/petstore/go/go-petstore/petstore/model_dog_all_of.go new file mode 100644 index 00000000000..c13aa2b2cd5 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_dog_all_of.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// DogAllOf struct for DogAllOf +type DogAllOf struct { + Breed *string `json:"breed,omitempty"` +} + +// NewDogAllOf instantiates a new DogAllOf 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 NewDogAllOf() *DogAllOf { + this := DogAllOf{} + return &this +} + +// NewDogAllOfWithDefaults instantiates a new DogAllOf 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 NewDogAllOfWithDefaults() *DogAllOf { + this := DogAllOf{} + return &this +} + +// GetBreed returns the Breed field value if set, zero value otherwise. +func (o *DogAllOf) GetBreed() string { + if o == nil || o.Breed == nil { + var ret string + return ret + } + return *o.Breed +} + +// GetBreedOk returns a tuple with the Breed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DogAllOf) GetBreedOk() (*string, bool) { + if o == nil || o.Breed == nil { + return nil, false + } + return o.Breed, true +} + +// HasBreed returns a boolean if a field has been set. +func (o *DogAllOf) HasBreed() bool { + if o != nil && o.Breed != nil { + return true + } + + return false +} + +// SetBreed gets a reference to the given string and assigns it to the Breed field. +func (o *DogAllOf) SetBreed(v string) { + o.Breed = &v +} + +func (o DogAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Breed != nil { + toSerialize["breed"] = o.Breed + } + return json.Marshal(toSerialize) +} + +type NullableDogAllOf struct { + value *DogAllOf + isSet bool +} + +func (v NullableDogAllOf) Get() *DogAllOf { + return v.value +} + +func (v *NullableDogAllOf) Set(val *DogAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableDogAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableDogAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDogAllOf(val *DogAllOf) *NullableDogAllOf { + return &NullableDogAllOf{value: val, isSet: true} +} + +func (v NullableDogAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDogAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_enum_arrays.go b/samples/client/petstore/go/go-petstore/petstore/model_enum_arrays.go new file mode 100644 index 00000000000..b18984ce730 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_enum_arrays.go @@ -0,0 +1,150 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// EnumArrays struct for EnumArrays +type EnumArrays struct { + JustSymbol *string `json:"just_symbol,omitempty"` + ArrayEnum *[]string `json:"array_enum,omitempty"` +} + +// NewEnumArrays instantiates a new EnumArrays 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 NewEnumArrays() *EnumArrays { + this := EnumArrays{} + return &this +} + +// NewEnumArraysWithDefaults instantiates a new EnumArrays 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 NewEnumArraysWithDefaults() *EnumArrays { + this := EnumArrays{} + return &this +} + +// GetJustSymbol returns the JustSymbol field value if set, zero value otherwise. +func (o *EnumArrays) GetJustSymbol() string { + if o == nil || o.JustSymbol == nil { + var ret string + return ret + } + return *o.JustSymbol +} + +// GetJustSymbolOk returns a tuple with the JustSymbol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnumArrays) GetJustSymbolOk() (*string, bool) { + if o == nil || o.JustSymbol == nil { + return nil, false + } + return o.JustSymbol, true +} + +// HasJustSymbol returns a boolean if a field has been set. +func (o *EnumArrays) HasJustSymbol() bool { + if o != nil && o.JustSymbol != nil { + return true + } + + return false +} + +// SetJustSymbol gets a reference to the given string and assigns it to the JustSymbol field. +func (o *EnumArrays) SetJustSymbol(v string) { + o.JustSymbol = &v +} + +// GetArrayEnum returns the ArrayEnum field value if set, zero value otherwise. +func (o *EnumArrays) GetArrayEnum() []string { + if o == nil || o.ArrayEnum == nil { + var ret []string + return ret + } + return *o.ArrayEnum +} + +// GetArrayEnumOk returns a tuple with the ArrayEnum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnumArrays) GetArrayEnumOk() (*[]string, bool) { + if o == nil || o.ArrayEnum == nil { + return nil, false + } + return o.ArrayEnum, true +} + +// HasArrayEnum returns a boolean if a field has been set. +func (o *EnumArrays) HasArrayEnum() bool { + if o != nil && o.ArrayEnum != nil { + return true + } + + return false +} + +// SetArrayEnum gets a reference to the given []string and assigns it to the ArrayEnum field. +func (o *EnumArrays) SetArrayEnum(v []string) { + o.ArrayEnum = &v +} + +func (o EnumArrays) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.JustSymbol != nil { + toSerialize["just_symbol"] = o.JustSymbol + } + if o.ArrayEnum != nil { + toSerialize["array_enum"] = o.ArrayEnum + } + return json.Marshal(toSerialize) +} + +type NullableEnumArrays struct { + value *EnumArrays + isSet bool +} + +func (v NullableEnumArrays) Get() *EnumArrays { + return v.value +} + +func (v *NullableEnumArrays) Set(val *EnumArrays) { + v.value = val + v.isSet = true +} + +func (v NullableEnumArrays) IsSet() bool { + return v.isSet +} + +func (v *NullableEnumArrays) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnumArrays(val *EnumArrays) *NullableEnumArrays { + return &NullableEnumArrays{value: val, isSet: true} +} + +func (v NullableEnumArrays) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnumArrays) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_enum_class.go b/samples/client/petstore/go/go-petstore/petstore/model_enum_class.go new file mode 100644 index 00000000000..d64ca138f85 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_enum_class.go @@ -0,0 +1,84 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "fmt" +) + +// EnumClass the model 'EnumClass' +type EnumClass string + +// List of EnumClass +const ( + ABC EnumClass = "_abc" + EFG EnumClass = "-efg" + XYZ EnumClass = "(xyz)" +) + +func (v *EnumClass) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := EnumClass(value) + for _, existing := range []EnumClass{ "_abc", "-efg", "(xyz)", } { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid EnumClass", value) +} + +// Ptr returns reference to EnumClass value +func (v EnumClass) Ptr() *EnumClass { + return &v +} + +type NullableEnumClass struct { + value *EnumClass + isSet bool +} + +func (v NullableEnumClass) Get() *EnumClass { + return v.value +} + +func (v *NullableEnumClass) Set(val *EnumClass) { + v.value = val + v.isSet = true +} + +func (v NullableEnumClass) IsSet() bool { + return v.isSet +} + +func (v *NullableEnumClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnumClass(val *EnumClass) *NullableEnumClass { + return &NullableEnumClass{value: val, isSet: true} +} + +func (v NullableEnumClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnumClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_enum_test_.go b/samples/client/petstore/go/go-petstore/petstore/model_enum_test_.go new file mode 100644 index 00000000000..c39d045e5a6 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_enum_test_.go @@ -0,0 +1,251 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// EnumTest struct for EnumTest +type EnumTest struct { + EnumString *string `json:"enum_string,omitempty"` + EnumStringRequired string `json:"enum_string_required"` + EnumInteger *int32 `json:"enum_integer,omitempty"` + EnumNumber *float64 `json:"enum_number,omitempty"` + OuterEnum *OuterEnum `json:"outerEnum,omitempty"` +} + +// NewEnumTest instantiates a new EnumTest 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 NewEnumTest(enumStringRequired string, ) *EnumTest { + this := EnumTest{} + this.EnumStringRequired = enumStringRequired + return &this +} + +// NewEnumTestWithDefaults instantiates a new EnumTest 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 NewEnumTestWithDefaults() *EnumTest { + this := EnumTest{} + return &this +} + +// GetEnumString returns the EnumString field value if set, zero value otherwise. +func (o *EnumTest) GetEnumString() string { + if o == nil || o.EnumString == nil { + var ret string + return ret + } + return *o.EnumString +} + +// GetEnumStringOk returns a tuple with the EnumString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnumTest) GetEnumStringOk() (*string, bool) { + if o == nil || o.EnumString == nil { + return nil, false + } + return o.EnumString, true +} + +// HasEnumString returns a boolean if a field has been set. +func (o *EnumTest) HasEnumString() bool { + if o != nil && o.EnumString != nil { + return true + } + + return false +} + +// SetEnumString gets a reference to the given string and assigns it to the EnumString field. +func (o *EnumTest) SetEnumString(v string) { + o.EnumString = &v +} + +// GetEnumStringRequired returns the EnumStringRequired field value +func (o *EnumTest) GetEnumStringRequired() string { + if o == nil { + var ret string + return ret + } + + return o.EnumStringRequired +} + +// GetEnumStringRequiredOk returns a tuple with the EnumStringRequired field value +// and a boolean to check if the value has been set. +func (o *EnumTest) GetEnumStringRequiredOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EnumStringRequired, true +} + +// SetEnumStringRequired sets field value +func (o *EnumTest) SetEnumStringRequired(v string) { + o.EnumStringRequired = v +} + +// GetEnumInteger returns the EnumInteger field value if set, zero value otherwise. +func (o *EnumTest) GetEnumInteger() int32 { + if o == nil || o.EnumInteger == nil { + var ret int32 + return ret + } + return *o.EnumInteger +} + +// GetEnumIntegerOk returns a tuple with the EnumInteger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnumTest) GetEnumIntegerOk() (*int32, bool) { + if o == nil || o.EnumInteger == nil { + return nil, false + } + return o.EnumInteger, true +} + +// HasEnumInteger returns a boolean if a field has been set. +func (o *EnumTest) HasEnumInteger() bool { + if o != nil && o.EnumInteger != nil { + return true + } + + return false +} + +// SetEnumInteger gets a reference to the given int32 and assigns it to the EnumInteger field. +func (o *EnumTest) SetEnumInteger(v int32) { + o.EnumInteger = &v +} + +// GetEnumNumber returns the EnumNumber field value if set, zero value otherwise. +func (o *EnumTest) GetEnumNumber() float64 { + if o == nil || o.EnumNumber == nil { + var ret float64 + return ret + } + return *o.EnumNumber +} + +// GetEnumNumberOk returns a tuple with the EnumNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnumTest) GetEnumNumberOk() (*float64, bool) { + if o == nil || o.EnumNumber == nil { + return nil, false + } + return o.EnumNumber, true +} + +// HasEnumNumber returns a boolean if a field has been set. +func (o *EnumTest) HasEnumNumber() bool { + if o != nil && o.EnumNumber != nil { + return true + } + + return false +} + +// SetEnumNumber gets a reference to the given float64 and assigns it to the EnumNumber field. +func (o *EnumTest) SetEnumNumber(v float64) { + o.EnumNumber = &v +} + +// GetOuterEnum returns the OuterEnum field value if set, zero value otherwise. +func (o *EnumTest) GetOuterEnum() OuterEnum { + if o == nil || o.OuterEnum == nil { + var ret OuterEnum + return ret + } + return *o.OuterEnum +} + +// GetOuterEnumOk returns a tuple with the OuterEnum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnumTest) GetOuterEnumOk() (*OuterEnum, bool) { + if o == nil || o.OuterEnum == nil { + return nil, false + } + return o.OuterEnum, true +} + +// HasOuterEnum returns a boolean if a field has been set. +func (o *EnumTest) HasOuterEnum() bool { + if o != nil && o.OuterEnum != nil { + return true + } + + return false +} + +// SetOuterEnum gets a reference to the given OuterEnum and assigns it to the OuterEnum field. +func (o *EnumTest) SetOuterEnum(v OuterEnum) { + o.OuterEnum = &v +} + +func (o EnumTest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.EnumString != nil { + toSerialize["enum_string"] = o.EnumString + } + if true { + toSerialize["enum_string_required"] = o.EnumStringRequired + } + if o.EnumInteger != nil { + toSerialize["enum_integer"] = o.EnumInteger + } + if o.EnumNumber != nil { + toSerialize["enum_number"] = o.EnumNumber + } + if o.OuterEnum != nil { + toSerialize["outerEnum"] = o.OuterEnum + } + return json.Marshal(toSerialize) +} + +type NullableEnumTest struct { + value *EnumTest + isSet bool +} + +func (v NullableEnumTest) Get() *EnumTest { + return v.value +} + +func (v *NullableEnumTest) Set(val *EnumTest) { + v.value = val + v.isSet = true +} + +func (v NullableEnumTest) IsSet() bool { + return v.isSet +} + +func (v *NullableEnumTest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnumTest(val *EnumTest) *NullableEnumTest { + return &NullableEnumTest{value: val, isSet: true} +} + +func (v NullableEnumTest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnumTest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_file.go b/samples/client/petstore/go/go-petstore/petstore/model_file.go new file mode 100644 index 00000000000..43ec19f8638 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_file.go @@ -0,0 +1,115 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// File Must be named `File` for test. +type File struct { + // Test capitalization + SourceURI *string `json:"sourceURI,omitempty"` +} + +// NewFile instantiates a new File 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 NewFile() *File { + this := File{} + return &this +} + +// NewFileWithDefaults instantiates a new File 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 NewFileWithDefaults() *File { + this := File{} + return &this +} + +// GetSourceURI returns the SourceURI field value if set, zero value otherwise. +func (o *File) GetSourceURI() string { + if o == nil || o.SourceURI == nil { + var ret string + return ret + } + return *o.SourceURI +} + +// GetSourceURIOk returns a tuple with the SourceURI field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *File) GetSourceURIOk() (*string, bool) { + if o == nil || o.SourceURI == nil { + return nil, false + } + return o.SourceURI, true +} + +// HasSourceURI returns a boolean if a field has been set. +func (o *File) HasSourceURI() bool { + if o != nil && o.SourceURI != nil { + return true + } + + return false +} + +// SetSourceURI gets a reference to the given string and assigns it to the SourceURI field. +func (o *File) SetSourceURI(v string) { + o.SourceURI = &v +} + +func (o File) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.SourceURI != nil { + toSerialize["sourceURI"] = o.SourceURI + } + return json.Marshal(toSerialize) +} + +type NullableFile struct { + value *File + isSet bool +} + +func (v NullableFile) Get() *File { + return v.value +} + +func (v *NullableFile) Set(val *File) { + v.value = val + v.isSet = true +} + +func (v NullableFile) IsSet() bool { + return v.isSet +} + +func (v *NullableFile) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFile(val *File) *NullableFile { + return &NullableFile{value: val, isSet: true} +} + +func (v NullableFile) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFile) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_file_schema_test_class.go b/samples/client/petstore/go/go-petstore/petstore/model_file_schema_test_class.go new file mode 100644 index 00000000000..626a3765173 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_file_schema_test_class.go @@ -0,0 +1,150 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// FileSchemaTestClass struct for FileSchemaTestClass +type FileSchemaTestClass struct { + File *File `json:"file,omitempty"` + Files *[]File `json:"files,omitempty"` +} + +// NewFileSchemaTestClass instantiates a new FileSchemaTestClass 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 NewFileSchemaTestClass() *FileSchemaTestClass { + this := FileSchemaTestClass{} + return &this +} + +// NewFileSchemaTestClassWithDefaults instantiates a new FileSchemaTestClass 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 NewFileSchemaTestClassWithDefaults() *FileSchemaTestClass { + this := FileSchemaTestClass{} + return &this +} + +// GetFile returns the File field value if set, zero value otherwise. +func (o *FileSchemaTestClass) GetFile() File { + if o == nil || o.File == nil { + var ret File + return ret + } + return *o.File +} + +// GetFileOk returns a tuple with the File field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FileSchemaTestClass) GetFileOk() (*File, bool) { + if o == nil || o.File == nil { + return nil, false + } + return o.File, true +} + +// HasFile returns a boolean if a field has been set. +func (o *FileSchemaTestClass) HasFile() bool { + if o != nil && o.File != nil { + return true + } + + return false +} + +// SetFile gets a reference to the given File and assigns it to the File field. +func (o *FileSchemaTestClass) SetFile(v File) { + o.File = &v +} + +// GetFiles returns the Files field value if set, zero value otherwise. +func (o *FileSchemaTestClass) GetFiles() []File { + if o == nil || o.Files == nil { + var ret []File + return ret + } + return *o.Files +} + +// GetFilesOk returns a tuple with the Files field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FileSchemaTestClass) GetFilesOk() (*[]File, bool) { + if o == nil || o.Files == nil { + return nil, false + } + return o.Files, true +} + +// HasFiles returns a boolean if a field has been set. +func (o *FileSchemaTestClass) HasFiles() bool { + if o != nil && o.Files != nil { + return true + } + + return false +} + +// SetFiles gets a reference to the given []File and assigns it to the Files field. +func (o *FileSchemaTestClass) SetFiles(v []File) { + o.Files = &v +} + +func (o FileSchemaTestClass) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.File != nil { + toSerialize["file"] = o.File + } + if o.Files != nil { + toSerialize["files"] = o.Files + } + return json.Marshal(toSerialize) +} + +type NullableFileSchemaTestClass struct { + value *FileSchemaTestClass + isSet bool +} + +func (v NullableFileSchemaTestClass) Get() *FileSchemaTestClass { + return v.value +} + +func (v *NullableFileSchemaTestClass) Set(val *FileSchemaTestClass) { + v.value = val + v.isSet = true +} + +func (v NullableFileSchemaTestClass) IsSet() bool { + return v.isSet +} + +func (v *NullableFileSchemaTestClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFileSchemaTestClass(val *FileSchemaTestClass) *NullableFileSchemaTestClass { + return &NullableFileSchemaTestClass{value: val, isSet: true} +} + +func (v NullableFileSchemaTestClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFileSchemaTestClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_format_test_.go b/samples/client/petstore/go/go-petstore/petstore/model_format_test_.go new file mode 100644 index 00000000000..aa1889aedda --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_format_test_.go @@ -0,0 +1,556 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "os" + "time" +) + +// FormatTest struct for FormatTest +type FormatTest struct { + Integer *int32 `json:"integer,omitempty"` + Int32 *int32 `json:"int32,omitempty"` + Int64 *int64 `json:"int64,omitempty"` + Number float32 `json:"number"` + Float *float32 `json:"float,omitempty"` + Double *float64 `json:"double,omitempty"` + String *string `json:"string,omitempty"` + Byte string `json:"byte"` + Binary **os.File `json:"binary,omitempty"` + Date string `json:"date"` + DateTime *time.Time `json:"dateTime,omitempty"` + Uuid *string `json:"uuid,omitempty"` + Password string `json:"password"` + BigDecimal *float64 `json:"BigDecimal,omitempty"` +} + +// NewFormatTest instantiates a new FormatTest 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 NewFormatTest(number float32, byte_ string, date string, password string, ) *FormatTest { + this := FormatTest{} + this.Number = number + this.Byte = byte_ + this.Date = date + this.Password = password + return &this +} + +// NewFormatTestWithDefaults instantiates a new FormatTest 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 NewFormatTestWithDefaults() *FormatTest { + this := FormatTest{} + return &this +} + +// GetInteger returns the Integer field value if set, zero value otherwise. +func (o *FormatTest) GetInteger() int32 { + if o == nil || o.Integer == nil { + var ret int32 + return ret + } + return *o.Integer +} + +// GetIntegerOk returns a tuple with the Integer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetIntegerOk() (*int32, bool) { + if o == nil || o.Integer == nil { + return nil, false + } + return o.Integer, true +} + +// HasInteger returns a boolean if a field has been set. +func (o *FormatTest) HasInteger() bool { + if o != nil && o.Integer != nil { + return true + } + + return false +} + +// SetInteger gets a reference to the given int32 and assigns it to the Integer field. +func (o *FormatTest) SetInteger(v int32) { + o.Integer = &v +} + +// GetInt32 returns the Int32 field value if set, zero value otherwise. +func (o *FormatTest) GetInt32() int32 { + if o == nil || o.Int32 == nil { + var ret int32 + return ret + } + return *o.Int32 +} + +// GetInt32Ok returns a tuple with the Int32 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetInt32Ok() (*int32, bool) { + if o == nil || o.Int32 == nil { + return nil, false + } + return o.Int32, true +} + +// HasInt32 returns a boolean if a field has been set. +func (o *FormatTest) HasInt32() bool { + if o != nil && o.Int32 != nil { + return true + } + + return false +} + +// SetInt32 gets a reference to the given int32 and assigns it to the Int32 field. +func (o *FormatTest) SetInt32(v int32) { + o.Int32 = &v +} + +// GetInt64 returns the Int64 field value if set, zero value otherwise. +func (o *FormatTest) GetInt64() int64 { + if o == nil || o.Int64 == nil { + var ret int64 + return ret + } + return *o.Int64 +} + +// GetInt64Ok returns a tuple with the Int64 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetInt64Ok() (*int64, bool) { + if o == nil || o.Int64 == nil { + return nil, false + } + return o.Int64, true +} + +// HasInt64 returns a boolean if a field has been set. +func (o *FormatTest) HasInt64() bool { + if o != nil && o.Int64 != nil { + return true + } + + return false +} + +// SetInt64 gets a reference to the given int64 and assigns it to the Int64 field. +func (o *FormatTest) SetInt64(v int64) { + o.Int64 = &v +} + +// GetNumber returns the Number field value +func (o *FormatTest) GetNumber() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.Number +} + +// GetNumberOk returns a tuple with the Number field value +// and a boolean to check if the value has been set. +func (o *FormatTest) GetNumberOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.Number, true +} + +// SetNumber sets field value +func (o *FormatTest) SetNumber(v float32) { + o.Number = v +} + +// GetFloat returns the Float field value if set, zero value otherwise. +func (o *FormatTest) GetFloat() float32 { + if o == nil || o.Float == nil { + var ret float32 + return ret + } + return *o.Float +} + +// GetFloatOk returns a tuple with the Float field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetFloatOk() (*float32, bool) { + if o == nil || o.Float == nil { + return nil, false + } + return o.Float, true +} + +// HasFloat returns a boolean if a field has been set. +func (o *FormatTest) HasFloat() bool { + if o != nil && o.Float != nil { + return true + } + + return false +} + +// SetFloat gets a reference to the given float32 and assigns it to the Float field. +func (o *FormatTest) SetFloat(v float32) { + o.Float = &v +} + +// GetDouble returns the Double field value if set, zero value otherwise. +func (o *FormatTest) GetDouble() float64 { + if o == nil || o.Double == nil { + var ret float64 + return ret + } + return *o.Double +} + +// GetDoubleOk returns a tuple with the Double field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetDoubleOk() (*float64, bool) { + if o == nil || o.Double == nil { + return nil, false + } + return o.Double, true +} + +// HasDouble returns a boolean if a field has been set. +func (o *FormatTest) HasDouble() bool { + if o != nil && o.Double != nil { + return true + } + + return false +} + +// SetDouble gets a reference to the given float64 and assigns it to the Double field. +func (o *FormatTest) SetDouble(v float64) { + o.Double = &v +} + +// GetString returns the String field value if set, zero value otherwise. +func (o *FormatTest) GetString() string { + if o == nil || o.String == nil { + var ret string + return ret + } + return *o.String +} + +// GetStringOk returns a tuple with the String field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetStringOk() (*string, bool) { + if o == nil || o.String == nil { + return nil, false + } + return o.String, true +} + +// HasString returns a boolean if a field has been set. +func (o *FormatTest) HasString() bool { + if o != nil && o.String != nil { + return true + } + + return false +} + +// SetString gets a reference to the given string and assigns it to the String field. +func (o *FormatTest) SetString(v string) { + o.String = &v +} + +// GetByte returns the Byte field value +func (o *FormatTest) GetByte() string { + if o == nil { + var ret string + return ret + } + + return o.Byte +} + +// GetByteOk returns a tuple with the Byte field value +// and a boolean to check if the value has been set. +func (o *FormatTest) GetByteOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Byte, true +} + +// SetByte sets field value +func (o *FormatTest) SetByte(v string) { + o.Byte = v +} + +// GetBinary returns the Binary field value if set, zero value otherwise. +func (o *FormatTest) GetBinary() *os.File { + if o == nil || o.Binary == nil { + var ret *os.File + return ret + } + return *o.Binary +} + +// GetBinaryOk returns a tuple with the Binary field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetBinaryOk() (**os.File, bool) { + if o == nil || o.Binary == nil { + return nil, false + } + return o.Binary, true +} + +// HasBinary returns a boolean if a field has been set. +func (o *FormatTest) HasBinary() bool { + if o != nil && o.Binary != nil { + return true + } + + return false +} + +// SetBinary gets a reference to the given *os.File and assigns it to the Binary field. +func (o *FormatTest) SetBinary(v *os.File) { + o.Binary = &v +} + +// GetDate returns the Date field value +func (o *FormatTest) GetDate() string { + if o == nil { + var ret string + return ret + } + + return o.Date +} + +// GetDateOk returns a tuple with the Date field value +// and a boolean to check if the value has been set. +func (o *FormatTest) GetDateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Date, true +} + +// SetDate sets field value +func (o *FormatTest) SetDate(v string) { + o.Date = v +} + +// GetDateTime returns the DateTime field value if set, zero value otherwise. +func (o *FormatTest) GetDateTime() time.Time { + if o == nil || o.DateTime == nil { + var ret time.Time + return ret + } + return *o.DateTime +} + +// GetDateTimeOk returns a tuple with the DateTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetDateTimeOk() (*time.Time, bool) { + if o == nil || o.DateTime == nil { + return nil, false + } + return o.DateTime, true +} + +// HasDateTime returns a boolean if a field has been set. +func (o *FormatTest) HasDateTime() bool { + if o != nil && o.DateTime != nil { + return true + } + + return false +} + +// SetDateTime gets a reference to the given time.Time and assigns it to the DateTime field. +func (o *FormatTest) SetDateTime(v time.Time) { + o.DateTime = &v +} + +// GetUuid returns the Uuid field value if set, zero value otherwise. +func (o *FormatTest) GetUuid() string { + if o == nil || o.Uuid == nil { + var ret string + return ret + } + return *o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetUuidOk() (*string, bool) { + if o == nil || o.Uuid == nil { + return nil, false + } + return o.Uuid, true +} + +// HasUuid returns a boolean if a field has been set. +func (o *FormatTest) HasUuid() bool { + if o != nil && o.Uuid != nil { + return true + } + + return false +} + +// SetUuid gets a reference to the given string and assigns it to the Uuid field. +func (o *FormatTest) SetUuid(v string) { + o.Uuid = &v +} + +// GetPassword returns the Password field value +func (o *FormatTest) GetPassword() string { + if o == nil { + var ret string + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *FormatTest) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *FormatTest) SetPassword(v string) { + o.Password = v +} + +// GetBigDecimal returns the BigDecimal field value if set, zero value otherwise. +func (o *FormatTest) GetBigDecimal() float64 { + if o == nil || o.BigDecimal == nil { + var ret float64 + return ret + } + return *o.BigDecimal +} + +// GetBigDecimalOk returns a tuple with the BigDecimal field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetBigDecimalOk() (*float64, bool) { + if o == nil || o.BigDecimal == nil { + return nil, false + } + return o.BigDecimal, true +} + +// HasBigDecimal returns a boolean if a field has been set. +func (o *FormatTest) HasBigDecimal() bool { + if o != nil && o.BigDecimal != nil { + return true + } + + return false +} + +// SetBigDecimal gets a reference to the given float64 and assigns it to the BigDecimal field. +func (o *FormatTest) SetBigDecimal(v float64) { + o.BigDecimal = &v +} + +func (o FormatTest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Integer != nil { + toSerialize["integer"] = o.Integer + } + if o.Int32 != nil { + toSerialize["int32"] = o.Int32 + } + if o.Int64 != nil { + toSerialize["int64"] = o.Int64 + } + if true { + toSerialize["number"] = o.Number + } + if o.Float != nil { + toSerialize["float"] = o.Float + } + if o.Double != nil { + toSerialize["double"] = o.Double + } + if o.String != nil { + toSerialize["string"] = o.String + } + if true { + toSerialize["byte"] = o.Byte + } + if o.Binary != nil { + toSerialize["binary"] = o.Binary + } + if true { + toSerialize["date"] = o.Date + } + if o.DateTime != nil { + toSerialize["dateTime"] = o.DateTime + } + if o.Uuid != nil { + toSerialize["uuid"] = o.Uuid + } + if true { + toSerialize["password"] = o.Password + } + if o.BigDecimal != nil { + toSerialize["BigDecimal"] = o.BigDecimal + } + return json.Marshal(toSerialize) +} + +type NullableFormatTest struct { + value *FormatTest + isSet bool +} + +func (v NullableFormatTest) Get() *FormatTest { + return v.value +} + +func (v *NullableFormatTest) Set(val *FormatTest) { + v.value = val + v.isSet = true +} + +func (v NullableFormatTest) IsSet() bool { + return v.isSet +} + +func (v *NullableFormatTest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFormatTest(val *FormatTest) *NullableFormatTest { + return &NullableFormatTest{value: val, isSet: true} +} + +func (v NullableFormatTest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFormatTest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_has_only_read_only.go b/samples/client/petstore/go/go-petstore/petstore/model_has_only_read_only.go new file mode 100644 index 00000000000..3400c73dca6 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_has_only_read_only.go @@ -0,0 +1,150 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// HasOnlyReadOnly struct for HasOnlyReadOnly +type HasOnlyReadOnly struct { + Bar *string `json:"bar,omitempty"` + Foo *string `json:"foo,omitempty"` +} + +// NewHasOnlyReadOnly instantiates a new HasOnlyReadOnly 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 NewHasOnlyReadOnly() *HasOnlyReadOnly { + this := HasOnlyReadOnly{} + return &this +} + +// NewHasOnlyReadOnlyWithDefaults instantiates a new HasOnlyReadOnly 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 NewHasOnlyReadOnlyWithDefaults() *HasOnlyReadOnly { + this := HasOnlyReadOnly{} + return &this +} + +// GetBar returns the Bar field value if set, zero value otherwise. +func (o *HasOnlyReadOnly) GetBar() string { + if o == nil || o.Bar == nil { + var ret string + return ret + } + return *o.Bar +} + +// GetBarOk returns a tuple with the Bar field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HasOnlyReadOnly) GetBarOk() (*string, bool) { + if o == nil || o.Bar == nil { + return nil, false + } + return o.Bar, true +} + +// HasBar returns a boolean if a field has been set. +func (o *HasOnlyReadOnly) HasBar() bool { + if o != nil && o.Bar != nil { + return true + } + + return false +} + +// SetBar gets a reference to the given string and assigns it to the Bar field. +func (o *HasOnlyReadOnly) SetBar(v string) { + o.Bar = &v +} + +// GetFoo returns the Foo field value if set, zero value otherwise. +func (o *HasOnlyReadOnly) GetFoo() string { + if o == nil || o.Foo == nil { + var ret string + return ret + } + return *o.Foo +} + +// GetFooOk returns a tuple with the Foo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HasOnlyReadOnly) GetFooOk() (*string, bool) { + if o == nil || o.Foo == nil { + return nil, false + } + return o.Foo, true +} + +// HasFoo returns a boolean if a field has been set. +func (o *HasOnlyReadOnly) HasFoo() bool { + if o != nil && o.Foo != nil { + return true + } + + return false +} + +// SetFoo gets a reference to the given string and assigns it to the Foo field. +func (o *HasOnlyReadOnly) SetFoo(v string) { + o.Foo = &v +} + +func (o HasOnlyReadOnly) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Bar != nil { + toSerialize["bar"] = o.Bar + } + if o.Foo != nil { + toSerialize["foo"] = o.Foo + } + return json.Marshal(toSerialize) +} + +type NullableHasOnlyReadOnly struct { + value *HasOnlyReadOnly + isSet bool +} + +func (v NullableHasOnlyReadOnly) Get() *HasOnlyReadOnly { + return v.value +} + +func (v *NullableHasOnlyReadOnly) Set(val *HasOnlyReadOnly) { + v.value = val + v.isSet = true +} + +func (v NullableHasOnlyReadOnly) IsSet() bool { + return v.isSet +} + +func (v *NullableHasOnlyReadOnly) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHasOnlyReadOnly(val *HasOnlyReadOnly) *NullableHasOnlyReadOnly { + return &NullableHasOnlyReadOnly{value: val, isSet: true} +} + +func (v NullableHasOnlyReadOnly) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHasOnlyReadOnly) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_list.go b/samples/client/petstore/go/go-petstore/petstore/model_list.go new file mode 100644 index 00000000000..f49afaa71f3 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_list.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// List struct for List +type List struct { + Var123List *string `json:"123-list,omitempty"` +} + +// NewList instantiates a new List 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 NewList() *List { + this := List{} + return &this +} + +// NewListWithDefaults instantiates a new List 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 NewListWithDefaults() *List { + this := List{} + return &this +} + +// GetVar123List returns the Var123List field value if set, zero value otherwise. +func (o *List) GetVar123List() string { + if o == nil || o.Var123List == nil { + var ret string + return ret + } + return *o.Var123List +} + +// GetVar123ListOk returns a tuple with the Var123List field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *List) GetVar123ListOk() (*string, bool) { + if o == nil || o.Var123List == nil { + return nil, false + } + return o.Var123List, true +} + +// HasVar123List returns a boolean if a field has been set. +func (o *List) HasVar123List() bool { + if o != nil && o.Var123List != nil { + return true + } + + return false +} + +// SetVar123List gets a reference to the given string and assigns it to the Var123List field. +func (o *List) SetVar123List(v string) { + o.Var123List = &v +} + +func (o List) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Var123List != nil { + toSerialize["123-list"] = o.Var123List + } + return json.Marshal(toSerialize) +} + +type NullableList struct { + value *List + isSet bool +} + +func (v NullableList) Get() *List { + return v.value +} + +func (v *NullableList) Set(val *List) { + v.value = val + v.isSet = true +} + +func (v NullableList) IsSet() bool { + return v.isSet +} + +func (v *NullableList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableList(val *List) *NullableList { + return &NullableList{value: val, isSet: true} +} + +func (v NullableList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_map_test_.go b/samples/client/petstore/go/go-petstore/petstore/model_map_test_.go new file mode 100644 index 00000000000..4fc2c0b4799 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_map_test_.go @@ -0,0 +1,222 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// MapTest struct for MapTest +type MapTest struct { + MapMapOfString *map[string]map[string]string `json:"map_map_of_string,omitempty"` + MapOfEnumString *map[string]string `json:"map_of_enum_string,omitempty"` + DirectMap *map[string]bool `json:"direct_map,omitempty"` + IndirectMap *map[string]bool `json:"indirect_map,omitempty"` +} + +// NewMapTest instantiates a new MapTest 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 NewMapTest() *MapTest { + this := MapTest{} + return &this +} + +// NewMapTestWithDefaults instantiates a new MapTest 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 NewMapTestWithDefaults() *MapTest { + this := MapTest{} + return &this +} + +// GetMapMapOfString returns the MapMapOfString field value if set, zero value otherwise. +func (o *MapTest) GetMapMapOfString() map[string]map[string]string { + if o == nil || o.MapMapOfString == nil { + var ret map[string]map[string]string + return ret + } + return *o.MapMapOfString +} + +// GetMapMapOfStringOk returns a tuple with the MapMapOfString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MapTest) GetMapMapOfStringOk() (*map[string]map[string]string, bool) { + if o == nil || o.MapMapOfString == nil { + return nil, false + } + return o.MapMapOfString, true +} + +// HasMapMapOfString returns a boolean if a field has been set. +func (o *MapTest) HasMapMapOfString() bool { + if o != nil && o.MapMapOfString != nil { + return true + } + + return false +} + +// SetMapMapOfString gets a reference to the given map[string]map[string]string and assigns it to the MapMapOfString field. +func (o *MapTest) SetMapMapOfString(v map[string]map[string]string) { + o.MapMapOfString = &v +} + +// GetMapOfEnumString returns the MapOfEnumString field value if set, zero value otherwise. +func (o *MapTest) GetMapOfEnumString() map[string]string { + if o == nil || o.MapOfEnumString == nil { + var ret map[string]string + return ret + } + return *o.MapOfEnumString +} + +// GetMapOfEnumStringOk returns a tuple with the MapOfEnumString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MapTest) GetMapOfEnumStringOk() (*map[string]string, bool) { + if o == nil || o.MapOfEnumString == nil { + return nil, false + } + return o.MapOfEnumString, true +} + +// HasMapOfEnumString returns a boolean if a field has been set. +func (o *MapTest) HasMapOfEnumString() bool { + if o != nil && o.MapOfEnumString != nil { + return true + } + + return false +} + +// SetMapOfEnumString gets a reference to the given map[string]string and assigns it to the MapOfEnumString field. +func (o *MapTest) SetMapOfEnumString(v map[string]string) { + o.MapOfEnumString = &v +} + +// GetDirectMap returns the DirectMap field value if set, zero value otherwise. +func (o *MapTest) GetDirectMap() map[string]bool { + if o == nil || o.DirectMap == nil { + var ret map[string]bool + return ret + } + return *o.DirectMap +} + +// GetDirectMapOk returns a tuple with the DirectMap field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MapTest) GetDirectMapOk() (*map[string]bool, bool) { + if o == nil || o.DirectMap == nil { + return nil, false + } + return o.DirectMap, true +} + +// HasDirectMap returns a boolean if a field has been set. +func (o *MapTest) HasDirectMap() bool { + if o != nil && o.DirectMap != nil { + return true + } + + return false +} + +// SetDirectMap gets a reference to the given map[string]bool and assigns it to the DirectMap field. +func (o *MapTest) SetDirectMap(v map[string]bool) { + o.DirectMap = &v +} + +// GetIndirectMap returns the IndirectMap field value if set, zero value otherwise. +func (o *MapTest) GetIndirectMap() map[string]bool { + if o == nil || o.IndirectMap == nil { + var ret map[string]bool + return ret + } + return *o.IndirectMap +} + +// GetIndirectMapOk returns a tuple with the IndirectMap field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MapTest) GetIndirectMapOk() (*map[string]bool, bool) { + if o == nil || o.IndirectMap == nil { + return nil, false + } + return o.IndirectMap, true +} + +// HasIndirectMap returns a boolean if a field has been set. +func (o *MapTest) HasIndirectMap() bool { + if o != nil && o.IndirectMap != nil { + return true + } + + return false +} + +// SetIndirectMap gets a reference to the given map[string]bool and assigns it to the IndirectMap field. +func (o *MapTest) SetIndirectMap(v map[string]bool) { + o.IndirectMap = &v +} + +func (o MapTest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.MapMapOfString != nil { + toSerialize["map_map_of_string"] = o.MapMapOfString + } + if o.MapOfEnumString != nil { + toSerialize["map_of_enum_string"] = o.MapOfEnumString + } + if o.DirectMap != nil { + toSerialize["direct_map"] = o.DirectMap + } + if o.IndirectMap != nil { + toSerialize["indirect_map"] = o.IndirectMap + } + return json.Marshal(toSerialize) +} + +type NullableMapTest struct { + value *MapTest + isSet bool +} + +func (v NullableMapTest) Get() *MapTest { + return v.value +} + +func (v *NullableMapTest) Set(val *MapTest) { + v.value = val + v.isSet = true +} + +func (v NullableMapTest) IsSet() bool { + return v.isSet +} + +func (v *NullableMapTest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMapTest(val *MapTest) *NullableMapTest { + return &NullableMapTest{value: val, isSet: true} +} + +func (v NullableMapTest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMapTest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_mixed_properties_and_additional_properties_class.go b/samples/client/petstore/go/go-petstore/petstore/model_mixed_properties_and_additional_properties_class.go new file mode 100644 index 00000000000..69cc134169e --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_mixed_properties_and_additional_properties_class.go @@ -0,0 +1,187 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "time" +) + +// MixedPropertiesAndAdditionalPropertiesClass struct for MixedPropertiesAndAdditionalPropertiesClass +type MixedPropertiesAndAdditionalPropertiesClass struct { + Uuid *string `json:"uuid,omitempty"` + DateTime *time.Time `json:"dateTime,omitempty"` + Map *map[string]Animal `json:"map,omitempty"` +} + +// NewMixedPropertiesAndAdditionalPropertiesClass instantiates a new MixedPropertiesAndAdditionalPropertiesClass 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 NewMixedPropertiesAndAdditionalPropertiesClass() *MixedPropertiesAndAdditionalPropertiesClass { + this := MixedPropertiesAndAdditionalPropertiesClass{} + return &this +} + +// NewMixedPropertiesAndAdditionalPropertiesClassWithDefaults instantiates a new MixedPropertiesAndAdditionalPropertiesClass 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 NewMixedPropertiesAndAdditionalPropertiesClassWithDefaults() *MixedPropertiesAndAdditionalPropertiesClass { + this := MixedPropertiesAndAdditionalPropertiesClass{} + return &this +} + +// GetUuid returns the Uuid field value if set, zero value otherwise. +func (o *MixedPropertiesAndAdditionalPropertiesClass) GetUuid() string { + if o == nil || o.Uuid == nil { + var ret string + return ret + } + return *o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MixedPropertiesAndAdditionalPropertiesClass) GetUuidOk() (*string, bool) { + if o == nil || o.Uuid == nil { + return nil, false + } + return o.Uuid, true +} + +// HasUuid returns a boolean if a field has been set. +func (o *MixedPropertiesAndAdditionalPropertiesClass) HasUuid() bool { + if o != nil && o.Uuid != nil { + return true + } + + return false +} + +// SetUuid gets a reference to the given string and assigns it to the Uuid field. +func (o *MixedPropertiesAndAdditionalPropertiesClass) SetUuid(v string) { + o.Uuid = &v +} + +// GetDateTime returns the DateTime field value if set, zero value otherwise. +func (o *MixedPropertiesAndAdditionalPropertiesClass) GetDateTime() time.Time { + if o == nil || o.DateTime == nil { + var ret time.Time + return ret + } + return *o.DateTime +} + +// GetDateTimeOk returns a tuple with the DateTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MixedPropertiesAndAdditionalPropertiesClass) GetDateTimeOk() (*time.Time, bool) { + if o == nil || o.DateTime == nil { + return nil, false + } + return o.DateTime, true +} + +// HasDateTime returns a boolean if a field has been set. +func (o *MixedPropertiesAndAdditionalPropertiesClass) HasDateTime() bool { + if o != nil && o.DateTime != nil { + return true + } + + return false +} + +// SetDateTime gets a reference to the given time.Time and assigns it to the DateTime field. +func (o *MixedPropertiesAndAdditionalPropertiesClass) SetDateTime(v time.Time) { + o.DateTime = &v +} + +// GetMap returns the Map field value if set, zero value otherwise. +func (o *MixedPropertiesAndAdditionalPropertiesClass) GetMap() map[string]Animal { + if o == nil || o.Map == nil { + var ret map[string]Animal + return ret + } + return *o.Map +} + +// GetMapOk returns a tuple with the Map field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MixedPropertiesAndAdditionalPropertiesClass) GetMapOk() (*map[string]Animal, bool) { + if o == nil || o.Map == nil { + return nil, false + } + return o.Map, true +} + +// HasMap returns a boolean if a field has been set. +func (o *MixedPropertiesAndAdditionalPropertiesClass) HasMap() bool { + if o != nil && o.Map != nil { + return true + } + + return false +} + +// SetMap gets a reference to the given map[string]Animal and assigns it to the Map field. +func (o *MixedPropertiesAndAdditionalPropertiesClass) SetMap(v map[string]Animal) { + o.Map = &v +} + +func (o MixedPropertiesAndAdditionalPropertiesClass) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Uuid != nil { + toSerialize["uuid"] = o.Uuid + } + if o.DateTime != nil { + toSerialize["dateTime"] = o.DateTime + } + if o.Map != nil { + toSerialize["map"] = o.Map + } + return json.Marshal(toSerialize) +} + +type NullableMixedPropertiesAndAdditionalPropertiesClass struct { + value *MixedPropertiesAndAdditionalPropertiesClass + isSet bool +} + +func (v NullableMixedPropertiesAndAdditionalPropertiesClass) Get() *MixedPropertiesAndAdditionalPropertiesClass { + return v.value +} + +func (v *NullableMixedPropertiesAndAdditionalPropertiesClass) Set(val *MixedPropertiesAndAdditionalPropertiesClass) { + v.value = val + v.isSet = true +} + +func (v NullableMixedPropertiesAndAdditionalPropertiesClass) IsSet() bool { + return v.isSet +} + +func (v *NullableMixedPropertiesAndAdditionalPropertiesClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMixedPropertiesAndAdditionalPropertiesClass(val *MixedPropertiesAndAdditionalPropertiesClass) *NullableMixedPropertiesAndAdditionalPropertiesClass { + return &NullableMixedPropertiesAndAdditionalPropertiesClass{value: val, isSet: true} +} + +func (v NullableMixedPropertiesAndAdditionalPropertiesClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMixedPropertiesAndAdditionalPropertiesClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_name.go b/samples/client/petstore/go/go-petstore/petstore/model_name.go new file mode 100644 index 00000000000..82e49591874 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_name.go @@ -0,0 +1,215 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Name Model for testing model name same as property name +type Name struct { + Name int32 `json:"name"` + SnakeCase *int32 `json:"snake_case,omitempty"` + Property *string `json:"property,omitempty"` + Var123Number *int32 `json:"123Number,omitempty"` +} + +// NewName instantiates a new Name 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 NewName(name int32, ) *Name { + this := Name{} + this.Name = name + return &this +} + +// NewNameWithDefaults instantiates a new Name 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 NewNameWithDefaults() *Name { + this := Name{} + return &this +} + +// GetName returns the Name field value +func (o *Name) GetName() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Name) GetNameOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Name) SetName(v int32) { + o.Name = v +} + +// GetSnakeCase returns the SnakeCase field value if set, zero value otherwise. +func (o *Name) GetSnakeCase() int32 { + if o == nil || o.SnakeCase == nil { + var ret int32 + return ret + } + return *o.SnakeCase +} + +// GetSnakeCaseOk returns a tuple with the SnakeCase field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Name) GetSnakeCaseOk() (*int32, bool) { + if o == nil || o.SnakeCase == nil { + return nil, false + } + return o.SnakeCase, true +} + +// HasSnakeCase returns a boolean if a field has been set. +func (o *Name) HasSnakeCase() bool { + if o != nil && o.SnakeCase != nil { + return true + } + + return false +} + +// SetSnakeCase gets a reference to the given int32 and assigns it to the SnakeCase field. +func (o *Name) SetSnakeCase(v int32) { + o.SnakeCase = &v +} + +// GetProperty returns the Property field value if set, zero value otherwise. +func (o *Name) GetProperty() string { + if o == nil || o.Property == nil { + var ret string + return ret + } + return *o.Property +} + +// GetPropertyOk returns a tuple with the Property field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Name) GetPropertyOk() (*string, bool) { + if o == nil || o.Property == nil { + return nil, false + } + return o.Property, true +} + +// HasProperty returns a boolean if a field has been set. +func (o *Name) HasProperty() bool { + if o != nil && o.Property != nil { + return true + } + + return false +} + +// SetProperty gets a reference to the given string and assigns it to the Property field. +func (o *Name) SetProperty(v string) { + o.Property = &v +} + +// GetVar123Number returns the Var123Number field value if set, zero value otherwise. +func (o *Name) GetVar123Number() int32 { + if o == nil || o.Var123Number == nil { + var ret int32 + return ret + } + return *o.Var123Number +} + +// GetVar123NumberOk returns a tuple with the Var123Number field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Name) GetVar123NumberOk() (*int32, bool) { + if o == nil || o.Var123Number == nil { + return nil, false + } + return o.Var123Number, true +} + +// HasVar123Number returns a boolean if a field has been set. +func (o *Name) HasVar123Number() bool { + if o != nil && o.Var123Number != nil { + return true + } + + return false +} + +// SetVar123Number gets a reference to the given int32 and assigns it to the Var123Number field. +func (o *Name) SetVar123Number(v int32) { + o.Var123Number = &v +} + +func (o Name) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["name"] = o.Name + } + if o.SnakeCase != nil { + toSerialize["snake_case"] = o.SnakeCase + } + if o.Property != nil { + toSerialize["property"] = o.Property + } + if o.Var123Number != nil { + toSerialize["123Number"] = o.Var123Number + } + return json.Marshal(toSerialize) +} + +type NullableName struct { + value *Name + isSet bool +} + +func (v NullableName) Get() *Name { + return v.value +} + +func (v *NullableName) Set(val *Name) { + v.value = val + v.isSet = true +} + +func (v NullableName) IsSet() bool { + return v.isSet +} + +func (v *NullableName) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableName(val *Name) *NullableName { + return &NullableName{value: val, isSet: true} +} + +func (v NullableName) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableName) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_number_only.go b/samples/client/petstore/go/go-petstore/petstore/model_number_only.go new file mode 100644 index 00000000000..efa8b66a5bc --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_number_only.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// NumberOnly struct for NumberOnly +type NumberOnly struct { + JustNumber *float32 `json:"JustNumber,omitempty"` +} + +// NewNumberOnly instantiates a new NumberOnly 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 NewNumberOnly() *NumberOnly { + this := NumberOnly{} + return &this +} + +// NewNumberOnlyWithDefaults instantiates a new NumberOnly 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 NewNumberOnlyWithDefaults() *NumberOnly { + this := NumberOnly{} + return &this +} + +// GetJustNumber returns the JustNumber field value if set, zero value otherwise. +func (o *NumberOnly) GetJustNumber() float32 { + if o == nil || o.JustNumber == nil { + var ret float32 + return ret + } + return *o.JustNumber +} + +// GetJustNumberOk returns a tuple with the JustNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NumberOnly) GetJustNumberOk() (*float32, bool) { + if o == nil || o.JustNumber == nil { + return nil, false + } + return o.JustNumber, true +} + +// HasJustNumber returns a boolean if a field has been set. +func (o *NumberOnly) HasJustNumber() bool { + if o != nil && o.JustNumber != nil { + return true + } + + return false +} + +// SetJustNumber gets a reference to the given float32 and assigns it to the JustNumber field. +func (o *NumberOnly) SetJustNumber(v float32) { + o.JustNumber = &v +} + +func (o NumberOnly) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.JustNumber != nil { + toSerialize["JustNumber"] = o.JustNumber + } + return json.Marshal(toSerialize) +} + +type NullableNumberOnly struct { + value *NumberOnly + isSet bool +} + +func (v NullableNumberOnly) Get() *NumberOnly { + return v.value +} + +func (v *NullableNumberOnly) Set(val *NumberOnly) { + v.value = val + v.isSet = true +} + +func (v NullableNumberOnly) IsSet() bool { + return v.isSet +} + +func (v *NullableNumberOnly) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNumberOnly(val *NumberOnly) *NullableNumberOnly { + return &NullableNumberOnly{value: val, isSet: true} +} + +func (v NullableNumberOnly) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNumberOnly) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_order.go b/samples/client/petstore/go/go-petstore/petstore/model_order.go new file mode 100644 index 00000000000..b20a1429848 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_order.go @@ -0,0 +1,300 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "time" +) + +// Order struct for Order +type Order struct { + Id *int64 `json:"id,omitempty"` + PetId *int64 `json:"petId,omitempty"` + Quantity *int32 `json:"quantity,omitempty"` + ShipDate *time.Time `json:"shipDate,omitempty"` + // Order Status + Status *string `json:"status,omitempty"` + Complete *bool `json:"complete,omitempty"` +} + +// NewOrder instantiates a new Order 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 NewOrder() *Order { + this := Order{} + var complete bool = false + this.Complete = &complete + return &this +} + +// NewOrderWithDefaults instantiates a new Order 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 NewOrderWithDefaults() *Order { + this := Order{} + var complete bool = false + this.Complete = &complete + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Order) GetId() int64 { + if o == nil || o.Id == nil { + 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 *Order) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Order) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Order) SetId(v int64) { + o.Id = &v +} + +// GetPetId returns the PetId field value if set, zero value otherwise. +func (o *Order) GetPetId() int64 { + if o == nil || o.PetId == nil { + var ret int64 + return ret + } + return *o.PetId +} + +// GetPetIdOk returns a tuple with the PetId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Order) GetPetIdOk() (*int64, bool) { + if o == nil || o.PetId == nil { + return nil, false + } + return o.PetId, true +} + +// HasPetId returns a boolean if a field has been set. +func (o *Order) HasPetId() bool { + if o != nil && o.PetId != nil { + return true + } + + return false +} + +// SetPetId gets a reference to the given int64 and assigns it to the PetId field. +func (o *Order) SetPetId(v int64) { + o.PetId = &v +} + +// GetQuantity returns the Quantity field value if set, zero value otherwise. +func (o *Order) GetQuantity() int32 { + if o == nil || o.Quantity == nil { + var ret int32 + return ret + } + return *o.Quantity +} + +// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Order) GetQuantityOk() (*int32, bool) { + if o == nil || o.Quantity == nil { + return nil, false + } + return o.Quantity, true +} + +// HasQuantity returns a boolean if a field has been set. +func (o *Order) HasQuantity() bool { + if o != nil && o.Quantity != nil { + return true + } + + return false +} + +// SetQuantity gets a reference to the given int32 and assigns it to the Quantity field. +func (o *Order) SetQuantity(v int32) { + o.Quantity = &v +} + +// GetShipDate returns the ShipDate field value if set, zero value otherwise. +func (o *Order) GetShipDate() time.Time { + if o == nil || o.ShipDate == nil { + var ret time.Time + return ret + } + return *o.ShipDate +} + +// GetShipDateOk returns a tuple with the ShipDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Order) GetShipDateOk() (*time.Time, bool) { + if o == nil || o.ShipDate == nil { + return nil, false + } + return o.ShipDate, true +} + +// HasShipDate returns a boolean if a field has been set. +func (o *Order) HasShipDate() bool { + if o != nil && o.ShipDate != nil { + return true + } + + return false +} + +// SetShipDate gets a reference to the given time.Time and assigns it to the ShipDate field. +func (o *Order) SetShipDate(v time.Time) { + o.ShipDate = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Order) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Order) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Order) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Order) SetStatus(v string) { + o.Status = &v +} + +// GetComplete returns the Complete field value if set, zero value otherwise. +func (o *Order) GetComplete() bool { + if o == nil || o.Complete == nil { + var ret bool + return ret + } + return *o.Complete +} + +// GetCompleteOk returns a tuple with the Complete field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Order) GetCompleteOk() (*bool, bool) { + if o == nil || o.Complete == nil { + return nil, false + } + return o.Complete, true +} + +// HasComplete returns a boolean if a field has been set. +func (o *Order) HasComplete() bool { + if o != nil && o.Complete != nil { + return true + } + + return false +} + +// SetComplete gets a reference to the given bool and assigns it to the Complete field. +func (o *Order) SetComplete(v bool) { + o.Complete = &v +} + +func (o Order) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.PetId != nil { + toSerialize["petId"] = o.PetId + } + if o.Quantity != nil { + toSerialize["quantity"] = o.Quantity + } + if o.ShipDate != nil { + toSerialize["shipDate"] = o.ShipDate + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Complete != nil { + toSerialize["complete"] = o.Complete + } + return json.Marshal(toSerialize) +} + +type NullableOrder struct { + value *Order + isSet bool +} + +func (v NullableOrder) Get() *Order { + return v.value +} + +func (v *NullableOrder) Set(val *Order) { + v.value = val + v.isSet = true +} + +func (v NullableOrder) IsSet() bool { + return v.isSet +} + +func (v *NullableOrder) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOrder(val *Order) *NullableOrder { + return &NullableOrder{value: val, isSet: true} +} + +func (v NullableOrder) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOrder) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_outer_composite.go b/samples/client/petstore/go/go-petstore/petstore/model_outer_composite.go new file mode 100644 index 00000000000..9a76c753b64 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_outer_composite.go @@ -0,0 +1,186 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// OuterComposite struct for OuterComposite +type OuterComposite struct { + MyNumber *float32 `json:"my_number,omitempty"` + MyString *string `json:"my_string,omitempty"` + MyBoolean *bool `json:"my_boolean,omitempty"` +} + +// NewOuterComposite instantiates a new OuterComposite 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 NewOuterComposite() *OuterComposite { + this := OuterComposite{} + return &this +} + +// NewOuterCompositeWithDefaults instantiates a new OuterComposite 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 NewOuterCompositeWithDefaults() *OuterComposite { + this := OuterComposite{} + return &this +} + +// GetMyNumber returns the MyNumber field value if set, zero value otherwise. +func (o *OuterComposite) GetMyNumber() float32 { + if o == nil || o.MyNumber == nil { + var ret float32 + return ret + } + return *o.MyNumber +} + +// GetMyNumberOk returns a tuple with the MyNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OuterComposite) GetMyNumberOk() (*float32, bool) { + if o == nil || o.MyNumber == nil { + return nil, false + } + return o.MyNumber, true +} + +// HasMyNumber returns a boolean if a field has been set. +func (o *OuterComposite) HasMyNumber() bool { + if o != nil && o.MyNumber != nil { + return true + } + + return false +} + +// SetMyNumber gets a reference to the given float32 and assigns it to the MyNumber field. +func (o *OuterComposite) SetMyNumber(v float32) { + o.MyNumber = &v +} + +// GetMyString returns the MyString field value if set, zero value otherwise. +func (o *OuterComposite) GetMyString() string { + if o == nil || o.MyString == nil { + var ret string + return ret + } + return *o.MyString +} + +// GetMyStringOk returns a tuple with the MyString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OuterComposite) GetMyStringOk() (*string, bool) { + if o == nil || o.MyString == nil { + return nil, false + } + return o.MyString, true +} + +// HasMyString returns a boolean if a field has been set. +func (o *OuterComposite) HasMyString() bool { + if o != nil && o.MyString != nil { + return true + } + + return false +} + +// SetMyString gets a reference to the given string and assigns it to the MyString field. +func (o *OuterComposite) SetMyString(v string) { + o.MyString = &v +} + +// GetMyBoolean returns the MyBoolean field value if set, zero value otherwise. +func (o *OuterComposite) GetMyBoolean() bool { + if o == nil || o.MyBoolean == nil { + var ret bool + return ret + } + return *o.MyBoolean +} + +// GetMyBooleanOk returns a tuple with the MyBoolean field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OuterComposite) GetMyBooleanOk() (*bool, bool) { + if o == nil || o.MyBoolean == nil { + return nil, false + } + return o.MyBoolean, true +} + +// HasMyBoolean returns a boolean if a field has been set. +func (o *OuterComposite) HasMyBoolean() bool { + if o != nil && o.MyBoolean != nil { + return true + } + + return false +} + +// SetMyBoolean gets a reference to the given bool and assigns it to the MyBoolean field. +func (o *OuterComposite) SetMyBoolean(v bool) { + o.MyBoolean = &v +} + +func (o OuterComposite) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.MyNumber != nil { + toSerialize["my_number"] = o.MyNumber + } + if o.MyString != nil { + toSerialize["my_string"] = o.MyString + } + if o.MyBoolean != nil { + toSerialize["my_boolean"] = o.MyBoolean + } + return json.Marshal(toSerialize) +} + +type NullableOuterComposite struct { + value *OuterComposite + isSet bool +} + +func (v NullableOuterComposite) Get() *OuterComposite { + return v.value +} + +func (v *NullableOuterComposite) Set(val *OuterComposite) { + v.value = val + v.isSet = true +} + +func (v NullableOuterComposite) IsSet() bool { + return v.isSet +} + +func (v *NullableOuterComposite) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOuterComposite(val *OuterComposite) *NullableOuterComposite { + return &NullableOuterComposite{value: val, isSet: true} +} + +func (v NullableOuterComposite) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOuterComposite) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_outer_enum.go b/samples/client/petstore/go/go-petstore/petstore/model_outer_enum.go new file mode 100644 index 00000000000..8160a2d09fc --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_outer_enum.go @@ -0,0 +1,84 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "fmt" +) + +// OuterEnum the model 'OuterEnum' +type OuterEnum string + +// List of OuterEnum +const ( + PLACED OuterEnum = "placed" + APPROVED OuterEnum = "approved" + DELIVERED OuterEnum = "delivered" +) + +func (v *OuterEnum) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := OuterEnum(value) + for _, existing := range []OuterEnum{ "placed", "approved", "delivered", } { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid OuterEnum", value) +} + +// Ptr returns reference to OuterEnum value +func (v OuterEnum) Ptr() *OuterEnum { + return &v +} + +type NullableOuterEnum struct { + value *OuterEnum + isSet bool +} + +func (v NullableOuterEnum) Get() *OuterEnum { + return v.value +} + +func (v *NullableOuterEnum) Set(val *OuterEnum) { + v.value = val + v.isSet = true +} + +func (v NullableOuterEnum) IsSet() bool { + return v.isSet +} + +func (v *NullableOuterEnum) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOuterEnum(val *OuterEnum) *NullableOuterEnum { + return &NullableOuterEnum{value: val, isSet: true} +} + +func (v NullableOuterEnum) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOuterEnum) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_pet.go b/samples/client/petstore/go/go-petstore/petstore/model_pet.go new file mode 100644 index 00000000000..8bc4457fc37 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_pet.go @@ -0,0 +1,281 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Pet struct for Pet +type Pet struct { + Id *int64 `json:"id,omitempty"` + Category *Category `json:"category,omitempty"` + Name string `json:"name"` + PhotoUrls []string `json:"photoUrls"` + Tags *[]Tag `json:"tags,omitempty"` + // pet status in the store + Status *string `json:"status,omitempty"` +} + +// 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 +func NewPet(name string, photoUrls []string, ) *Pet { + this := Pet{} + this.Name = name + this.PhotoUrls = photoUrls + return &this +} + +// 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 +func NewPetWithDefaults() *Pet { + this := Pet{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Pet) GetId() int64 { + if o == nil || o.Id == nil { + 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 *Pet) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Pet) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Pet) SetId(v int64) { + o.Id = &v +} + +// GetCategory returns the Category field value if set, zero value otherwise. +func (o *Pet) GetCategory() Category { + if o == nil || o.Category == nil { + var ret Category + return ret + } + return *o.Category +} + +// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Pet) GetCategoryOk() (*Category, bool) { + if o == nil || o.Category == nil { + return nil, false + } + return o.Category, true +} + +// HasCategory returns a boolean if a field has been set. +func (o *Pet) HasCategory() bool { + if o != nil && o.Category != nil { + return true + } + + return false +} + +// SetCategory gets a reference to the given Category and assigns it to the Category field. +func (o *Pet) SetCategory(v Category) { + o.Category = &v +} + +// GetName returns the Name field value +func (o *Pet) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Pet) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Pet) SetName(v string) { + o.Name = v +} + +// GetPhotoUrls returns the PhotoUrls field value +func (o *Pet) GetPhotoUrls() []string { + if o == nil { + var ret []string + return ret + } + + return o.PhotoUrls +} + +// GetPhotoUrlsOk returns a tuple with the PhotoUrls field value +// and a boolean to check if the value has been set. +func (o *Pet) GetPhotoUrlsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.PhotoUrls, true +} + +// SetPhotoUrls sets field value +func (o *Pet) SetPhotoUrls(v []string) { + o.PhotoUrls = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *Pet) GetTags() []Tag { + if o == nil || o.Tags == nil { + var ret []Tag + return ret + } + return *o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Pet) GetTagsOk() (*[]Tag, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *Pet) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []Tag and assigns it to the Tags field. +func (o *Pet) SetTags(v []Tag) { + o.Tags = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Pet) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Pet) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Pet) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Pet) SetStatus(v string) { + o.Status = &v +} + +func (o Pet) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Category != nil { + toSerialize["category"] = o.Category + } + if true { + toSerialize["name"] = o.Name + } + if true { + toSerialize["photoUrls"] = o.PhotoUrls + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + return json.Marshal(toSerialize) +} + +type NullablePet struct { + value *Pet + isSet bool +} + +func (v NullablePet) Get() *Pet { + return v.value +} + +func (v *NullablePet) Set(val *Pet) { + v.value = val + v.isSet = true +} + +func (v NullablePet) IsSet() bool { + return v.isSet +} + +func (v *NullablePet) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePet(val *Pet) *NullablePet { + return &NullablePet{value: val, isSet: true} +} + +func (v NullablePet) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePet) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_read_only_first.go b/samples/client/petstore/go/go-petstore/petstore/model_read_only_first.go new file mode 100644 index 00000000000..dd00212c1d0 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_read_only_first.go @@ -0,0 +1,150 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ReadOnlyFirst struct for ReadOnlyFirst +type ReadOnlyFirst struct { + Bar *string `json:"bar,omitempty"` + Baz *string `json:"baz,omitempty"` +} + +// NewReadOnlyFirst instantiates a new ReadOnlyFirst 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 NewReadOnlyFirst() *ReadOnlyFirst { + this := ReadOnlyFirst{} + return &this +} + +// NewReadOnlyFirstWithDefaults instantiates a new ReadOnlyFirst 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 NewReadOnlyFirstWithDefaults() *ReadOnlyFirst { + this := ReadOnlyFirst{} + return &this +} + +// GetBar returns the Bar field value if set, zero value otherwise. +func (o *ReadOnlyFirst) GetBar() string { + if o == nil || o.Bar == nil { + var ret string + return ret + } + return *o.Bar +} + +// GetBarOk returns a tuple with the Bar field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReadOnlyFirst) GetBarOk() (*string, bool) { + if o == nil || o.Bar == nil { + return nil, false + } + return o.Bar, true +} + +// HasBar returns a boolean if a field has been set. +func (o *ReadOnlyFirst) HasBar() bool { + if o != nil && o.Bar != nil { + return true + } + + return false +} + +// SetBar gets a reference to the given string and assigns it to the Bar field. +func (o *ReadOnlyFirst) SetBar(v string) { + o.Bar = &v +} + +// GetBaz returns the Baz field value if set, zero value otherwise. +func (o *ReadOnlyFirst) GetBaz() string { + if o == nil || o.Baz == nil { + var ret string + return ret + } + return *o.Baz +} + +// GetBazOk returns a tuple with the Baz field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReadOnlyFirst) GetBazOk() (*string, bool) { + if o == nil || o.Baz == nil { + return nil, false + } + return o.Baz, true +} + +// HasBaz returns a boolean if a field has been set. +func (o *ReadOnlyFirst) HasBaz() bool { + if o != nil && o.Baz != nil { + return true + } + + return false +} + +// SetBaz gets a reference to the given string and assigns it to the Baz field. +func (o *ReadOnlyFirst) SetBaz(v string) { + o.Baz = &v +} + +func (o ReadOnlyFirst) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Bar != nil { + toSerialize["bar"] = o.Bar + } + if o.Baz != nil { + toSerialize["baz"] = o.Baz + } + return json.Marshal(toSerialize) +} + +type NullableReadOnlyFirst struct { + value *ReadOnlyFirst + isSet bool +} + +func (v NullableReadOnlyFirst) Get() *ReadOnlyFirst { + return v.value +} + +func (v *NullableReadOnlyFirst) Set(val *ReadOnlyFirst) { + v.value = val + v.isSet = true +} + +func (v NullableReadOnlyFirst) IsSet() bool { + return v.isSet +} + +func (v *NullableReadOnlyFirst) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReadOnlyFirst(val *ReadOnlyFirst) *NullableReadOnlyFirst { + return &NullableReadOnlyFirst{value: val, isSet: true} +} + +func (v NullableReadOnlyFirst) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReadOnlyFirst) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_return.go b/samples/client/petstore/go/go-petstore/petstore/model_return.go new file mode 100644 index 00000000000..2ed729e12ec --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_return.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Return Model for testing reserved words +type Return struct { + Return *int32 `json:"return,omitempty"` +} + +// NewReturn instantiates a new Return 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 NewReturn() *Return { + this := Return{} + return &this +} + +// NewReturnWithDefaults instantiates a new Return 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 NewReturnWithDefaults() *Return { + this := Return{} + return &this +} + +// GetReturn returns the Return field value if set, zero value otherwise. +func (o *Return) GetReturn() int32 { + if o == nil || o.Return == nil { + var ret int32 + return ret + } + return *o.Return +} + +// GetReturnOk returns a tuple with the Return field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Return) GetReturnOk() (*int32, bool) { + if o == nil || o.Return == nil { + return nil, false + } + return o.Return, true +} + +// HasReturn returns a boolean if a field has been set. +func (o *Return) HasReturn() bool { + if o != nil && o.Return != nil { + return true + } + + return false +} + +// SetReturn gets a reference to the given int32 and assigns it to the Return field. +func (o *Return) SetReturn(v int32) { + o.Return = &v +} + +func (o Return) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Return != nil { + toSerialize["return"] = o.Return + } + return json.Marshal(toSerialize) +} + +type NullableReturn struct { + value *Return + isSet bool +} + +func (v NullableReturn) Get() *Return { + return v.value +} + +func (v *NullableReturn) Set(val *Return) { + v.value = val + v.isSet = true +} + +func (v NullableReturn) IsSet() bool { + return v.isSet +} + +func (v *NullableReturn) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReturn(val *Return) *NullableReturn { + return &NullableReturn{value: val, isSet: true} +} + +func (v NullableReturn) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReturn) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_special_model_name.go b/samples/client/petstore/go/go-petstore/petstore/model_special_model_name.go new file mode 100644 index 00000000000..bbef383b796 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_special_model_name.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// SpecialModelName struct for SpecialModelName +type SpecialModelName struct { + SpecialPropertyName *int64 `json:"$special[property.name],omitempty"` +} + +// NewSpecialModelName instantiates a new SpecialModelName 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 NewSpecialModelName() *SpecialModelName { + this := SpecialModelName{} + return &this +} + +// NewSpecialModelNameWithDefaults instantiates a new SpecialModelName 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 NewSpecialModelNameWithDefaults() *SpecialModelName { + this := SpecialModelName{} + return &this +} + +// GetSpecialPropertyName returns the SpecialPropertyName field value if set, zero value otherwise. +func (o *SpecialModelName) GetSpecialPropertyName() int64 { + if o == nil || o.SpecialPropertyName == nil { + var ret int64 + return ret + } + return *o.SpecialPropertyName +} + +// GetSpecialPropertyNameOk returns a tuple with the SpecialPropertyName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpecialModelName) GetSpecialPropertyNameOk() (*int64, bool) { + if o == nil || o.SpecialPropertyName == nil { + return nil, false + } + return o.SpecialPropertyName, true +} + +// HasSpecialPropertyName returns a boolean if a field has been set. +func (o *SpecialModelName) HasSpecialPropertyName() bool { + if o != nil && o.SpecialPropertyName != nil { + return true + } + + return false +} + +// SetSpecialPropertyName gets a reference to the given int64 and assigns it to the SpecialPropertyName field. +func (o *SpecialModelName) SetSpecialPropertyName(v int64) { + o.SpecialPropertyName = &v +} + +func (o SpecialModelName) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.SpecialPropertyName != nil { + toSerialize["$special[property.name]"] = o.SpecialPropertyName + } + return json.Marshal(toSerialize) +} + +type NullableSpecialModelName struct { + value *SpecialModelName + isSet bool +} + +func (v NullableSpecialModelName) Get() *SpecialModelName { + return v.value +} + +func (v *NullableSpecialModelName) Set(val *SpecialModelName) { + v.value = val + v.isSet = true +} + +func (v NullableSpecialModelName) IsSet() bool { + return v.isSet +} + +func (v *NullableSpecialModelName) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpecialModelName(val *SpecialModelName) *NullableSpecialModelName { + return &NullableSpecialModelName{value: val, isSet: true} +} + +func (v NullableSpecialModelName) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpecialModelName) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_tag.go b/samples/client/petstore/go/go-petstore/petstore/model_tag.go new file mode 100644 index 00000000000..99135ba946b --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_tag.go @@ -0,0 +1,150 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Tag struct for Tag +type Tag struct { + Id *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} + +// 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 +func NewTag() *Tag { + this := Tag{} + return &this +} + +// 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 +func NewTagWithDefaults() *Tag { + this := Tag{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Tag) GetId() int64 { + if o == nil || o.Id == nil { + 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 *Tag) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Tag) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Tag) SetId(v int64) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Tag) GetName() string { + if o == nil || o.Name == nil { + 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 *Tag) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Tag) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Tag) SetName(v string) { + o.Name = &v +} + +func (o Tag) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + return json.Marshal(toSerialize) +} + +type NullableTag struct { + value *Tag + isSet bool +} + +func (v NullableTag) Get() *Tag { + return v.value +} + +func (v *NullableTag) Set(val *Tag) { + v.value = val + v.isSet = true +} + +func (v NullableTag) IsSet() bool { + return v.isSet +} + +func (v *NullableTag) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTag(val *Tag) *NullableTag { + return &NullableTag{value: val, isSet: true} +} + +func (v NullableTag) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTag) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_type_holder_default.go b/samples/client/petstore/go/go-petstore/petstore/model_type_holder_default.go new file mode 100644 index 00000000000..d45748bf769 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_type_holder_default.go @@ -0,0 +1,227 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// TypeHolderDefault struct for TypeHolderDefault +type TypeHolderDefault struct { + StringItem string `json:"string_item"` + NumberItem float32 `json:"number_item"` + IntegerItem int32 `json:"integer_item"` + BoolItem bool `json:"bool_item"` + ArrayItem []int32 `json:"array_item"` +} + +// NewTypeHolderDefault instantiates a new TypeHolderDefault 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 NewTypeHolderDefault(stringItem string, numberItem float32, integerItem int32, boolItem bool, arrayItem []int32, ) *TypeHolderDefault { + this := TypeHolderDefault{} + this.StringItem = stringItem + this.NumberItem = numberItem + this.IntegerItem = integerItem + this.BoolItem = boolItem + this.ArrayItem = arrayItem + return &this +} + +// NewTypeHolderDefaultWithDefaults instantiates a new TypeHolderDefault 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 NewTypeHolderDefaultWithDefaults() *TypeHolderDefault { + this := TypeHolderDefault{} + var stringItem string = "what" + this.StringItem = stringItem + var boolItem bool = true + this.BoolItem = boolItem + return &this +} + +// GetStringItem returns the StringItem field value +func (o *TypeHolderDefault) GetStringItem() string { + if o == nil { + var ret string + return ret + } + + return o.StringItem +} + +// GetStringItemOk returns a tuple with the StringItem field value +// and a boolean to check if the value has been set. +func (o *TypeHolderDefault) GetStringItemOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.StringItem, true +} + +// SetStringItem sets field value +func (o *TypeHolderDefault) SetStringItem(v string) { + o.StringItem = v +} + +// GetNumberItem returns the NumberItem field value +func (o *TypeHolderDefault) GetNumberItem() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.NumberItem +} + +// GetNumberItemOk returns a tuple with the NumberItem field value +// and a boolean to check if the value has been set. +func (o *TypeHolderDefault) GetNumberItemOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.NumberItem, true +} + +// SetNumberItem sets field value +func (o *TypeHolderDefault) SetNumberItem(v float32) { + o.NumberItem = v +} + +// GetIntegerItem returns the IntegerItem field value +func (o *TypeHolderDefault) GetIntegerItem() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.IntegerItem +} + +// GetIntegerItemOk returns a tuple with the IntegerItem field value +// and a boolean to check if the value has been set. +func (o *TypeHolderDefault) GetIntegerItemOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.IntegerItem, true +} + +// SetIntegerItem sets field value +func (o *TypeHolderDefault) SetIntegerItem(v int32) { + o.IntegerItem = v +} + +// GetBoolItem returns the BoolItem field value +func (o *TypeHolderDefault) GetBoolItem() bool { + if o == nil { + var ret bool + return ret + } + + return o.BoolItem +} + +// GetBoolItemOk returns a tuple with the BoolItem field value +// and a boolean to check if the value has been set. +func (o *TypeHolderDefault) GetBoolItemOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.BoolItem, true +} + +// SetBoolItem sets field value +func (o *TypeHolderDefault) SetBoolItem(v bool) { + o.BoolItem = v +} + +// GetArrayItem returns the ArrayItem field value +func (o *TypeHolderDefault) GetArrayItem() []int32 { + if o == nil { + var ret []int32 + return ret + } + + return o.ArrayItem +} + +// GetArrayItemOk returns a tuple with the ArrayItem field value +// and a boolean to check if the value has been set. +func (o *TypeHolderDefault) GetArrayItemOk() (*[]int32, bool) { + if o == nil { + return nil, false + } + return &o.ArrayItem, true +} + +// SetArrayItem sets field value +func (o *TypeHolderDefault) SetArrayItem(v []int32) { + o.ArrayItem = v +} + +func (o TypeHolderDefault) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["string_item"] = o.StringItem + } + if true { + toSerialize["number_item"] = o.NumberItem + } + if true { + toSerialize["integer_item"] = o.IntegerItem + } + if true { + toSerialize["bool_item"] = o.BoolItem + } + if true { + toSerialize["array_item"] = o.ArrayItem + } + return json.Marshal(toSerialize) +} + +type NullableTypeHolderDefault struct { + value *TypeHolderDefault + isSet bool +} + +func (v NullableTypeHolderDefault) Get() *TypeHolderDefault { + return v.value +} + +func (v *NullableTypeHolderDefault) Set(val *TypeHolderDefault) { + v.value = val + v.isSet = true +} + +func (v NullableTypeHolderDefault) IsSet() bool { + return v.isSet +} + +func (v *NullableTypeHolderDefault) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTypeHolderDefault(val *TypeHolderDefault) *NullableTypeHolderDefault { + return &NullableTypeHolderDefault{value: val, isSet: true} +} + +func (v NullableTypeHolderDefault) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTypeHolderDefault) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_type_holder_example.go b/samples/client/petstore/go/go-petstore/petstore/model_type_holder_example.go new file mode 100644 index 00000000000..3f74c433f71 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_type_holder_example.go @@ -0,0 +1,252 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// TypeHolderExample struct for TypeHolderExample +type TypeHolderExample struct { + StringItem string `json:"string_item"` + NumberItem float32 `json:"number_item"` + FloatItem float32 `json:"float_item"` + IntegerItem int32 `json:"integer_item"` + BoolItem bool `json:"bool_item"` + ArrayItem []int32 `json:"array_item"` +} + +// NewTypeHolderExample instantiates a new TypeHolderExample 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 NewTypeHolderExample(stringItem string, numberItem float32, floatItem float32, integerItem int32, boolItem bool, arrayItem []int32, ) *TypeHolderExample { + this := TypeHolderExample{} + this.StringItem = stringItem + this.NumberItem = numberItem + this.FloatItem = floatItem + this.IntegerItem = integerItem + this.BoolItem = boolItem + this.ArrayItem = arrayItem + return &this +} + +// NewTypeHolderExampleWithDefaults instantiates a new TypeHolderExample 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 NewTypeHolderExampleWithDefaults() *TypeHolderExample { + this := TypeHolderExample{} + return &this +} + +// GetStringItem returns the StringItem field value +func (o *TypeHolderExample) GetStringItem() string { + if o == nil { + var ret string + return ret + } + + return o.StringItem +} + +// GetStringItemOk returns a tuple with the StringItem field value +// and a boolean to check if the value has been set. +func (o *TypeHolderExample) GetStringItemOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.StringItem, true +} + +// SetStringItem sets field value +func (o *TypeHolderExample) SetStringItem(v string) { + o.StringItem = v +} + +// GetNumberItem returns the NumberItem field value +func (o *TypeHolderExample) GetNumberItem() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.NumberItem +} + +// GetNumberItemOk returns a tuple with the NumberItem field value +// and a boolean to check if the value has been set. +func (o *TypeHolderExample) GetNumberItemOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.NumberItem, true +} + +// SetNumberItem sets field value +func (o *TypeHolderExample) SetNumberItem(v float32) { + o.NumberItem = v +} + +// GetFloatItem returns the FloatItem field value +func (o *TypeHolderExample) GetFloatItem() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.FloatItem +} + +// GetFloatItemOk returns a tuple with the FloatItem field value +// and a boolean to check if the value has been set. +func (o *TypeHolderExample) GetFloatItemOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.FloatItem, true +} + +// SetFloatItem sets field value +func (o *TypeHolderExample) SetFloatItem(v float32) { + o.FloatItem = v +} + +// GetIntegerItem returns the IntegerItem field value +func (o *TypeHolderExample) GetIntegerItem() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.IntegerItem +} + +// GetIntegerItemOk returns a tuple with the IntegerItem field value +// and a boolean to check if the value has been set. +func (o *TypeHolderExample) GetIntegerItemOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.IntegerItem, true +} + +// SetIntegerItem sets field value +func (o *TypeHolderExample) SetIntegerItem(v int32) { + o.IntegerItem = v +} + +// GetBoolItem returns the BoolItem field value +func (o *TypeHolderExample) GetBoolItem() bool { + if o == nil { + var ret bool + return ret + } + + return o.BoolItem +} + +// GetBoolItemOk returns a tuple with the BoolItem field value +// and a boolean to check if the value has been set. +func (o *TypeHolderExample) GetBoolItemOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.BoolItem, true +} + +// SetBoolItem sets field value +func (o *TypeHolderExample) SetBoolItem(v bool) { + o.BoolItem = v +} + +// GetArrayItem returns the ArrayItem field value +func (o *TypeHolderExample) GetArrayItem() []int32 { + if o == nil { + var ret []int32 + return ret + } + + return o.ArrayItem +} + +// GetArrayItemOk returns a tuple with the ArrayItem field value +// and a boolean to check if the value has been set. +func (o *TypeHolderExample) GetArrayItemOk() (*[]int32, bool) { + if o == nil { + return nil, false + } + return &o.ArrayItem, true +} + +// SetArrayItem sets field value +func (o *TypeHolderExample) SetArrayItem(v []int32) { + o.ArrayItem = v +} + +func (o TypeHolderExample) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["string_item"] = o.StringItem + } + if true { + toSerialize["number_item"] = o.NumberItem + } + if true { + toSerialize["float_item"] = o.FloatItem + } + if true { + toSerialize["integer_item"] = o.IntegerItem + } + if true { + toSerialize["bool_item"] = o.BoolItem + } + if true { + toSerialize["array_item"] = o.ArrayItem + } + return json.Marshal(toSerialize) +} + +type NullableTypeHolderExample struct { + value *TypeHolderExample + isSet bool +} + +func (v NullableTypeHolderExample) Get() *TypeHolderExample { + return v.value +} + +func (v *NullableTypeHolderExample) Set(val *TypeHolderExample) { + v.value = val + v.isSet = true +} + +func (v NullableTypeHolderExample) IsSet() bool { + return v.isSet +} + +func (v *NullableTypeHolderExample) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTypeHolderExample(val *TypeHolderExample) *NullableTypeHolderExample { + return &NullableTypeHolderExample{value: val, isSet: true} +} + +func (v NullableTypeHolderExample) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTypeHolderExample) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_user.go b/samples/client/petstore/go/go-petstore/petstore/model_user.go new file mode 100644 index 00000000000..7dff4e8b36b --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_user.go @@ -0,0 +1,367 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// User struct for User +type User struct { + Id *int64 `json:"id,omitempty"` + Username *string `json:"username,omitempty"` + FirstName *string `json:"firstName,omitempty"` + LastName *string `json:"lastName,omitempty"` + Email *string `json:"email,omitempty"` + Password *string `json:"password,omitempty"` + Phone *string `json:"phone,omitempty"` + // User Status + UserStatus *int32 `json:"userStatus,omitempty"` +} + +// NewUser instantiates a new User 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 NewUser() *User { + this := User{} + return &this +} + +// NewUserWithDefaults instantiates a new User 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 NewUserWithDefaults() *User { + this := User{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *User) GetId() int64 { + if o == nil || o.Id == nil { + 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 *User) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *User) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *User) SetId(v int64) { + o.Id = &v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *User) GetUsername() string { + if o == nil || o.Username == nil { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetUsernameOk() (*string, bool) { + if o == nil || o.Username == nil { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *User) HasUsername() bool { + if o != nil && o.Username != nil { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *User) SetUsername(v string) { + o.Username = &v +} + +// GetFirstName returns the FirstName field value if set, zero value otherwise. +func (o *User) GetFirstName() string { + if o == nil || o.FirstName == nil { + var ret string + return ret + } + return *o.FirstName +} + +// GetFirstNameOk returns a tuple with the FirstName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetFirstNameOk() (*string, bool) { + if o == nil || o.FirstName == nil { + return nil, false + } + return o.FirstName, true +} + +// HasFirstName returns a boolean if a field has been set. +func (o *User) HasFirstName() bool { + if o != nil && o.FirstName != nil { + return true + } + + return false +} + +// SetFirstName gets a reference to the given string and assigns it to the FirstName field. +func (o *User) SetFirstName(v string) { + o.FirstName = &v +} + +// GetLastName returns the LastName field value if set, zero value otherwise. +func (o *User) GetLastName() string { + if o == nil || o.LastName == nil { + var ret string + return ret + } + return *o.LastName +} + +// GetLastNameOk returns a tuple with the LastName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetLastNameOk() (*string, bool) { + if o == nil || o.LastName == nil { + return nil, false + } + return o.LastName, true +} + +// HasLastName returns a boolean if a field has been set. +func (o *User) HasLastName() bool { + if o != nil && o.LastName != nil { + return true + } + + return false +} + +// SetLastName gets a reference to the given string and assigns it to the LastName field. +func (o *User) SetLastName(v string) { + o.LastName = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *User) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *User) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *User) SetEmail(v string) { + o.Email = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *User) GetPassword() string { + if o == nil || o.Password == nil { + var ret string + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetPasswordOk() (*string, bool) { + if o == nil || o.Password == nil { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *User) HasPassword() bool { + if o != nil && o.Password != nil { + return true + } + + return false +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *User) SetPassword(v string) { + o.Password = &v +} + +// GetPhone returns the Phone field value if set, zero value otherwise. +func (o *User) GetPhone() string { + if o == nil || o.Phone == nil { + var ret string + return ret + } + return *o.Phone +} + +// GetPhoneOk returns a tuple with the Phone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetPhoneOk() (*string, bool) { + if o == nil || o.Phone == nil { + return nil, false + } + return o.Phone, true +} + +// HasPhone returns a boolean if a field has been set. +func (o *User) HasPhone() bool { + if o != nil && o.Phone != nil { + return true + } + + return false +} + +// SetPhone gets a reference to the given string and assigns it to the Phone field. +func (o *User) SetPhone(v string) { + o.Phone = &v +} + +// GetUserStatus returns the UserStatus field value if set, zero value otherwise. +func (o *User) GetUserStatus() int32 { + if o == nil || o.UserStatus == nil { + var ret int32 + return ret + } + return *o.UserStatus +} + +// GetUserStatusOk returns a tuple with the UserStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetUserStatusOk() (*int32, bool) { + if o == nil || o.UserStatus == nil { + return nil, false + } + return o.UserStatus, true +} + +// HasUserStatus returns a boolean if a field has been set. +func (o *User) HasUserStatus() bool { + if o != nil && o.UserStatus != nil { + return true + } + + return false +} + +// SetUserStatus gets a reference to the given int32 and assigns it to the UserStatus field. +func (o *User) SetUserStatus(v int32) { + o.UserStatus = &v +} + +func (o User) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Username != nil { + toSerialize["username"] = o.Username + } + if o.FirstName != nil { + toSerialize["firstName"] = o.FirstName + } + if o.LastName != nil { + toSerialize["lastName"] = o.LastName + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Password != nil { + toSerialize["password"] = o.Password + } + if o.Phone != nil { + toSerialize["phone"] = o.Phone + } + if o.UserStatus != nil { + toSerialize["userStatus"] = o.UserStatus + } + return json.Marshal(toSerialize) +} + +type NullableUser struct { + value *User + isSet bool +} + +func (v NullableUser) Get() *User { + return v.value +} + +func (v *NullableUser) Set(val *User) { + v.value = val + v.isSet = true +} + +func (v NullableUser) IsSet() bool { + return v.isSet +} + +func (v *NullableUser) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUser(val *User) *NullableUser { + return &NullableUser{value: val, isSet: true} +} + +func (v NullableUser) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUser) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/petstore/model_xml_item.go b/samples/client/petstore/go/go-petstore/petstore/model_xml_item.go new file mode 100644 index 00000000000..8bf7f3ef707 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/petstore/model_xml_item.go @@ -0,0 +1,1122 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// XmlItem struct for XmlItem +type XmlItem struct { + AttributeString *string `json:"attribute_string,omitempty"` + AttributeNumber *float32 `json:"attribute_number,omitempty"` + AttributeInteger *int32 `json:"attribute_integer,omitempty"` + AttributeBoolean *bool `json:"attribute_boolean,omitempty"` + WrappedArray *[]int32 `json:"wrapped_array,omitempty"` + NameString *string `json:"name_string,omitempty"` + NameNumber *float32 `json:"name_number,omitempty"` + NameInteger *int32 `json:"name_integer,omitempty"` + NameBoolean *bool `json:"name_boolean,omitempty"` + NameArray *[]int32 `json:"name_array,omitempty"` + NameWrappedArray *[]int32 `json:"name_wrapped_array,omitempty"` + PrefixString *string `json:"prefix_string,omitempty"` + PrefixNumber *float32 `json:"prefix_number,omitempty"` + PrefixInteger *int32 `json:"prefix_integer,omitempty"` + PrefixBoolean *bool `json:"prefix_boolean,omitempty"` + PrefixArray *[]int32 `json:"prefix_array,omitempty"` + PrefixWrappedArray *[]int32 `json:"prefix_wrapped_array,omitempty"` + NamespaceString *string `json:"namespace_string,omitempty"` + NamespaceNumber *float32 `json:"namespace_number,omitempty"` + NamespaceInteger *int32 `json:"namespace_integer,omitempty"` + NamespaceBoolean *bool `json:"namespace_boolean,omitempty"` + NamespaceArray *[]int32 `json:"namespace_array,omitempty"` + NamespaceWrappedArray *[]int32 `json:"namespace_wrapped_array,omitempty"` + PrefixNsString *string `json:"prefix_ns_string,omitempty"` + PrefixNsNumber *float32 `json:"prefix_ns_number,omitempty"` + PrefixNsInteger *int32 `json:"prefix_ns_integer,omitempty"` + PrefixNsBoolean *bool `json:"prefix_ns_boolean,omitempty"` + PrefixNsArray *[]int32 `json:"prefix_ns_array,omitempty"` + PrefixNsWrappedArray *[]int32 `json:"prefix_ns_wrapped_array,omitempty"` +} + +// NewXmlItem instantiates a new XmlItem 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 NewXmlItem() *XmlItem { + this := XmlItem{} + return &this +} + +// NewXmlItemWithDefaults instantiates a new XmlItem 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 NewXmlItemWithDefaults() *XmlItem { + this := XmlItem{} + return &this +} + +// GetAttributeString returns the AttributeString field value if set, zero value otherwise. +func (o *XmlItem) GetAttributeString() string { + if o == nil || o.AttributeString == nil { + var ret string + return ret + } + return *o.AttributeString +} + +// GetAttributeStringOk returns a tuple with the AttributeString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetAttributeStringOk() (*string, bool) { + if o == nil || o.AttributeString == nil { + return nil, false + } + return o.AttributeString, true +} + +// HasAttributeString returns a boolean if a field has been set. +func (o *XmlItem) HasAttributeString() bool { + if o != nil && o.AttributeString != nil { + return true + } + + return false +} + +// SetAttributeString gets a reference to the given string and assigns it to the AttributeString field. +func (o *XmlItem) SetAttributeString(v string) { + o.AttributeString = &v +} + +// GetAttributeNumber returns the AttributeNumber field value if set, zero value otherwise. +func (o *XmlItem) GetAttributeNumber() float32 { + if o == nil || o.AttributeNumber == nil { + var ret float32 + return ret + } + return *o.AttributeNumber +} + +// GetAttributeNumberOk returns a tuple with the AttributeNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetAttributeNumberOk() (*float32, bool) { + if o == nil || o.AttributeNumber == nil { + return nil, false + } + return o.AttributeNumber, true +} + +// HasAttributeNumber returns a boolean if a field has been set. +func (o *XmlItem) HasAttributeNumber() bool { + if o != nil && o.AttributeNumber != nil { + return true + } + + return false +} + +// SetAttributeNumber gets a reference to the given float32 and assigns it to the AttributeNumber field. +func (o *XmlItem) SetAttributeNumber(v float32) { + o.AttributeNumber = &v +} + +// GetAttributeInteger returns the AttributeInteger field value if set, zero value otherwise. +func (o *XmlItem) GetAttributeInteger() int32 { + if o == nil || o.AttributeInteger == nil { + var ret int32 + return ret + } + return *o.AttributeInteger +} + +// GetAttributeIntegerOk returns a tuple with the AttributeInteger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetAttributeIntegerOk() (*int32, bool) { + if o == nil || o.AttributeInteger == nil { + return nil, false + } + return o.AttributeInteger, true +} + +// HasAttributeInteger returns a boolean if a field has been set. +func (o *XmlItem) HasAttributeInteger() bool { + if o != nil && o.AttributeInteger != nil { + return true + } + + return false +} + +// SetAttributeInteger gets a reference to the given int32 and assigns it to the AttributeInteger field. +func (o *XmlItem) SetAttributeInteger(v int32) { + o.AttributeInteger = &v +} + +// GetAttributeBoolean returns the AttributeBoolean field value if set, zero value otherwise. +func (o *XmlItem) GetAttributeBoolean() bool { + if o == nil || o.AttributeBoolean == nil { + var ret bool + return ret + } + return *o.AttributeBoolean +} + +// GetAttributeBooleanOk returns a tuple with the AttributeBoolean field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetAttributeBooleanOk() (*bool, bool) { + if o == nil || o.AttributeBoolean == nil { + return nil, false + } + return o.AttributeBoolean, true +} + +// HasAttributeBoolean returns a boolean if a field has been set. +func (o *XmlItem) HasAttributeBoolean() bool { + if o != nil && o.AttributeBoolean != nil { + return true + } + + return false +} + +// SetAttributeBoolean gets a reference to the given bool and assigns it to the AttributeBoolean field. +func (o *XmlItem) SetAttributeBoolean(v bool) { + o.AttributeBoolean = &v +} + +// GetWrappedArray returns the WrappedArray field value if set, zero value otherwise. +func (o *XmlItem) GetWrappedArray() []int32 { + if o == nil || o.WrappedArray == nil { + var ret []int32 + return ret + } + return *o.WrappedArray +} + +// GetWrappedArrayOk returns a tuple with the WrappedArray field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetWrappedArrayOk() (*[]int32, bool) { + if o == nil || o.WrappedArray == nil { + return nil, false + } + return o.WrappedArray, true +} + +// HasWrappedArray returns a boolean if a field has been set. +func (o *XmlItem) HasWrappedArray() bool { + if o != nil && o.WrappedArray != nil { + return true + } + + return false +} + +// SetWrappedArray gets a reference to the given []int32 and assigns it to the WrappedArray field. +func (o *XmlItem) SetWrappedArray(v []int32) { + o.WrappedArray = &v +} + +// GetNameString returns the NameString field value if set, zero value otherwise. +func (o *XmlItem) GetNameString() string { + if o == nil || o.NameString == nil { + var ret string + return ret + } + return *o.NameString +} + +// GetNameStringOk returns a tuple with the NameString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetNameStringOk() (*string, bool) { + if o == nil || o.NameString == nil { + return nil, false + } + return o.NameString, true +} + +// HasNameString returns a boolean if a field has been set. +func (o *XmlItem) HasNameString() bool { + if o != nil && o.NameString != nil { + return true + } + + return false +} + +// SetNameString gets a reference to the given string and assigns it to the NameString field. +func (o *XmlItem) SetNameString(v string) { + o.NameString = &v +} + +// GetNameNumber returns the NameNumber field value if set, zero value otherwise. +func (o *XmlItem) GetNameNumber() float32 { + if o == nil || o.NameNumber == nil { + var ret float32 + return ret + } + return *o.NameNumber +} + +// GetNameNumberOk returns a tuple with the NameNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetNameNumberOk() (*float32, bool) { + if o == nil || o.NameNumber == nil { + return nil, false + } + return o.NameNumber, true +} + +// HasNameNumber returns a boolean if a field has been set. +func (o *XmlItem) HasNameNumber() bool { + if o != nil && o.NameNumber != nil { + return true + } + + return false +} + +// SetNameNumber gets a reference to the given float32 and assigns it to the NameNumber field. +func (o *XmlItem) SetNameNumber(v float32) { + o.NameNumber = &v +} + +// GetNameInteger returns the NameInteger field value if set, zero value otherwise. +func (o *XmlItem) GetNameInteger() int32 { + if o == nil || o.NameInteger == nil { + var ret int32 + return ret + } + return *o.NameInteger +} + +// GetNameIntegerOk returns a tuple with the NameInteger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetNameIntegerOk() (*int32, bool) { + if o == nil || o.NameInteger == nil { + return nil, false + } + return o.NameInteger, true +} + +// HasNameInteger returns a boolean if a field has been set. +func (o *XmlItem) HasNameInteger() bool { + if o != nil && o.NameInteger != nil { + return true + } + + return false +} + +// SetNameInteger gets a reference to the given int32 and assigns it to the NameInteger field. +func (o *XmlItem) SetNameInteger(v int32) { + o.NameInteger = &v +} + +// GetNameBoolean returns the NameBoolean field value if set, zero value otherwise. +func (o *XmlItem) GetNameBoolean() bool { + if o == nil || o.NameBoolean == nil { + var ret bool + return ret + } + return *o.NameBoolean +} + +// GetNameBooleanOk returns a tuple with the NameBoolean field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetNameBooleanOk() (*bool, bool) { + if o == nil || o.NameBoolean == nil { + return nil, false + } + return o.NameBoolean, true +} + +// HasNameBoolean returns a boolean if a field has been set. +func (o *XmlItem) HasNameBoolean() bool { + if o != nil && o.NameBoolean != nil { + return true + } + + return false +} + +// SetNameBoolean gets a reference to the given bool and assigns it to the NameBoolean field. +func (o *XmlItem) SetNameBoolean(v bool) { + o.NameBoolean = &v +} + +// GetNameArray returns the NameArray field value if set, zero value otherwise. +func (o *XmlItem) GetNameArray() []int32 { + if o == nil || o.NameArray == nil { + var ret []int32 + return ret + } + return *o.NameArray +} + +// GetNameArrayOk returns a tuple with the NameArray field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetNameArrayOk() (*[]int32, bool) { + if o == nil || o.NameArray == nil { + return nil, false + } + return o.NameArray, true +} + +// HasNameArray returns a boolean if a field has been set. +func (o *XmlItem) HasNameArray() bool { + if o != nil && o.NameArray != nil { + return true + } + + return false +} + +// SetNameArray gets a reference to the given []int32 and assigns it to the NameArray field. +func (o *XmlItem) SetNameArray(v []int32) { + o.NameArray = &v +} + +// GetNameWrappedArray returns the NameWrappedArray field value if set, zero value otherwise. +func (o *XmlItem) GetNameWrappedArray() []int32 { + if o == nil || o.NameWrappedArray == nil { + var ret []int32 + return ret + } + return *o.NameWrappedArray +} + +// GetNameWrappedArrayOk returns a tuple with the NameWrappedArray field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetNameWrappedArrayOk() (*[]int32, bool) { + if o == nil || o.NameWrappedArray == nil { + return nil, false + } + return o.NameWrappedArray, true +} + +// HasNameWrappedArray returns a boolean if a field has been set. +func (o *XmlItem) HasNameWrappedArray() bool { + if o != nil && o.NameWrappedArray != nil { + return true + } + + return false +} + +// SetNameWrappedArray gets a reference to the given []int32 and assigns it to the NameWrappedArray field. +func (o *XmlItem) SetNameWrappedArray(v []int32) { + o.NameWrappedArray = &v +} + +// GetPrefixString returns the PrefixString field value if set, zero value otherwise. +func (o *XmlItem) GetPrefixString() string { + if o == nil || o.PrefixString == nil { + var ret string + return ret + } + return *o.PrefixString +} + +// GetPrefixStringOk returns a tuple with the PrefixString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetPrefixStringOk() (*string, bool) { + if o == nil || o.PrefixString == nil { + return nil, false + } + return o.PrefixString, true +} + +// HasPrefixString returns a boolean if a field has been set. +func (o *XmlItem) HasPrefixString() bool { + if o != nil && o.PrefixString != nil { + return true + } + + return false +} + +// SetPrefixString gets a reference to the given string and assigns it to the PrefixString field. +func (o *XmlItem) SetPrefixString(v string) { + o.PrefixString = &v +} + +// GetPrefixNumber returns the PrefixNumber field value if set, zero value otherwise. +func (o *XmlItem) GetPrefixNumber() float32 { + if o == nil || o.PrefixNumber == nil { + var ret float32 + return ret + } + return *o.PrefixNumber +} + +// GetPrefixNumberOk returns a tuple with the PrefixNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetPrefixNumberOk() (*float32, bool) { + if o == nil || o.PrefixNumber == nil { + return nil, false + } + return o.PrefixNumber, true +} + +// HasPrefixNumber returns a boolean if a field has been set. +func (o *XmlItem) HasPrefixNumber() bool { + if o != nil && o.PrefixNumber != nil { + return true + } + + return false +} + +// SetPrefixNumber gets a reference to the given float32 and assigns it to the PrefixNumber field. +func (o *XmlItem) SetPrefixNumber(v float32) { + o.PrefixNumber = &v +} + +// GetPrefixInteger returns the PrefixInteger field value if set, zero value otherwise. +func (o *XmlItem) GetPrefixInteger() int32 { + if o == nil || o.PrefixInteger == nil { + var ret int32 + return ret + } + return *o.PrefixInteger +} + +// GetPrefixIntegerOk returns a tuple with the PrefixInteger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetPrefixIntegerOk() (*int32, bool) { + if o == nil || o.PrefixInteger == nil { + return nil, false + } + return o.PrefixInteger, true +} + +// HasPrefixInteger returns a boolean if a field has been set. +func (o *XmlItem) HasPrefixInteger() bool { + if o != nil && o.PrefixInteger != nil { + return true + } + + return false +} + +// SetPrefixInteger gets a reference to the given int32 and assigns it to the PrefixInteger field. +func (o *XmlItem) SetPrefixInteger(v int32) { + o.PrefixInteger = &v +} + +// GetPrefixBoolean returns the PrefixBoolean field value if set, zero value otherwise. +func (o *XmlItem) GetPrefixBoolean() bool { + if o == nil || o.PrefixBoolean == nil { + var ret bool + return ret + } + return *o.PrefixBoolean +} + +// GetPrefixBooleanOk returns a tuple with the PrefixBoolean field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetPrefixBooleanOk() (*bool, bool) { + if o == nil || o.PrefixBoolean == nil { + return nil, false + } + return o.PrefixBoolean, true +} + +// HasPrefixBoolean returns a boolean if a field has been set. +func (o *XmlItem) HasPrefixBoolean() bool { + if o != nil && o.PrefixBoolean != nil { + return true + } + + return false +} + +// SetPrefixBoolean gets a reference to the given bool and assigns it to the PrefixBoolean field. +func (o *XmlItem) SetPrefixBoolean(v bool) { + o.PrefixBoolean = &v +} + +// GetPrefixArray returns the PrefixArray field value if set, zero value otherwise. +func (o *XmlItem) GetPrefixArray() []int32 { + if o == nil || o.PrefixArray == nil { + var ret []int32 + return ret + } + return *o.PrefixArray +} + +// GetPrefixArrayOk returns a tuple with the PrefixArray field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetPrefixArrayOk() (*[]int32, bool) { + if o == nil || o.PrefixArray == nil { + return nil, false + } + return o.PrefixArray, true +} + +// HasPrefixArray returns a boolean if a field has been set. +func (o *XmlItem) HasPrefixArray() bool { + if o != nil && o.PrefixArray != nil { + return true + } + + return false +} + +// SetPrefixArray gets a reference to the given []int32 and assigns it to the PrefixArray field. +func (o *XmlItem) SetPrefixArray(v []int32) { + o.PrefixArray = &v +} + +// GetPrefixWrappedArray returns the PrefixWrappedArray field value if set, zero value otherwise. +func (o *XmlItem) GetPrefixWrappedArray() []int32 { + if o == nil || o.PrefixWrappedArray == nil { + var ret []int32 + return ret + } + return *o.PrefixWrappedArray +} + +// GetPrefixWrappedArrayOk returns a tuple with the PrefixWrappedArray field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetPrefixWrappedArrayOk() (*[]int32, bool) { + if o == nil || o.PrefixWrappedArray == nil { + return nil, false + } + return o.PrefixWrappedArray, true +} + +// HasPrefixWrappedArray returns a boolean if a field has been set. +func (o *XmlItem) HasPrefixWrappedArray() bool { + if o != nil && o.PrefixWrappedArray != nil { + return true + } + + return false +} + +// SetPrefixWrappedArray gets a reference to the given []int32 and assigns it to the PrefixWrappedArray field. +func (o *XmlItem) SetPrefixWrappedArray(v []int32) { + o.PrefixWrappedArray = &v +} + +// GetNamespaceString returns the NamespaceString field value if set, zero value otherwise. +func (o *XmlItem) GetNamespaceString() string { + if o == nil || o.NamespaceString == nil { + var ret string + return ret + } + return *o.NamespaceString +} + +// GetNamespaceStringOk returns a tuple with the NamespaceString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetNamespaceStringOk() (*string, bool) { + if o == nil || o.NamespaceString == nil { + return nil, false + } + return o.NamespaceString, true +} + +// HasNamespaceString returns a boolean if a field has been set. +func (o *XmlItem) HasNamespaceString() bool { + if o != nil && o.NamespaceString != nil { + return true + } + + return false +} + +// SetNamespaceString gets a reference to the given string and assigns it to the NamespaceString field. +func (o *XmlItem) SetNamespaceString(v string) { + o.NamespaceString = &v +} + +// GetNamespaceNumber returns the NamespaceNumber field value if set, zero value otherwise. +func (o *XmlItem) GetNamespaceNumber() float32 { + if o == nil || o.NamespaceNumber == nil { + var ret float32 + return ret + } + return *o.NamespaceNumber +} + +// GetNamespaceNumberOk returns a tuple with the NamespaceNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetNamespaceNumberOk() (*float32, bool) { + if o == nil || o.NamespaceNumber == nil { + return nil, false + } + return o.NamespaceNumber, true +} + +// HasNamespaceNumber returns a boolean if a field has been set. +func (o *XmlItem) HasNamespaceNumber() bool { + if o != nil && o.NamespaceNumber != nil { + return true + } + + return false +} + +// SetNamespaceNumber gets a reference to the given float32 and assigns it to the NamespaceNumber field. +func (o *XmlItem) SetNamespaceNumber(v float32) { + o.NamespaceNumber = &v +} + +// GetNamespaceInteger returns the NamespaceInteger field value if set, zero value otherwise. +func (o *XmlItem) GetNamespaceInteger() int32 { + if o == nil || o.NamespaceInteger == nil { + var ret int32 + return ret + } + return *o.NamespaceInteger +} + +// GetNamespaceIntegerOk returns a tuple with the NamespaceInteger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetNamespaceIntegerOk() (*int32, bool) { + if o == nil || o.NamespaceInteger == nil { + return nil, false + } + return o.NamespaceInteger, true +} + +// HasNamespaceInteger returns a boolean if a field has been set. +func (o *XmlItem) HasNamespaceInteger() bool { + if o != nil && o.NamespaceInteger != nil { + return true + } + + return false +} + +// SetNamespaceInteger gets a reference to the given int32 and assigns it to the NamespaceInteger field. +func (o *XmlItem) SetNamespaceInteger(v int32) { + o.NamespaceInteger = &v +} + +// GetNamespaceBoolean returns the NamespaceBoolean field value if set, zero value otherwise. +func (o *XmlItem) GetNamespaceBoolean() bool { + if o == nil || o.NamespaceBoolean == nil { + var ret bool + return ret + } + return *o.NamespaceBoolean +} + +// GetNamespaceBooleanOk returns a tuple with the NamespaceBoolean field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetNamespaceBooleanOk() (*bool, bool) { + if o == nil || o.NamespaceBoolean == nil { + return nil, false + } + return o.NamespaceBoolean, true +} + +// HasNamespaceBoolean returns a boolean if a field has been set. +func (o *XmlItem) HasNamespaceBoolean() bool { + if o != nil && o.NamespaceBoolean != nil { + return true + } + + return false +} + +// SetNamespaceBoolean gets a reference to the given bool and assigns it to the NamespaceBoolean field. +func (o *XmlItem) SetNamespaceBoolean(v bool) { + o.NamespaceBoolean = &v +} + +// GetNamespaceArray returns the NamespaceArray field value if set, zero value otherwise. +func (o *XmlItem) GetNamespaceArray() []int32 { + if o == nil || o.NamespaceArray == nil { + var ret []int32 + return ret + } + return *o.NamespaceArray +} + +// GetNamespaceArrayOk returns a tuple with the NamespaceArray field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetNamespaceArrayOk() (*[]int32, bool) { + if o == nil || o.NamespaceArray == nil { + return nil, false + } + return o.NamespaceArray, true +} + +// HasNamespaceArray returns a boolean if a field has been set. +func (o *XmlItem) HasNamespaceArray() bool { + if o != nil && o.NamespaceArray != nil { + return true + } + + return false +} + +// SetNamespaceArray gets a reference to the given []int32 and assigns it to the NamespaceArray field. +func (o *XmlItem) SetNamespaceArray(v []int32) { + o.NamespaceArray = &v +} + +// GetNamespaceWrappedArray returns the NamespaceWrappedArray field value if set, zero value otherwise. +func (o *XmlItem) GetNamespaceWrappedArray() []int32 { + if o == nil || o.NamespaceWrappedArray == nil { + var ret []int32 + return ret + } + return *o.NamespaceWrappedArray +} + +// GetNamespaceWrappedArrayOk returns a tuple with the NamespaceWrappedArray field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetNamespaceWrappedArrayOk() (*[]int32, bool) { + if o == nil || o.NamespaceWrappedArray == nil { + return nil, false + } + return o.NamespaceWrappedArray, true +} + +// HasNamespaceWrappedArray returns a boolean if a field has been set. +func (o *XmlItem) HasNamespaceWrappedArray() bool { + if o != nil && o.NamespaceWrappedArray != nil { + return true + } + + return false +} + +// SetNamespaceWrappedArray gets a reference to the given []int32 and assigns it to the NamespaceWrappedArray field. +func (o *XmlItem) SetNamespaceWrappedArray(v []int32) { + o.NamespaceWrappedArray = &v +} + +// GetPrefixNsString returns the PrefixNsString field value if set, zero value otherwise. +func (o *XmlItem) GetPrefixNsString() string { + if o == nil || o.PrefixNsString == nil { + var ret string + return ret + } + return *o.PrefixNsString +} + +// GetPrefixNsStringOk returns a tuple with the PrefixNsString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetPrefixNsStringOk() (*string, bool) { + if o == nil || o.PrefixNsString == nil { + return nil, false + } + return o.PrefixNsString, true +} + +// HasPrefixNsString returns a boolean if a field has been set. +func (o *XmlItem) HasPrefixNsString() bool { + if o != nil && o.PrefixNsString != nil { + return true + } + + return false +} + +// SetPrefixNsString gets a reference to the given string and assigns it to the PrefixNsString field. +func (o *XmlItem) SetPrefixNsString(v string) { + o.PrefixNsString = &v +} + +// GetPrefixNsNumber returns the PrefixNsNumber field value if set, zero value otherwise. +func (o *XmlItem) GetPrefixNsNumber() float32 { + if o == nil || o.PrefixNsNumber == nil { + var ret float32 + return ret + } + return *o.PrefixNsNumber +} + +// GetPrefixNsNumberOk returns a tuple with the PrefixNsNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetPrefixNsNumberOk() (*float32, bool) { + if o == nil || o.PrefixNsNumber == nil { + return nil, false + } + return o.PrefixNsNumber, true +} + +// HasPrefixNsNumber returns a boolean if a field has been set. +func (o *XmlItem) HasPrefixNsNumber() bool { + if o != nil && o.PrefixNsNumber != nil { + return true + } + + return false +} + +// SetPrefixNsNumber gets a reference to the given float32 and assigns it to the PrefixNsNumber field. +func (o *XmlItem) SetPrefixNsNumber(v float32) { + o.PrefixNsNumber = &v +} + +// GetPrefixNsInteger returns the PrefixNsInteger field value if set, zero value otherwise. +func (o *XmlItem) GetPrefixNsInteger() int32 { + if o == nil || o.PrefixNsInteger == nil { + var ret int32 + return ret + } + return *o.PrefixNsInteger +} + +// GetPrefixNsIntegerOk returns a tuple with the PrefixNsInteger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetPrefixNsIntegerOk() (*int32, bool) { + if o == nil || o.PrefixNsInteger == nil { + return nil, false + } + return o.PrefixNsInteger, true +} + +// HasPrefixNsInteger returns a boolean if a field has been set. +func (o *XmlItem) HasPrefixNsInteger() bool { + if o != nil && o.PrefixNsInteger != nil { + return true + } + + return false +} + +// SetPrefixNsInteger gets a reference to the given int32 and assigns it to the PrefixNsInteger field. +func (o *XmlItem) SetPrefixNsInteger(v int32) { + o.PrefixNsInteger = &v +} + +// GetPrefixNsBoolean returns the PrefixNsBoolean field value if set, zero value otherwise. +func (o *XmlItem) GetPrefixNsBoolean() bool { + if o == nil || o.PrefixNsBoolean == nil { + var ret bool + return ret + } + return *o.PrefixNsBoolean +} + +// GetPrefixNsBooleanOk returns a tuple with the PrefixNsBoolean field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetPrefixNsBooleanOk() (*bool, bool) { + if o == nil || o.PrefixNsBoolean == nil { + return nil, false + } + return o.PrefixNsBoolean, true +} + +// HasPrefixNsBoolean returns a boolean if a field has been set. +func (o *XmlItem) HasPrefixNsBoolean() bool { + if o != nil && o.PrefixNsBoolean != nil { + return true + } + + return false +} + +// SetPrefixNsBoolean gets a reference to the given bool and assigns it to the PrefixNsBoolean field. +func (o *XmlItem) SetPrefixNsBoolean(v bool) { + o.PrefixNsBoolean = &v +} + +// GetPrefixNsArray returns the PrefixNsArray field value if set, zero value otherwise. +func (o *XmlItem) GetPrefixNsArray() []int32 { + if o == nil || o.PrefixNsArray == nil { + var ret []int32 + return ret + } + return *o.PrefixNsArray +} + +// GetPrefixNsArrayOk returns a tuple with the PrefixNsArray field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetPrefixNsArrayOk() (*[]int32, bool) { + if o == nil || o.PrefixNsArray == nil { + return nil, false + } + return o.PrefixNsArray, true +} + +// HasPrefixNsArray returns a boolean if a field has been set. +func (o *XmlItem) HasPrefixNsArray() bool { + if o != nil && o.PrefixNsArray != nil { + return true + } + + return false +} + +// SetPrefixNsArray gets a reference to the given []int32 and assigns it to the PrefixNsArray field. +func (o *XmlItem) SetPrefixNsArray(v []int32) { + o.PrefixNsArray = &v +} + +// GetPrefixNsWrappedArray returns the PrefixNsWrappedArray field value if set, zero value otherwise. +func (o *XmlItem) GetPrefixNsWrappedArray() []int32 { + if o == nil || o.PrefixNsWrappedArray == nil { + var ret []int32 + return ret + } + return *o.PrefixNsWrappedArray +} + +// GetPrefixNsWrappedArrayOk returns a tuple with the PrefixNsWrappedArray field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *XmlItem) GetPrefixNsWrappedArrayOk() (*[]int32, bool) { + if o == nil || o.PrefixNsWrappedArray == nil { + return nil, false + } + return o.PrefixNsWrappedArray, true +} + +// HasPrefixNsWrappedArray returns a boolean if a field has been set. +func (o *XmlItem) HasPrefixNsWrappedArray() bool { + if o != nil && o.PrefixNsWrappedArray != nil { + return true + } + + return false +} + +// SetPrefixNsWrappedArray gets a reference to the given []int32 and assigns it to the PrefixNsWrappedArray field. +func (o *XmlItem) SetPrefixNsWrappedArray(v []int32) { + o.PrefixNsWrappedArray = &v +} + +func (o XmlItem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.AttributeString != nil { + toSerialize["attribute_string"] = o.AttributeString + } + if o.AttributeNumber != nil { + toSerialize["attribute_number"] = o.AttributeNumber + } + if o.AttributeInteger != nil { + toSerialize["attribute_integer"] = o.AttributeInteger + } + if o.AttributeBoolean != nil { + toSerialize["attribute_boolean"] = o.AttributeBoolean + } + if o.WrappedArray != nil { + toSerialize["wrapped_array"] = o.WrappedArray + } + if o.NameString != nil { + toSerialize["name_string"] = o.NameString + } + if o.NameNumber != nil { + toSerialize["name_number"] = o.NameNumber + } + if o.NameInteger != nil { + toSerialize["name_integer"] = o.NameInteger + } + if o.NameBoolean != nil { + toSerialize["name_boolean"] = o.NameBoolean + } + if o.NameArray != nil { + toSerialize["name_array"] = o.NameArray + } + if o.NameWrappedArray != nil { + toSerialize["name_wrapped_array"] = o.NameWrappedArray + } + if o.PrefixString != nil { + toSerialize["prefix_string"] = o.PrefixString + } + if o.PrefixNumber != nil { + toSerialize["prefix_number"] = o.PrefixNumber + } + if o.PrefixInteger != nil { + toSerialize["prefix_integer"] = o.PrefixInteger + } + if o.PrefixBoolean != nil { + toSerialize["prefix_boolean"] = o.PrefixBoolean + } + if o.PrefixArray != nil { + toSerialize["prefix_array"] = o.PrefixArray + } + if o.PrefixWrappedArray != nil { + toSerialize["prefix_wrapped_array"] = o.PrefixWrappedArray + } + if o.NamespaceString != nil { + toSerialize["namespace_string"] = o.NamespaceString + } + if o.NamespaceNumber != nil { + toSerialize["namespace_number"] = o.NamespaceNumber + } + if o.NamespaceInteger != nil { + toSerialize["namespace_integer"] = o.NamespaceInteger + } + if o.NamespaceBoolean != nil { + toSerialize["namespace_boolean"] = o.NamespaceBoolean + } + if o.NamespaceArray != nil { + toSerialize["namespace_array"] = o.NamespaceArray + } + if o.NamespaceWrappedArray != nil { + toSerialize["namespace_wrapped_array"] = o.NamespaceWrappedArray + } + if o.PrefixNsString != nil { + toSerialize["prefix_ns_string"] = o.PrefixNsString + } + if o.PrefixNsNumber != nil { + toSerialize["prefix_ns_number"] = o.PrefixNsNumber + } + if o.PrefixNsInteger != nil { + toSerialize["prefix_ns_integer"] = o.PrefixNsInteger + } + if o.PrefixNsBoolean != nil { + toSerialize["prefix_ns_boolean"] = o.PrefixNsBoolean + } + if o.PrefixNsArray != nil { + toSerialize["prefix_ns_array"] = o.PrefixNsArray + } + if o.PrefixNsWrappedArray != nil { + toSerialize["prefix_ns_wrapped_array"] = o.PrefixNsWrappedArray + } + return json.Marshal(toSerialize) +} + +type NullableXmlItem struct { + value *XmlItem + isSet bool +} + +func (v NullableXmlItem) Get() *XmlItem { + return v.value +} + +func (v *NullableXmlItem) Set(val *XmlItem) { + v.value = val + v.isSet = true +} + +func (v NullableXmlItem) IsSet() bool { + return v.isSet +} + +func (v *NullableXmlItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableXmlItem(val *XmlItem) *NullableXmlItem { + return &NullableXmlItem{value: val, isSet: true} +} + +func (v NullableXmlItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableXmlItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/petstore/go/go-petstore/utils.go b/samples/client/petstore/go/go-petstore/utils.go new file mode 100644 index 00000000000..9fb7a1847cd --- /dev/null +++ b/samples/client/petstore/go/go-petstore/utils.go @@ -0,0 +1,334 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given integer value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/.gitignore b/samples/openapi3/client/extensions/x-auth-id-alias/go/.gitignore new file mode 100644 index 00000000000..daf913b1b34 --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/.gitignore @@ -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 diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/.openapi-generator-ignore b/samples/openapi3/client/extensions/x-auth-id-alias/go/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/.openapi-generator/FILES b/samples/openapi3/client/extensions/x-auth-id-alias/go/.openapi-generator/FILES new file mode 100644 index 00000000000..ae367085bfc --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/.openapi-generator/FILES @@ -0,0 +1,13 @@ +.gitignore +.travis.yml +README.md +UsageApi.md +api/openapi.yaml +client.go +configuration.go +git_push.sh +go.mod +go.sum +response.go +utils.go +x_auth_id_alias/api_usage.go diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/.openapi-generator/VERSION b/samples/openapi3/client/extensions/x-auth-id-alias/go/.openapi-generator/VERSION new file mode 100644 index 00000000000..d99e7162d01 --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/.travis.yml b/samples/openapi3/client/extensions/x-auth-id-alias/go/.travis.yml new file mode 100644 index 00000000000..f5cb2ce9a5a --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/README.md b/samples/openapi3/client/extensions/x-auth-id-alias/go/README.md new file mode 100644 index 00000000000..fe501d3b1f9 --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/README.md @@ -0,0 +1,127 @@ +# Go API client for x_auth_id_alias + +This specification shows how to use x-auth-id-alias extension for API keys. + +## 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: 1.0.0 +- Package version: 1.0.0 +- Build date: 2020-08-31T07:04:15.191Z[UTC] +- 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/oauth2 +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```golang +import sw "./x_auth_id_alias" +``` + +## 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(), sw.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(), sw.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 identifield 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. + +``` +ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*UsageApi* | [**AnyKey**](docs/UsageApi.md#anykey) | **Get** /any | Use any API key +*UsageApi* | [**BothKeys**](docs/UsageApi.md#bothkeys) | **Get** /both | Use both API keys +*UsageApi* | [**KeyInHeader**](docs/UsageApi.md#keyinheader) | **Get** /header | Use API key in header +*UsageApi* | [**KeyInQuery**](docs/UsageApi.md#keyinquery) | **Get** /query | Use API key in query + + +## Documentation For Models + + + +## Documentation For Authorization + + + +### api_key + +- **Type**: API key +- **API key parameter name**: X-Api-Key +- **Location**: HTTP header + +Note, each API key must be added to a map of `map[string]APIKey` where the key is: X-Api-Key and passed in as the auth context for each request. + + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: URL query string + +Note, each API key must be added to a map of `map[string]APIKey` where the key is: api_key and passed in as the auth context for each request. + + +## 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 + + + diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/UsageApi.md b/samples/openapi3/client/extensions/x-auth-id-alias/go/UsageApi.md new file mode 100644 index 00000000000..eb6a220249c --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/UsageApi.md @@ -0,0 +1,256 @@ +# \UsageApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AnyKey**](UsageApi.md#AnyKey) | **Get** /any | Use any API key +[**BothKeys**](UsageApi.md#BothKeys) | **Get** /both | Use both API keys +[**KeyInHeader**](UsageApi.md#KeyInHeader) | **Get** /header | Use API key in header +[**KeyInQuery**](UsageApi.md#KeyInQuery) | **Get** /query | Use API key in query + + + +## AnyKey + +> map[string]interface{} AnyKey(ctx).Execute() + +Use any API key + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UsageApi.AnyKey(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsageApi.AnyKey``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AnyKey`: map[string]interface{} + fmt.Fprintf(os.Stdout, "Response from `UsageApi.AnyKey`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiAnyKeyRequest struct via the builder pattern + + +### Return type + +**map[string]interface{}** + +### Authorization + +[api_key](../README.md#api_key), [api_key_query](../README.md#api_key_query) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BothKeys + +> map[string]interface{} BothKeys(ctx).Execute() + +Use both API keys + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UsageApi.BothKeys(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsageApi.BothKeys``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BothKeys`: map[string]interface{} + fmt.Fprintf(os.Stdout, "Response from `UsageApi.BothKeys`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiBothKeysRequest struct via the builder pattern + + +### Return type + +**map[string]interface{}** + +### Authorization + +[api_key](../README.md#api_key), [api_key_query](../README.md#api_key_query) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## KeyInHeader + +> map[string]interface{} KeyInHeader(ctx).Execute() + +Use API key in header + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UsageApi.KeyInHeader(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsageApi.KeyInHeader``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `KeyInHeader`: map[string]interface{} + fmt.Fprintf(os.Stdout, "Response from `UsageApi.KeyInHeader`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiKeyInHeaderRequest struct via the builder pattern + + +### Return type + +**map[string]interface{}** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## KeyInQuery + +> map[string]interface{} KeyInQuery(ctx).Execute() + +Use API key in query + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UsageApi.KeyInQuery(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsageApi.KeyInQuery``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `KeyInQuery`: map[string]interface{} + fmt.Fprintf(os.Stdout, "Response from `UsageApi.KeyInQuery`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiKeyInQueryRequest struct via the builder pattern + + +### Return type + +**map[string]interface{}** + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/api/openapi.yaml b/samples/openapi3/client/extensions/x-auth-id-alias/go/api/openapi.yaml new file mode 100644 index 00000000000..a23135ce523 --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/api/openapi.yaml @@ -0,0 +1,114 @@ +openapi: 3.0.0 +info: + description: This specification shows how to use x-auth-id-alias extension for API + keys. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Extension x-auth-id-alias + version: 1.0.0 +servers: +- description: petstore server + url: http://{server}.swagger.io:{port}/v2 + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: https://localhost:8080/{version} + variables: + version: + default: v2 + enum: + - v1 + - v2 +tags: +- description: Show usage of x-auth-id-alias + name: usage +paths: + /both: + get: + description: Use both API keys + operationId: bothKeys + responses: + "200": + content: + application/json: + schema: + type: object + description: successful operation + security: + - api_key_query: [] + api_key: [] + summary: Use both API keys + tags: + - usage + /any: + get: + description: Use any API key + operationId: anyKey + responses: + "200": + content: + application/json: + schema: + type: object + description: successful operation + security: + - api_key_query: [] + - api_key: [] + summary: Use any API key + tags: + - usage + /query: + get: + description: Use API key in query + operationId: keyInQuery + responses: + "200": + content: + application/json: + schema: + type: object + description: successful operation + security: + - api_key_query: [] + summary: Use API key in query + tags: + - usage + /header: + get: + description: Use API key in header + operationId: keyInHeader + responses: + "200": + content: + application/json: + schema: + type: object + description: successful operation + security: + - api_key: [] + summary: Use API key in header + tags: + - usage +components: + schemas: {} + securitySchemes: + api_key: + in: header + name: X-Api-Key + type: apiKey + api_key_query: + in: query + name: api_key + type: apiKey + x-auth-id-alias: api_key diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/client.go b/samples/openapi3/client/extensions/x-auth-id-alias/go/client.go new file mode 100644 index 00000000000..30335de6c29 --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/client.go @@ -0,0 +1,532 @@ +/* + * OpenAPI Extension x-auth-id-alias + * + * This specification shows how to use x-auth-id-alias extension for API keys. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package x_auth_id_alias + +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" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) +) + +// APIClient manages communication with the OpenAPI Extension x-auth-id-alias API v1.0.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 + + UsageApi *UsageApiService +} + +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.UsageApi = (*UsageApiService)(&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 insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(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 +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } else if t, ok := obj.(time.Time); ok { + return t.Format(time.RFC3339) + } + + return fmt.Sprintf("%v", obj) +} + +// 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 +} + +// 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, + formFileName string, + fileName string, + fileBytes []byte) (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(fileBytes) > 0 && fileName != "") { + 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) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile(formFileName, filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(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 = query.Encode() + + // 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.Set(h, 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. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + } + + 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 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 { + 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(path) + if err != nil { + return err + } + defer file.Close() + + 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...) +} + +// 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 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) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + 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 +} diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/configuration.go b/samples/openapi3/client/extensions/x-auth-id-alias/go/configuration.go new file mode 100644 index 00000000000..425e8f19c15 --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/configuration.go @@ -0,0 +1,262 @@ +/* + * OpenAPI Extension x-auth-id-alias + * + * This specification shows how to use x-auth-id-alias extension for API keys. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package x_auth_id_alias + +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 ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. + ContextHttpSignatureAuth = contextKey("httpsignature") + + // 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://{server}.swagger.io:{port}/v2", + Description: "petstore server", + Variables: map[string]ServerVariable{ + "server": ServerVariable{ + Description: "No description provided", + DefaultValue: "petstore", + EnumValues: []string{ + "petstore", + "qa-petstore", + "dev-petstore", + }, + }, + "port": ServerVariable{ + Description: "No description provided", + DefaultValue: "80", + EnumValues: []string{ + "80", + "8080", + }, + }, + }, + }, + { + URL: "https://localhost:8080/{version}", + Description: "The local server", + Variables: map[string]ServerVariable{ + "version": ServerVariable{ + Description: "No description provided", + DefaultValue: "v2", + EnumValues: []string{ + "v1", + "v2", + }, + }, + }, + }, + }, + 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) +} diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/git_push.sh b/samples/openapi3/client/extensions/x-auth-id-alias/go/git_push.sh new file mode 100644 index 00000000000..ced3be2b0c7 --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/go.mod b/samples/openapi3/client/extensions/x-auth-id-alias/go/go.mod new file mode 100644 index 00000000000..f9811556cc5 --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/go.mod @@ -0,0 +1,7 @@ +module github.com/GIT_USER_ID/GIT_REPO_ID + +go 1.13 + +require ( + golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 +) diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/go.sum b/samples/openapi3/client/extensions/x-auth-id-alias/go/go.sum new file mode 100644 index 00000000000..ce55b3c6a08 --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/go.sum @@ -0,0 +1,15 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +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/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +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= diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/response.go b/samples/openapi3/client/extensions/x-auth-id-alias/go/response.go new file mode 100644 index 00000000000..f5aa518c3c5 --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/response.go @@ -0,0 +1,46 @@ +/* + * OpenAPI Extension x-auth-id-alias + * + * This specification shows how to use x-auth-id-alias extension for API keys. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package x_auth_id_alias + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResonse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/utils.go b/samples/openapi3/client/extensions/x-auth-id-alias/go/utils.go new file mode 100644 index 00000000000..c6930485543 --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/utils.go @@ -0,0 +1,334 @@ +/* + * OpenAPI Extension x-auth-id-alias + * + * This specification shows how to use x-auth-id-alias extension for API keys. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package x_auth_id_alias + +import ( + "encoding/json" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given integer value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go/x_auth_id_alias/api_usage.go b/samples/openapi3/client/extensions/x-auth-id-alias/go/x_auth_id_alias/api_usage.go new file mode 100644 index 00000000000..7bd99eeb973 --- /dev/null +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go/x_auth_id_alias/api_usage.go @@ -0,0 +1,490 @@ +/* + * OpenAPI Extension x-auth-id-alias + * + * This specification shows how to use x-auth-id-alias extension for API keys. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package x_auth_id_alias + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" +) + +// Linger please +var ( + _ _context.Context +) + +// UsageApiService UsageApi service +type UsageApiService service + +type apiAnyKeyRequest struct { + ctx _context.Context + apiService *UsageApiService +} + +/* +AnyKey Use any API key +Use any API key + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiAnyKeyRequest +*/ +func (a *UsageApiService) AnyKey(ctx _context.Context) apiAnyKeyRequest { + return apiAnyKeyRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return map[string]interface{} +*/ +func (r apiAnyKeyRequest) Execute() (map[string]interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UsageApiService.AnyKey") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/any" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["api_key"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Api-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["api_key"]; ok { + var key string + if prefix, ok := auth["api_key_query"]; ok && prefix.Prefix != "" { + key = prefix.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarQueryParams.Add("api_key", key) + } + } + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiBothKeysRequest struct { + ctx _context.Context + apiService *UsageApiService +} + +/* +BothKeys Use both API keys +Use both API keys + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiBothKeysRequest +*/ +func (a *UsageApiService) BothKeys(ctx _context.Context) apiBothKeysRequest { + return apiBothKeysRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return map[string]interface{} +*/ +func (r apiBothKeysRequest) Execute() (map[string]interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UsageApiService.BothKeys") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/both" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["api_key"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Api-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["api_key"]; ok { + var key string + if prefix, ok := auth["api_key_query"]; ok && prefix.Prefix != "" { + key = prefix.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarQueryParams.Add("api_key", key) + } + } + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiKeyInHeaderRequest struct { + ctx _context.Context + apiService *UsageApiService +} + +/* +KeyInHeader Use API key in header +Use API key in header + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiKeyInHeaderRequest +*/ +func (a *UsageApiService) KeyInHeader(ctx _context.Context) apiKeyInHeaderRequest { + return apiKeyInHeaderRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return map[string]interface{} +*/ +func (r apiKeyInHeaderRequest) Execute() (map[string]interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UsageApiService.KeyInHeader") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/header" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["api_key"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Api-Key"] = key + } + } + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiKeyInQueryRequest struct { + ctx _context.Context + apiService *UsageApiService +} + +/* +KeyInQuery Use API key in query +Use API key in query + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiKeyInQueryRequest +*/ +func (a *UsageApiService) KeyInQuery(ctx _context.Context) apiKeyInQueryRequest { + return apiKeyInQueryRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return map[string]interface{} +*/ +func (r apiKeyInQueryRequest) Execute() (map[string]interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UsageApiService.KeyInQuery") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/query" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["api_key"]; ok { + var key string + if prefix, ok := auth["api_key_query"]; ok && prefix.Prefix != "" { + key = prefix.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarQueryParams.Add("api_key", key) + } + } + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/200Response.md b/samples/openapi3/client/petstore/go/go-petstore/200Response.md new file mode 100644 index 00000000000..4e0d89fe88f --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/200Response.md @@ -0,0 +1,82 @@ +# Model200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **int32** | | [optional] +**Class** | Pointer to **string** | | [optional] + +## Methods + +### NewModel200Response + +`func NewModel200Response() *Model200Response` + +NewModel200Response instantiates a new Model200Response 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 + +### NewModel200ResponseWithDefaults + +`func NewModel200ResponseWithDefaults() *Model200Response` + +NewModel200ResponseWithDefaults instantiates a new Model200Response 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 + +### GetName + +`func (o *Model200Response) GetName() int32` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Model200Response) GetNameOk() (*int32, 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 *Model200Response) SetName(v int32)` + +SetName sets Name field to given value. + +### HasName + +`func (o *Model200Response) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetClass + +`func (o *Model200Response) GetClass() string` + +GetClass returns the Class field if non-nil, zero value otherwise. + +### GetClassOk + +`func (o *Model200Response) GetClassOk() (*string, bool)` + +GetClassOk returns a tuple with the Class field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetClass + +`func (o *Model200Response) SetClass(v string)` + +SetClass sets Class field to given value. + +### HasClass + +`func (o *Model200Response) HasClass() bool` + +HasClass 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/go/go-petstore/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..19719e709f8 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/AdditionalPropertiesClass.md @@ -0,0 +1,82 @@ +# AdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MapProperty** | Pointer to **map[string]string** | | [optional] +**MapOfMapProperty** | Pointer to [**map[string]map[string]string**](map.md) | | [optional] + +## Methods + +### NewAdditionalPropertiesClass + +`func NewAdditionalPropertiesClass() *AdditionalPropertiesClass` + +NewAdditionalPropertiesClass instantiates a new AdditionalPropertiesClass 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 + +### NewAdditionalPropertiesClassWithDefaults + +`func NewAdditionalPropertiesClassWithDefaults() *AdditionalPropertiesClass` + +NewAdditionalPropertiesClassWithDefaults instantiates a new AdditionalPropertiesClass 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 + +### GetMapProperty + +`func (o *AdditionalPropertiesClass) GetMapProperty() map[string]string` + +GetMapProperty returns the MapProperty field if non-nil, zero value otherwise. + +### GetMapPropertyOk + +`func (o *AdditionalPropertiesClass) GetMapPropertyOk() (*map[string]string, bool)` + +GetMapPropertyOk returns a tuple with the MapProperty field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMapProperty + +`func (o *AdditionalPropertiesClass) SetMapProperty(v map[string]string)` + +SetMapProperty sets MapProperty field to given value. + +### HasMapProperty + +`func (o *AdditionalPropertiesClass) HasMapProperty() bool` + +HasMapProperty returns a boolean if a field has been set. + +### GetMapOfMapProperty + +`func (o *AdditionalPropertiesClass) GetMapOfMapProperty() map[string]map[string]string` + +GetMapOfMapProperty returns the MapOfMapProperty field if non-nil, zero value otherwise. + +### GetMapOfMapPropertyOk + +`func (o *AdditionalPropertiesClass) GetMapOfMapPropertyOk() (*map[string]map[string]string, bool)` + +GetMapOfMapPropertyOk returns a tuple with the MapOfMapProperty field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMapOfMapProperty + +`func (o *AdditionalPropertiesClass) SetMapOfMapProperty(v map[string]map[string]string)` + +SetMapOfMapProperty sets MapOfMapProperty field to given value. + +### HasMapOfMapProperty + +`func (o *AdditionalPropertiesClass) HasMapOfMapProperty() bool` + +HasMapOfMapProperty 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Animal.md b/samples/openapi3/client/petstore/go/go-petstore/Animal.md new file mode 100644 index 00000000000..293f75c5171 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Animal.md @@ -0,0 +1,77 @@ +# Animal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | Pointer to **string** | | [optional] [default to "red"] + +## Methods + +### NewAnimal + +`func NewAnimal(className string, ) *Animal` + +NewAnimal instantiates a new Animal 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 + +### NewAnimalWithDefaults + +`func NewAnimalWithDefaults() *Animal` + +NewAnimalWithDefaults instantiates a new Animal 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 + +### GetClassName + +`func (o *Animal) GetClassName() string` + +GetClassName returns the ClassName field if non-nil, zero value otherwise. + +### GetClassNameOk + +`func (o *Animal) GetClassNameOk() (*string, bool)` + +GetClassNameOk returns a tuple with the ClassName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetClassName + +`func (o *Animal) SetClassName(v string)` + +SetClassName sets ClassName field to given value. + + +### GetColor + +`func (o *Animal) GetColor() string` + +GetColor returns the Color field if non-nil, zero value otherwise. + +### GetColorOk + +`func (o *Animal) 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 *Animal) SetColor(v string)` + +SetColor sets Color field to given value. + +### HasColor + +`func (o *Animal) 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/AnotherFakeApi.md b/samples/openapi3/client/petstore/go/go-petstore/AnotherFakeApi.md new file mode 100644 index 00000000000..2c63feecd21 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/AnotherFakeApi.md @@ -0,0 +1,75 @@ +# \AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Call123TestSpecialTags**](AnotherFakeApi.md#Call123TestSpecialTags) | **Patch** /another-fake/dummy | To test special tags + + + +## Call123TestSpecialTags + +> Client Call123TestSpecialTags(ctx).Client(client).Execute() + +To test special tags + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + client := openapiclient.Client{Client: "Client_example"} // Client | client model + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.AnotherFakeApi.Call123TestSpecialTags(context.Background(), client).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AnotherFakeApi.Call123TestSpecialTags``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `Call123TestSpecialTags`: Client + fmt.Fprintf(os.Stdout, "Response from `AnotherFakeApi.Call123TestSpecialTags`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCall123TestSpecialTagsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md) | client model | + +### Return type + +[**Client**](Client.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) + diff --git a/samples/openapi3/client/petstore/go/go-petstore/ApiResponse.md b/samples/openapi3/client/petstore/go/go-petstore/ApiResponse.md new file mode 100644 index 00000000000..877dacb4293 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/ApiResponse.md @@ -0,0 +1,108 @@ +# ApiResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | Pointer to **int32** | | [optional] +**Type** | Pointer to **string** | | [optional] +**Message** | Pointer to **string** | | [optional] + +## Methods + +### NewApiResponse + +`func NewApiResponse() *ApiResponse` + +NewApiResponse instantiates a new ApiResponse 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 + +### NewApiResponseWithDefaults + +`func NewApiResponseWithDefaults() *ApiResponse` + +NewApiResponseWithDefaults instantiates a new ApiResponse 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 + +### GetCode + +`func (o *ApiResponse) GetCode() int32` + +GetCode returns the Code field if non-nil, zero value otherwise. + +### GetCodeOk + +`func (o *ApiResponse) GetCodeOk() (*int32, bool)` + +GetCodeOk returns a tuple with the Code field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCode + +`func (o *ApiResponse) SetCode(v int32)` + +SetCode sets Code field to given value. + +### HasCode + +`func (o *ApiResponse) HasCode() bool` + +HasCode returns a boolean if a field has been set. + +### GetType + +`func (o *ApiResponse) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *ApiResponse) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *ApiResponse) SetType(v string)` + +SetType sets Type field to given value. + +### HasType + +`func (o *ApiResponse) HasType() bool` + +HasType returns a boolean if a field has been set. + +### GetMessage + +`func (o *ApiResponse) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *ApiResponse) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *ApiResponse) SetMessage(v string)` + +SetMessage sets Message field to given value. + +### HasMessage + +`func (o *ApiResponse) HasMessage() bool` + +HasMessage 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Apple.md b/samples/openapi3/client/petstore/go/go-petstore/Apple.md new file mode 100644 index 00000000000..659ddff5731 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Apple.md @@ -0,0 +1,56 @@ +# Apple + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Cultivar** | Pointer to **string** | | [optional] + +## Methods + +### NewApple + +`func NewApple() *Apple` + +NewApple instantiates a new Apple 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 + +### NewAppleWithDefaults + +`func NewAppleWithDefaults() *Apple` + +NewAppleWithDefaults instantiates a new Apple 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 + +### GetCultivar + +`func (o *Apple) GetCultivar() string` + +GetCultivar returns the Cultivar field if non-nil, zero value otherwise. + +### GetCultivarOk + +`func (o *Apple) GetCultivarOk() (*string, bool)` + +GetCultivarOk returns a tuple with the Cultivar field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCultivar + +`func (o *Apple) SetCultivar(v string)` + +SetCultivar sets Cultivar field to given value. + +### HasCultivar + +`func (o *Apple) HasCultivar() bool` + +HasCultivar 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/AppleReq.md b/samples/openapi3/client/petstore/go/go-petstore/AppleReq.md new file mode 100644 index 00000000000..d56e3051f58 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/AppleReq.md @@ -0,0 +1,77 @@ +# AppleReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Cultivar** | **string** | | +**Mealy** | Pointer to **bool** | | [optional] + +## Methods + +### NewAppleReq + +`func NewAppleReq(cultivar string, ) *AppleReq` + +NewAppleReq instantiates a new AppleReq 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 + +### NewAppleReqWithDefaults + +`func NewAppleReqWithDefaults() *AppleReq` + +NewAppleReqWithDefaults instantiates a new AppleReq 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 + +### GetCultivar + +`func (o *AppleReq) GetCultivar() string` + +GetCultivar returns the Cultivar field if non-nil, zero value otherwise. + +### GetCultivarOk + +`func (o *AppleReq) GetCultivarOk() (*string, bool)` + +GetCultivarOk returns a tuple with the Cultivar field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCultivar + +`func (o *AppleReq) SetCultivar(v string)` + +SetCultivar sets Cultivar field to given value. + + +### GetMealy + +`func (o *AppleReq) GetMealy() bool` + +GetMealy returns the Mealy field if non-nil, zero value otherwise. + +### GetMealyOk + +`func (o *AppleReq) GetMealyOk() (*bool, bool)` + +GetMealyOk returns a tuple with the Mealy field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMealy + +`func (o *AppleReq) SetMealy(v bool)` + +SetMealy sets Mealy field to given value. + +### HasMealy + +`func (o *AppleReq) HasMealy() bool` + +HasMealy 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/go/go-petstore/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..cb46da598b1 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,56 @@ +# ArrayOfArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayNumber** | Pointer to [**[][]float32**](array.md) | | [optional] + +## Methods + +### NewArrayOfArrayOfNumberOnly + +`func NewArrayOfArrayOfNumberOnly() *ArrayOfArrayOfNumberOnly` + +NewArrayOfArrayOfNumberOnly instantiates a new ArrayOfArrayOfNumberOnly 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 + +### NewArrayOfArrayOfNumberOnlyWithDefaults + +`func NewArrayOfArrayOfNumberOnlyWithDefaults() *ArrayOfArrayOfNumberOnly` + +NewArrayOfArrayOfNumberOnlyWithDefaults instantiates a new ArrayOfArrayOfNumberOnly 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 + +### GetArrayArrayNumber + +`func (o *ArrayOfArrayOfNumberOnly) GetArrayArrayNumber() [][]float32` + +GetArrayArrayNumber returns the ArrayArrayNumber field if non-nil, zero value otherwise. + +### GetArrayArrayNumberOk + +`func (o *ArrayOfArrayOfNumberOnly) GetArrayArrayNumberOk() (*[][]float32, bool)` + +GetArrayArrayNumberOk returns a tuple with the ArrayArrayNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayArrayNumber + +`func (o *ArrayOfArrayOfNumberOnly) SetArrayArrayNumber(v [][]float32)` + +SetArrayArrayNumber sets ArrayArrayNumber field to given value. + +### HasArrayArrayNumber + +`func (o *ArrayOfArrayOfNumberOnly) HasArrayArrayNumber() bool` + +HasArrayArrayNumber 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/go/go-petstore/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..f0aaaa443b3 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/ArrayOfNumberOnly.md @@ -0,0 +1,56 @@ +# ArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayNumber** | Pointer to **[]float32** | | [optional] + +## Methods + +### NewArrayOfNumberOnly + +`func NewArrayOfNumberOnly() *ArrayOfNumberOnly` + +NewArrayOfNumberOnly instantiates a new ArrayOfNumberOnly 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 + +### NewArrayOfNumberOnlyWithDefaults + +`func NewArrayOfNumberOnlyWithDefaults() *ArrayOfNumberOnly` + +NewArrayOfNumberOnlyWithDefaults instantiates a new ArrayOfNumberOnly 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 + +### GetArrayNumber + +`func (o *ArrayOfNumberOnly) GetArrayNumber() []float32` + +GetArrayNumber returns the ArrayNumber field if non-nil, zero value otherwise. + +### GetArrayNumberOk + +`func (o *ArrayOfNumberOnly) GetArrayNumberOk() (*[]float32, bool)` + +GetArrayNumberOk returns a tuple with the ArrayNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayNumber + +`func (o *ArrayOfNumberOnly) SetArrayNumber(v []float32)` + +SetArrayNumber sets ArrayNumber field to given value. + +### HasArrayNumber + +`func (o *ArrayOfNumberOnly) HasArrayNumber() bool` + +HasArrayNumber 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/ArrayTest.md b/samples/openapi3/client/petstore/go/go-petstore/ArrayTest.md new file mode 100644 index 00000000000..a0f8d7528c3 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/ArrayTest.md @@ -0,0 +1,108 @@ +# ArrayTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayOfString** | Pointer to **[]string** | | [optional] +**ArrayArrayOfInteger** | Pointer to [**[][]int64**](array.md) | | [optional] +**ArrayArrayOfModel** | Pointer to [**[][]ReadOnlyFirst**](array.md) | | [optional] + +## Methods + +### NewArrayTest + +`func NewArrayTest() *ArrayTest` + +NewArrayTest instantiates a new ArrayTest 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 + +### NewArrayTestWithDefaults + +`func NewArrayTestWithDefaults() *ArrayTest` + +NewArrayTestWithDefaults instantiates a new ArrayTest 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 + +### GetArrayOfString + +`func (o *ArrayTest) GetArrayOfString() []string` + +GetArrayOfString returns the ArrayOfString field if non-nil, zero value otherwise. + +### GetArrayOfStringOk + +`func (o *ArrayTest) GetArrayOfStringOk() (*[]string, bool)` + +GetArrayOfStringOk returns a tuple with the ArrayOfString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayOfString + +`func (o *ArrayTest) SetArrayOfString(v []string)` + +SetArrayOfString sets ArrayOfString field to given value. + +### HasArrayOfString + +`func (o *ArrayTest) HasArrayOfString() bool` + +HasArrayOfString returns a boolean if a field has been set. + +### GetArrayArrayOfInteger + +`func (o *ArrayTest) GetArrayArrayOfInteger() [][]int64` + +GetArrayArrayOfInteger returns the ArrayArrayOfInteger field if non-nil, zero value otherwise. + +### GetArrayArrayOfIntegerOk + +`func (o *ArrayTest) GetArrayArrayOfIntegerOk() (*[][]int64, bool)` + +GetArrayArrayOfIntegerOk returns a tuple with the ArrayArrayOfInteger field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayArrayOfInteger + +`func (o *ArrayTest) SetArrayArrayOfInteger(v [][]int64)` + +SetArrayArrayOfInteger sets ArrayArrayOfInteger field to given value. + +### HasArrayArrayOfInteger + +`func (o *ArrayTest) HasArrayArrayOfInteger() bool` + +HasArrayArrayOfInteger returns a boolean if a field has been set. + +### GetArrayArrayOfModel + +`func (o *ArrayTest) GetArrayArrayOfModel() [][]ReadOnlyFirst` + +GetArrayArrayOfModel returns the ArrayArrayOfModel field if non-nil, zero value otherwise. + +### GetArrayArrayOfModelOk + +`func (o *ArrayTest) GetArrayArrayOfModelOk() (*[][]ReadOnlyFirst, bool)` + +GetArrayArrayOfModelOk returns a tuple with the ArrayArrayOfModel field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayArrayOfModel + +`func (o *ArrayTest) SetArrayArrayOfModel(v [][]ReadOnlyFirst)` + +SetArrayArrayOfModel sets ArrayArrayOfModel field to given value. + +### HasArrayArrayOfModel + +`func (o *ArrayTest) HasArrayArrayOfModel() bool` + +HasArrayArrayOfModel 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Banana.md b/samples/openapi3/client/petstore/go/go-petstore/Banana.md new file mode 100644 index 00000000000..d803a8f4adc --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Banana.md @@ -0,0 +1,56 @@ +# Banana + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LengthCm** | Pointer to **float32** | | [optional] + +## Methods + +### NewBanana + +`func NewBanana() *Banana` + +NewBanana instantiates a new Banana 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 + +### NewBananaWithDefaults + +`func NewBananaWithDefaults() *Banana` + +NewBananaWithDefaults instantiates a new Banana 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 + +### GetLengthCm + +`func (o *Banana) GetLengthCm() float32` + +GetLengthCm returns the LengthCm field if non-nil, zero value otherwise. + +### GetLengthCmOk + +`func (o *Banana) GetLengthCmOk() (*float32, bool)` + +GetLengthCmOk returns a tuple with the LengthCm field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLengthCm + +`func (o *Banana) SetLengthCm(v float32)` + +SetLengthCm sets LengthCm field to given value. + +### HasLengthCm + +`func (o *Banana) HasLengthCm() bool` + +HasLengthCm 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/BananaReq.md b/samples/openapi3/client/petstore/go/go-petstore/BananaReq.md new file mode 100644 index 00000000000..3d4ebb28191 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/BananaReq.md @@ -0,0 +1,77 @@ +# BananaReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LengthCm** | **float32** | | +**Sweet** | Pointer to **bool** | | [optional] + +## Methods + +### NewBananaReq + +`func NewBananaReq(lengthCm float32, ) *BananaReq` + +NewBananaReq instantiates a new BananaReq 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 + +### NewBananaReqWithDefaults + +`func NewBananaReqWithDefaults() *BananaReq` + +NewBananaReqWithDefaults instantiates a new BananaReq 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 + +### GetLengthCm + +`func (o *BananaReq) GetLengthCm() float32` + +GetLengthCm returns the LengthCm field if non-nil, zero value otherwise. + +### GetLengthCmOk + +`func (o *BananaReq) GetLengthCmOk() (*float32, bool)` + +GetLengthCmOk returns a tuple with the LengthCm field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLengthCm + +`func (o *BananaReq) SetLengthCm(v float32)` + +SetLengthCm sets LengthCm field to given value. + + +### GetSweet + +`func (o *BananaReq) GetSweet() bool` + +GetSweet returns the Sweet field if non-nil, zero value otherwise. + +### GetSweetOk + +`func (o *BananaReq) GetSweetOk() (*bool, bool)` + +GetSweetOk returns a tuple with the Sweet field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSweet + +`func (o *BananaReq) SetSweet(v bool)` + +SetSweet sets Sweet field to given value. + +### HasSweet + +`func (o *BananaReq) HasSweet() bool` + +HasSweet 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Capitalization.md b/samples/openapi3/client/petstore/go/go-petstore/Capitalization.md new file mode 100644 index 00000000000..3f37bb13e00 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Capitalization.md @@ -0,0 +1,186 @@ +# Capitalization + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SmallCamel** | Pointer to **string** | | [optional] +**CapitalCamel** | Pointer to **string** | | [optional] +**SmallSnake** | Pointer to **string** | | [optional] +**CapitalSnake** | Pointer to **string** | | [optional] +**SCAETHFlowPoints** | Pointer to **string** | | [optional] +**ATT_NAME** | Pointer to **string** | Name of the pet | [optional] + +## Methods + +### NewCapitalization + +`func NewCapitalization() *Capitalization` + +NewCapitalization instantiates a new Capitalization 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 + +### NewCapitalizationWithDefaults + +`func NewCapitalizationWithDefaults() *Capitalization` + +NewCapitalizationWithDefaults instantiates a new Capitalization 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 + +### GetSmallCamel + +`func (o *Capitalization) GetSmallCamel() string` + +GetSmallCamel returns the SmallCamel field if non-nil, zero value otherwise. + +### GetSmallCamelOk + +`func (o *Capitalization) GetSmallCamelOk() (*string, bool)` + +GetSmallCamelOk returns a tuple with the SmallCamel field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSmallCamel + +`func (o *Capitalization) SetSmallCamel(v string)` + +SetSmallCamel sets SmallCamel field to given value. + +### HasSmallCamel + +`func (o *Capitalization) HasSmallCamel() bool` + +HasSmallCamel returns a boolean if a field has been set. + +### GetCapitalCamel + +`func (o *Capitalization) GetCapitalCamel() string` + +GetCapitalCamel returns the CapitalCamel field if non-nil, zero value otherwise. + +### GetCapitalCamelOk + +`func (o *Capitalization) GetCapitalCamelOk() (*string, bool)` + +GetCapitalCamelOk returns a tuple with the CapitalCamel field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCapitalCamel + +`func (o *Capitalization) SetCapitalCamel(v string)` + +SetCapitalCamel sets CapitalCamel field to given value. + +### HasCapitalCamel + +`func (o *Capitalization) HasCapitalCamel() bool` + +HasCapitalCamel returns a boolean if a field has been set. + +### GetSmallSnake + +`func (o *Capitalization) GetSmallSnake() string` + +GetSmallSnake returns the SmallSnake field if non-nil, zero value otherwise. + +### GetSmallSnakeOk + +`func (o *Capitalization) GetSmallSnakeOk() (*string, bool)` + +GetSmallSnakeOk returns a tuple with the SmallSnake field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSmallSnake + +`func (o *Capitalization) SetSmallSnake(v string)` + +SetSmallSnake sets SmallSnake field to given value. + +### HasSmallSnake + +`func (o *Capitalization) HasSmallSnake() bool` + +HasSmallSnake returns a boolean if a field has been set. + +### GetCapitalSnake + +`func (o *Capitalization) GetCapitalSnake() string` + +GetCapitalSnake returns the CapitalSnake field if non-nil, zero value otherwise. + +### GetCapitalSnakeOk + +`func (o *Capitalization) GetCapitalSnakeOk() (*string, bool)` + +GetCapitalSnakeOk returns a tuple with the CapitalSnake field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCapitalSnake + +`func (o *Capitalization) SetCapitalSnake(v string)` + +SetCapitalSnake sets CapitalSnake field to given value. + +### HasCapitalSnake + +`func (o *Capitalization) HasCapitalSnake() bool` + +HasCapitalSnake returns a boolean if a field has been set. + +### GetSCAETHFlowPoints + +`func (o *Capitalization) GetSCAETHFlowPoints() string` + +GetSCAETHFlowPoints returns the SCAETHFlowPoints field if non-nil, zero value otherwise. + +### GetSCAETHFlowPointsOk + +`func (o *Capitalization) GetSCAETHFlowPointsOk() (*string, bool)` + +GetSCAETHFlowPointsOk returns a tuple with the SCAETHFlowPoints field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSCAETHFlowPoints + +`func (o *Capitalization) SetSCAETHFlowPoints(v string)` + +SetSCAETHFlowPoints sets SCAETHFlowPoints field to given value. + +### HasSCAETHFlowPoints + +`func (o *Capitalization) HasSCAETHFlowPoints() bool` + +HasSCAETHFlowPoints returns a boolean if a field has been set. + +### GetATT_NAME + +`func (o *Capitalization) GetATT_NAME() string` + +GetATT_NAME returns the ATT_NAME field if non-nil, zero value otherwise. + +### GetATT_NAMEOk + +`func (o *Capitalization) GetATT_NAMEOk() (*string, bool)` + +GetATT_NAMEOk returns a tuple with the ATT_NAME field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetATT_NAME + +`func (o *Capitalization) SetATT_NAME(v string)` + +SetATT_NAME sets ATT_NAME field to given value. + +### HasATT_NAME + +`func (o *Capitalization) HasATT_NAME() bool` + +HasATT_NAME 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Cat.md b/samples/openapi3/client/petstore/go/go-petstore/Cat.md new file mode 100644 index 00000000000..9f7f4f783cb --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Cat.md @@ -0,0 +1,56 @@ +# Cat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Declawed** | Pointer to **bool** | | [optional] + +## Methods + +### NewCat + +`func NewCat() *Cat` + +NewCat instantiates a new Cat 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 + +### NewCatWithDefaults + +`func NewCatWithDefaults() *Cat` + +NewCatWithDefaults instantiates a new Cat 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 + +### GetDeclawed + +`func (o *Cat) GetDeclawed() bool` + +GetDeclawed returns the Declawed field if non-nil, zero value otherwise. + +### GetDeclawedOk + +`func (o *Cat) GetDeclawedOk() (*bool, bool)` + +GetDeclawedOk returns a tuple with the Declawed field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDeclawed + +`func (o *Cat) SetDeclawed(v bool)` + +SetDeclawed sets Declawed field to given value. + +### HasDeclawed + +`func (o *Cat) HasDeclawed() bool` + +HasDeclawed 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/CatAllOf.md b/samples/openapi3/client/petstore/go/go-petstore/CatAllOf.md new file mode 100644 index 00000000000..be0cc6c8519 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/CatAllOf.md @@ -0,0 +1,56 @@ +# CatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Declawed** | Pointer to **bool** | | [optional] + +## Methods + +### NewCatAllOf + +`func NewCatAllOf() *CatAllOf` + +NewCatAllOf instantiates a new CatAllOf 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 + +### NewCatAllOfWithDefaults + +`func NewCatAllOfWithDefaults() *CatAllOf` + +NewCatAllOfWithDefaults instantiates a new CatAllOf 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 + +### GetDeclawed + +`func (o *CatAllOf) GetDeclawed() bool` + +GetDeclawed returns the Declawed field if non-nil, zero value otherwise. + +### GetDeclawedOk + +`func (o *CatAllOf) GetDeclawedOk() (*bool, bool)` + +GetDeclawedOk returns a tuple with the Declawed field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDeclawed + +`func (o *CatAllOf) SetDeclawed(v bool)` + +SetDeclawed sets Declawed field to given value. + +### HasDeclawed + +`func (o *CatAllOf) HasDeclawed() bool` + +HasDeclawed 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Category.md b/samples/openapi3/client/petstore/go/go-petstore/Category.md new file mode 100644 index 00000000000..0d3f6d4ff22 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Category.md @@ -0,0 +1,77 @@ +# Category + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int64** | | [optional] +**Name** | **string** | | [default to "default-name"] + +## Methods + +### NewCategory + +`func NewCategory(name string, ) *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. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/ClassModel.md b/samples/openapi3/client/petstore/go/go-petstore/ClassModel.md new file mode 100644 index 00000000000..51954107bc0 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/ClassModel.md @@ -0,0 +1,56 @@ +# ClassModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Class** | Pointer to **string** | | [optional] + +## Methods + +### NewClassModel + +`func NewClassModel() *ClassModel` + +NewClassModel instantiates a new ClassModel 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 + +### NewClassModelWithDefaults + +`func NewClassModelWithDefaults() *ClassModel` + +NewClassModelWithDefaults instantiates a new ClassModel 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 + +### GetClass + +`func (o *ClassModel) GetClass() string` + +GetClass returns the Class field if non-nil, zero value otherwise. + +### GetClassOk + +`func (o *ClassModel) GetClassOk() (*string, bool)` + +GetClassOk returns a tuple with the Class field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetClass + +`func (o *ClassModel) SetClass(v string)` + +SetClass sets Class field to given value. + +### HasClass + +`func (o *ClassModel) HasClass() bool` + +HasClass 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Client.md b/samples/openapi3/client/petstore/go/go-petstore/Client.md new file mode 100644 index 00000000000..e24e7c05be5 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Client.md @@ -0,0 +1,56 @@ +# Client + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Client** | Pointer to **string** | | [optional] + +## Methods + +### NewClient + +`func NewClient() *Client` + +NewClient instantiates a new Client 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 + +### NewClientWithDefaults + +`func NewClientWithDefaults() *Client` + +NewClientWithDefaults instantiates a new Client 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 + +### GetClient + +`func (o *Client) GetClient() string` + +GetClient returns the Client field if non-nil, zero value otherwise. + +### GetClientOk + +`func (o *Client) GetClientOk() (*string, bool)` + +GetClientOk returns a tuple with the Client field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetClient + +`func (o *Client) SetClient(v string)` + +SetClient sets Client field to given value. + +### HasClient + +`func (o *Client) HasClient() bool` + +HasClient 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/DefaultApi.md b/samples/openapi3/client/petstore/go/go-petstore/DefaultApi.md new file mode 100644 index 00000000000..7a138d8df4a --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/DefaultApi.md @@ -0,0 +1,68 @@ +# \DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**FooGet**](DefaultApi.md#FooGet) | **Get** /foo | + + + +## FooGet + +> InlineResponseDefault FooGet(ctx).Execute() + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.DefaultApi.FooGet(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.FooGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FooGet`: InlineResponseDefault + fmt.Fprintf(os.Stdout, "Response from `DefaultApi.FooGet`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiFooGetRequest struct via the builder pattern + + +### Return type + +[**InlineResponseDefault**](inline_response_default.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Dog.md b/samples/openapi3/client/petstore/go/go-petstore/Dog.md new file mode 100644 index 00000000000..edf746aaf55 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Dog.md @@ -0,0 +1,56 @@ +# Dog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Breed** | Pointer to **string** | | [optional] + +## Methods + +### NewDog + +`func NewDog() *Dog` + +NewDog instantiates a new Dog 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 + +### NewDogWithDefaults + +`func NewDogWithDefaults() *Dog` + +NewDogWithDefaults instantiates a new Dog 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 + +### GetBreed + +`func (o *Dog) GetBreed() string` + +GetBreed returns the Breed field if non-nil, zero value otherwise. + +### GetBreedOk + +`func (o *Dog) GetBreedOk() (*string, bool)` + +GetBreedOk returns a tuple with the Breed field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBreed + +`func (o *Dog) SetBreed(v string)` + +SetBreed sets Breed field to given value. + +### HasBreed + +`func (o *Dog) HasBreed() bool` + +HasBreed 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/DogAllOf.md b/samples/openapi3/client/petstore/go/go-petstore/DogAllOf.md new file mode 100644 index 00000000000..3ed4dfa5ea2 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/DogAllOf.md @@ -0,0 +1,56 @@ +# DogAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Breed** | Pointer to **string** | | [optional] + +## Methods + +### NewDogAllOf + +`func NewDogAllOf() *DogAllOf` + +NewDogAllOf instantiates a new DogAllOf 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 + +### NewDogAllOfWithDefaults + +`func NewDogAllOfWithDefaults() *DogAllOf` + +NewDogAllOfWithDefaults instantiates a new DogAllOf 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 + +### GetBreed + +`func (o *DogAllOf) GetBreed() string` + +GetBreed returns the Breed field if non-nil, zero value otherwise. + +### GetBreedOk + +`func (o *DogAllOf) GetBreedOk() (*string, bool)` + +GetBreedOk returns a tuple with the Breed field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBreed + +`func (o *DogAllOf) SetBreed(v string)` + +SetBreed sets Breed field to given value. + +### HasBreed + +`func (o *DogAllOf) HasBreed() bool` + +HasBreed 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/EnumArrays.md b/samples/openapi3/client/petstore/go/go-petstore/EnumArrays.md new file mode 100644 index 00000000000..28011e23f56 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/EnumArrays.md @@ -0,0 +1,82 @@ +# EnumArrays + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustSymbol** | Pointer to **string** | | [optional] +**ArrayEnum** | Pointer to **[]string** | | [optional] + +## Methods + +### NewEnumArrays + +`func NewEnumArrays() *EnumArrays` + +NewEnumArrays instantiates a new EnumArrays 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 + +### NewEnumArraysWithDefaults + +`func NewEnumArraysWithDefaults() *EnumArrays` + +NewEnumArraysWithDefaults instantiates a new EnumArrays 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 + +### GetJustSymbol + +`func (o *EnumArrays) GetJustSymbol() string` + +GetJustSymbol returns the JustSymbol field if non-nil, zero value otherwise. + +### GetJustSymbolOk + +`func (o *EnumArrays) GetJustSymbolOk() (*string, bool)` + +GetJustSymbolOk returns a tuple with the JustSymbol field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetJustSymbol + +`func (o *EnumArrays) SetJustSymbol(v string)` + +SetJustSymbol sets JustSymbol field to given value. + +### HasJustSymbol + +`func (o *EnumArrays) HasJustSymbol() bool` + +HasJustSymbol returns a boolean if a field has been set. + +### GetArrayEnum + +`func (o *EnumArrays) GetArrayEnum() []string` + +GetArrayEnum returns the ArrayEnum field if non-nil, zero value otherwise. + +### GetArrayEnumOk + +`func (o *EnumArrays) GetArrayEnumOk() (*[]string, bool)` + +GetArrayEnumOk returns a tuple with the ArrayEnum field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayEnum + +`func (o *EnumArrays) SetArrayEnum(v []string)` + +SetArrayEnum sets ArrayEnum field to given value. + +### HasArrayEnum + +`func (o *EnumArrays) HasArrayEnum() bool` + +HasArrayEnum 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/EnumClass.md b/samples/openapi3/client/petstore/go/go-petstore/EnumClass.md new file mode 100644 index 00000000000..e231f94bd73 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/EnumClass.md @@ -0,0 +1,11 @@ +# EnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/EnumTest.md b/samples/openapi3/client/petstore/go/go-petstore/EnumTest.md new file mode 100644 index 00000000000..a1761a7cd72 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/EnumTest.md @@ -0,0 +1,243 @@ +# EnumTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumString** | Pointer to **string** | | [optional] +**EnumStringRequired** | **string** | | +**EnumInteger** | Pointer to **int32** | | [optional] +**EnumNumber** | Pointer to **float64** | | [optional] +**OuterEnum** | Pointer to [**NullableOuterEnum**](OuterEnum.md) | | [optional] +**OuterEnumInteger** | Pointer to [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] +**OuterEnumDefaultValue** | Pointer to [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] [default to "placed"] +**OuterEnumIntegerDefaultValue** | Pointer to [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] [default to OUTERENUMINTEGERDEFAULTVALUE__0] + +## Methods + +### NewEnumTest + +`func NewEnumTest(enumStringRequired string, ) *EnumTest` + +NewEnumTest instantiates a new EnumTest 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 + +### NewEnumTestWithDefaults + +`func NewEnumTestWithDefaults() *EnumTest` + +NewEnumTestWithDefaults instantiates a new EnumTest 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 + +### GetEnumString + +`func (o *EnumTest) GetEnumString() string` + +GetEnumString returns the EnumString field if non-nil, zero value otherwise. + +### GetEnumStringOk + +`func (o *EnumTest) GetEnumStringOk() (*string, bool)` + +GetEnumStringOk returns a tuple with the EnumString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnumString + +`func (o *EnumTest) SetEnumString(v string)` + +SetEnumString sets EnumString field to given value. + +### HasEnumString + +`func (o *EnumTest) HasEnumString() bool` + +HasEnumString returns a boolean if a field has been set. + +### GetEnumStringRequired + +`func (o *EnumTest) GetEnumStringRequired() string` + +GetEnumStringRequired returns the EnumStringRequired field if non-nil, zero value otherwise. + +### GetEnumStringRequiredOk + +`func (o *EnumTest) GetEnumStringRequiredOk() (*string, bool)` + +GetEnumStringRequiredOk returns a tuple with the EnumStringRequired field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnumStringRequired + +`func (o *EnumTest) SetEnumStringRequired(v string)` + +SetEnumStringRequired sets EnumStringRequired field to given value. + + +### GetEnumInteger + +`func (o *EnumTest) GetEnumInteger() int32` + +GetEnumInteger returns the EnumInteger field if non-nil, zero value otherwise. + +### GetEnumIntegerOk + +`func (o *EnumTest) GetEnumIntegerOk() (*int32, bool)` + +GetEnumIntegerOk returns a tuple with the EnumInteger field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnumInteger + +`func (o *EnumTest) SetEnumInteger(v int32)` + +SetEnumInteger sets EnumInteger field to given value. + +### HasEnumInteger + +`func (o *EnumTest) HasEnumInteger() bool` + +HasEnumInteger returns a boolean if a field has been set. + +### GetEnumNumber + +`func (o *EnumTest) GetEnumNumber() float64` + +GetEnumNumber returns the EnumNumber field if non-nil, zero value otherwise. + +### GetEnumNumberOk + +`func (o *EnumTest) GetEnumNumberOk() (*float64, bool)` + +GetEnumNumberOk returns a tuple with the EnumNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnumNumber + +`func (o *EnumTest) SetEnumNumber(v float64)` + +SetEnumNumber sets EnumNumber field to given value. + +### HasEnumNumber + +`func (o *EnumTest) HasEnumNumber() bool` + +HasEnumNumber returns a boolean if a field has been set. + +### GetOuterEnum + +`func (o *EnumTest) GetOuterEnum() OuterEnum` + +GetOuterEnum returns the OuterEnum field if non-nil, zero value otherwise. + +### GetOuterEnumOk + +`func (o *EnumTest) GetOuterEnumOk() (*OuterEnum, bool)` + +GetOuterEnumOk returns a tuple with the OuterEnum field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOuterEnum + +`func (o *EnumTest) SetOuterEnum(v OuterEnum)` + +SetOuterEnum sets OuterEnum field to given value. + +### HasOuterEnum + +`func (o *EnumTest) HasOuterEnum() bool` + +HasOuterEnum returns a boolean if a field has been set. + +### SetOuterEnumNil + +`func (o *EnumTest) SetOuterEnumNil(b bool)` + + SetOuterEnumNil sets the value for OuterEnum to be an explicit nil + +### UnsetOuterEnum +`func (o *EnumTest) UnsetOuterEnum()` + +UnsetOuterEnum ensures that no value is present for OuterEnum, not even an explicit nil +### GetOuterEnumInteger + +`func (o *EnumTest) GetOuterEnumInteger() OuterEnumInteger` + +GetOuterEnumInteger returns the OuterEnumInteger field if non-nil, zero value otherwise. + +### GetOuterEnumIntegerOk + +`func (o *EnumTest) GetOuterEnumIntegerOk() (*OuterEnumInteger, bool)` + +GetOuterEnumIntegerOk returns a tuple with the OuterEnumInteger field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOuterEnumInteger + +`func (o *EnumTest) SetOuterEnumInteger(v OuterEnumInteger)` + +SetOuterEnumInteger sets OuterEnumInteger field to given value. + +### HasOuterEnumInteger + +`func (o *EnumTest) HasOuterEnumInteger() bool` + +HasOuterEnumInteger returns a boolean if a field has been set. + +### GetOuterEnumDefaultValue + +`func (o *EnumTest) GetOuterEnumDefaultValue() OuterEnumDefaultValue` + +GetOuterEnumDefaultValue returns the OuterEnumDefaultValue field if non-nil, zero value otherwise. + +### GetOuterEnumDefaultValueOk + +`func (o *EnumTest) GetOuterEnumDefaultValueOk() (*OuterEnumDefaultValue, bool)` + +GetOuterEnumDefaultValueOk returns a tuple with the OuterEnumDefaultValue field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOuterEnumDefaultValue + +`func (o *EnumTest) SetOuterEnumDefaultValue(v OuterEnumDefaultValue)` + +SetOuterEnumDefaultValue sets OuterEnumDefaultValue field to given value. + +### HasOuterEnumDefaultValue + +`func (o *EnumTest) HasOuterEnumDefaultValue() bool` + +HasOuterEnumDefaultValue returns a boolean if a field has been set. + +### GetOuterEnumIntegerDefaultValue + +`func (o *EnumTest) GetOuterEnumIntegerDefaultValue() OuterEnumIntegerDefaultValue` + +GetOuterEnumIntegerDefaultValue returns the OuterEnumIntegerDefaultValue field if non-nil, zero value otherwise. + +### GetOuterEnumIntegerDefaultValueOk + +`func (o *EnumTest) GetOuterEnumIntegerDefaultValueOk() (*OuterEnumIntegerDefaultValue, bool)` + +GetOuterEnumIntegerDefaultValueOk returns a tuple with the OuterEnumIntegerDefaultValue field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOuterEnumIntegerDefaultValue + +`func (o *EnumTest) SetOuterEnumIntegerDefaultValue(v OuterEnumIntegerDefaultValue)` + +SetOuterEnumIntegerDefaultValue sets OuterEnumIntegerDefaultValue field to given value. + +### HasOuterEnumIntegerDefaultValue + +`func (o *EnumTest) HasOuterEnumIntegerDefaultValue() bool` + +HasOuterEnumIntegerDefaultValue 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/FakeApi.md b/samples/openapi3/client/petstore/go/go-petstore/FakeApi.md new file mode 100644 index 00000000000..6924101be1e --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/FakeApi.md @@ -0,0 +1,979 @@ +# \FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**FakeHealthGet**](FakeApi.md#FakeHealthGet) | **Get** /fake/health | Health check endpoint +[**FakeOuterBooleanSerialize**](FakeApi.md#FakeOuterBooleanSerialize) | **Post** /fake/outer/boolean | +[**FakeOuterCompositeSerialize**](FakeApi.md#FakeOuterCompositeSerialize) | **Post** /fake/outer/composite | +[**FakeOuterNumberSerialize**](FakeApi.md#FakeOuterNumberSerialize) | **Post** /fake/outer/number | +[**FakeOuterStringSerialize**](FakeApi.md#FakeOuterStringSerialize) | **Post** /fake/outer/string | +[**TestBodyWithFileSchema**](FakeApi.md#TestBodyWithFileSchema) | **Put** /fake/body-with-file-schema | +[**TestBodyWithQueryParams**](FakeApi.md#TestBodyWithQueryParams) | **Put** /fake/body-with-query-params | +[**TestClientModel**](FakeApi.md#TestClientModel) | **Patch** /fake | To test \"client\" model +[**TestEndpointParameters**](FakeApi.md#TestEndpointParameters) | **Post** /fake | Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ +[**TestEnumParameters**](FakeApi.md#TestEnumParameters) | **Get** /fake | To test enum parameters +[**TestGroupParameters**](FakeApi.md#TestGroupParameters) | **Delete** /fake | Fake endpoint to test group parameters (optional) +[**TestInlineAdditionalProperties**](FakeApi.md#TestInlineAdditionalProperties) | **Post** /fake/inline-additionalProperties | test inline additionalProperties +[**TestJsonFormData**](FakeApi.md#TestJsonFormData) | **Get** /fake/jsonFormData | test json serialization of form data +[**TestQueryParameterCollectionFormat**](FakeApi.md#TestQueryParameterCollectionFormat) | **Put** /fake/test-query-paramters | + + + +## FakeHealthGet + +> HealthCheckResult FakeHealthGet(ctx).Execute() + +Health check endpoint + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeHealthGet(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeHealthGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeHealthGet`: HealthCheckResult + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeHealthGet`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiFakeHealthGetRequest struct via the builder pattern + + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FakeOuterBooleanSerialize + +> bool FakeOuterBooleanSerialize(ctx).Body(body).Execute() + + + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := true // bool | Input boolean as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterBooleanSerialize(context.Background(), ).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterBooleanSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterBooleanSerialize`: bool + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterBooleanSerialize`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFakeOuterBooleanSerializeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **bool** | Input boolean as post body | + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: */* + +[[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) + + +## FakeOuterCompositeSerialize + +> OuterComposite FakeOuterCompositeSerialize(ctx).OuterComposite(outerComposite).Execute() + + + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + outerComposite := openapiclient.OuterComposite{MyNumber: 123, MyString: "MyString_example", MyBoolean: false} // OuterComposite | Input composite as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterCompositeSerialize(context.Background(), ).OuterComposite(outerComposite).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterCompositeSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterCompositeSerialize`: OuterComposite + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterCompositeSerialize`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFakeOuterCompositeSerializeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerComposite** | [**OuterComposite**](OuterComposite.md) | Input composite as post body | + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: */* + +[[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) + + +## FakeOuterNumberSerialize + +> float32 FakeOuterNumberSerialize(ctx).Body(body).Execute() + + + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := 987 // float32 | Input number as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterNumberSerialize(context.Background(), ).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterNumberSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterNumberSerialize`: float32 + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterNumberSerialize`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFakeOuterNumberSerializeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **float32** | Input number as post body | + +### Return type + +**float32** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: */* + +[[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) + + +## FakeOuterStringSerialize + +> string FakeOuterStringSerialize(ctx).Body(body).Execute() + + + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := "body_example" // string | Input string as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterStringSerialize(context.Background(), ).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterStringSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterStringSerialize`: string + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterStringSerialize`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFakeOuterStringSerializeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **string** | Input string as post body | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: */* + +[[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) + + +## TestBodyWithFileSchema + +> TestBodyWithFileSchema(ctx).FileSchemaTestClass(fileSchemaTestClass).Execute() + + + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + fileSchemaTestClass := openapiclient.FileSchemaTestClass{File: openapiclient.File{SourceURI: "SourceURI_example"}, Files: []File{openapiclient.File{SourceURI: "SourceURI_example"})} // FileSchemaTestClass | + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestBodyWithFileSchema(context.Background(), fileSchemaTestClass).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestBodyWithFileSchema``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestBodyWithFileSchemaRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md) | | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[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) + + +## TestBodyWithQueryParams + +> TestBodyWithQueryParams(ctx).Query(query).User(user).Execute() + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + query := "query_example" // string | + user := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: 123, ArbitraryNullableObject: 123, ArbitraryTypeValue: 123, ArbitraryNullableTypeValue: 123} // User | + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestBodyWithQueryParams(context.Background(), query, user).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestBodyWithQueryParams``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestBodyWithQueryParamsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **string** | | + **user** | [**User**](User.md) | | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[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) + + +## TestClientModel + +> Client TestClientModel(ctx).Client(client).Execute() + +To test \"client\" model + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + client := openapiclient.Client{Client: "Client_example"} // Client | client model + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestClientModel(context.Background(), client).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestClientModel``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestClientModel`: Client + fmt.Fprintf(os.Stdout, "Response from `FakeApi.TestClientModel`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestClientModelRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md) | client model | + +### Return type + +[**Client**](Client.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) + + +## TestEndpointParameters + +> TestEndpointParameters(ctx).Number(number).Double(double).PatternWithoutDelimiter(patternWithoutDelimiter).Byte_(byte_).Integer(integer).Int32_(int32_).Int64_(int64_).Float(float).String_(string_).Binary(binary).Date(date).DateTime(dateTime).Password(password).Callback(callback).Execute() + +Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + number := 987 // float32 | None + double := 987 // float64 | None + patternWithoutDelimiter := "patternWithoutDelimiter_example" // string | None + byte_ := 987 // string | None + integer := 987 // int32 | None (optional) + int32_ := 987 // int32 | None (optional) + int64_ := 987 // int64 | None (optional) + float := 987 // float32 | None (optional) + string_ := "string__example" // string | None (optional) + binary := 987 // *os.File | None (optional) + date := Get-Date // string | None (optional) + dateTime := Get-Date // time.Time | None (optional) + password := "password_example" // string | None (optional) + callback := "callback_example" // string | None (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestEndpointParameters(context.Background(), number, double, patternWithoutDelimiter, byte_).Integer(integer).Int32_(int32_).Int64_(int64_).Float(float).String_(string_).Binary(binary).Date(date).DateTime(dateTime).Password(password).Callback(callback).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestEndpointParameters``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestEndpointParametersRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **float32** | None | + **double** | **float64** | None | + **patternWithoutDelimiter** | **string** | None | + **byte_** | **string** | None | + **integer** | **int32** | None | + **int32_** | **int32** | None | + **int64_** | **int64** | None | + **float** | **float32** | None | + **string_** | **string** | None | + **binary** | ***os.File** | None | + **date** | **string** | None | + **dateTime** | **time.Time** | None | + **password** | **string** | None | + **callback** | **string** | None | + +### Return type + + (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +[[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) + + +## TestEnumParameters + +> TestEnumParameters(ctx).EnumHeaderStringArray(enumHeaderStringArray).EnumHeaderString(enumHeaderString).EnumQueryStringArray(enumQueryStringArray).EnumQueryString(enumQueryString).EnumQueryInteger(enumQueryInteger).EnumQueryDouble(enumQueryDouble).EnumFormStringArray(enumFormStringArray).EnumFormString(enumFormString).Execute() + +To test enum parameters + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + enumHeaderStringArray := []string{"EnumHeaderStringArray_example"} // []string | Header parameter enum test (string array) (optional) + enumHeaderString := "enumHeaderString_example" // string | Header parameter enum test (string) (optional) (default to "-efg") + enumQueryStringArray := []string{"EnumQueryStringArray_example"} // []string | Query parameter enum test (string array) (optional) + enumQueryString := "enumQueryString_example" // string | Query parameter enum test (string) (optional) (default to "-efg") + enumQueryInteger := 987 // int32 | Query parameter enum test (double) (optional) + enumQueryDouble := 987 // float64 | Query parameter enum test (double) (optional) + enumFormStringArray := []string{"Inner_example"} // []string | Form parameter enum test (string array) (optional) (default to "$") + enumFormString := "enumFormString_example" // string | Form parameter enum test (string) (optional) (default to "-efg") + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestEnumParameters(context.Background(), ).EnumHeaderStringArray(enumHeaderStringArray).EnumHeaderString(enumHeaderString).EnumQueryStringArray(enumQueryStringArray).EnumQueryString(enumQueryString).EnumQueryInteger(enumQueryInteger).EnumQueryDouble(enumQueryDouble).EnumFormStringArray(enumFormStringArray).EnumFormString(enumFormString).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestEnumParameters``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestEnumParametersRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**[]string**](string.md) | Header parameter enum test (string array) | + **enumHeaderString** | **string** | Header parameter enum test (string) | [default to "-efg"] + **enumQueryStringArray** | [**[]string**](string.md) | Query parameter enum test (string array) | + **enumQueryString** | **string** | Query parameter enum test (string) | [default to "-efg"] + **enumQueryInteger** | **int32** | Query parameter enum test (double) | + **enumQueryDouble** | **float64** | Query parameter enum test (double) | + **enumFormStringArray** | [**[]string**](string.md) | Form parameter enum test (string array) | [default to "$"] + **enumFormString** | **string** | Form parameter enum test (string) | [default to "-efg"] + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +[[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) + + +## TestGroupParameters + +> TestGroupParameters(ctx).RequiredStringGroup(requiredStringGroup).RequiredBooleanGroup(requiredBooleanGroup).RequiredInt64Group(requiredInt64Group).StringGroup(stringGroup).BooleanGroup(booleanGroup).Int64Group(int64Group).Execute() + +Fake endpoint to test group parameters (optional) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + requiredStringGroup := 987 // int32 | Required String in group parameters + requiredBooleanGroup := true // bool | Required Boolean in group parameters + requiredInt64Group := 987 // int64 | Required Integer in group parameters + stringGroup := 987 // int32 | String in group parameters (optional) + booleanGroup := true // bool | Boolean in group parameters (optional) + int64Group := 987 // int64 | Integer in group parameters (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestGroupParameters(context.Background(), requiredStringGroup, requiredBooleanGroup, requiredInt64Group).StringGroup(stringGroup).BooleanGroup(booleanGroup).Int64Group(int64Group).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestGroupParameters``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestGroupParametersRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | **int32** | Required String in group parameters | + **requiredBooleanGroup** | **bool** | Required Boolean in group parameters | + **requiredInt64Group** | **int64** | Required Integer in group parameters | + **stringGroup** | **int32** | String in group parameters | + **booleanGroup** | **bool** | Boolean in group parameters | + **int64Group** | **int64** | Integer in group parameters | + +### Return type + + (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## TestInlineAdditionalProperties + +> TestInlineAdditionalProperties(ctx).RequestBody(requestBody).Execute() + +test inline additionalProperties + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + requestBody := map[string]string{ "Key" = "Value" } // map[string]string | request body + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestInlineAdditionalProperties(context.Background(), requestBody).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestInlineAdditionalProperties``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestInlineAdditionalPropertiesRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**map[string]string**](string.md) | request body | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[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) + + +## TestJsonFormData + +> TestJsonFormData(ctx).Param(param).Param2(param2).Execute() + +test json serialization of form data + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + param := "param_example" // string | field1 + param2 := "param2_example" // string | field2 + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestJsonFormData(context.Background(), param, param2).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestJsonFormData``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestJsonFormDataRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **string** | field1 | + **param2** | **string** | field2 | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +[[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) + + +## TestQueryParameterCollectionFormat + +> TestQueryParameterCollectionFormat(ctx).Pipe(pipe).Ioutil(ioutil).Http(http).Url(url).Context(context).Execute() + + + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + pipe := []string{"Inner_example"} // []string | + ioutil := []string{"Inner_example"} // []string | + http := []string{"Inner_example"} // []string | + url := []string{"Inner_example"} // []string | + context := []string{"Inner_example"} // []string | + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestQueryParameterCollectionFormat(context.Background(), pipe, ioutil, http, url, context).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestQueryParameterCollectionFormat``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestQueryParameterCollectionFormatRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**[]string**](string.md) | | + **ioutil** | [**[]string**](string.md) | | + **http** | [**[]string**](string.md) | | + **url** | [**[]string**](string.md) | | + **context** | [**[]string**](string.md) | | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/go/go-petstore/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/go/go-petstore/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..1898cc7411b --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/FakeClassnameTags123Api.md @@ -0,0 +1,75 @@ +# \FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestClassname**](FakeClassnameTags123Api.md#TestClassname) | **Patch** /fake_classname_test | To test class name in snake case + + + +## TestClassname + +> Client TestClassname(ctx).Client(client).Execute() + +To test class name in snake case + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + client := openapiclient.Client{Client: "Client_example"} // Client | client model + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeClassnameTags123Api.TestClassname(context.Background(), client).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeClassnameTags123Api.TestClassname``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestClassname`: Client + fmt.Fprintf(os.Stdout, "Response from `FakeClassnameTags123Api.TestClassname`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestClassnameRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md) | client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### 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) + diff --git a/samples/openapi3/client/petstore/go/go-petstore/File.md b/samples/openapi3/client/petstore/go/go-petstore/File.md new file mode 100644 index 00000000000..91fe90e06f1 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/File.md @@ -0,0 +1,56 @@ +# File + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SourceURI** | Pointer to **string** | Test capitalization | [optional] + +## Methods + +### NewFile + +`func NewFile() *File` + +NewFile instantiates a new File 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 + +### NewFileWithDefaults + +`func NewFileWithDefaults() *File` + +NewFileWithDefaults instantiates a new File 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 + +### GetSourceURI + +`func (o *File) GetSourceURI() string` + +GetSourceURI returns the SourceURI field if non-nil, zero value otherwise. + +### GetSourceURIOk + +`func (o *File) GetSourceURIOk() (*string, bool)` + +GetSourceURIOk returns a tuple with the SourceURI field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSourceURI + +`func (o *File) SetSourceURI(v string)` + +SetSourceURI sets SourceURI field to given value. + +### HasSourceURI + +`func (o *File) HasSourceURI() bool` + +HasSourceURI 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/FileSchemaTestClass.md b/samples/openapi3/client/petstore/go/go-petstore/FileSchemaTestClass.md new file mode 100644 index 00000000000..2db8eb31902 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/FileSchemaTestClass.md @@ -0,0 +1,82 @@ +# FileSchemaTestClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | Pointer to [**File**](File.md) | | [optional] +**Files** | Pointer to [**[]File**](File.md) | | [optional] + +## Methods + +### NewFileSchemaTestClass + +`func NewFileSchemaTestClass() *FileSchemaTestClass` + +NewFileSchemaTestClass instantiates a new FileSchemaTestClass 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 + +### NewFileSchemaTestClassWithDefaults + +`func NewFileSchemaTestClassWithDefaults() *FileSchemaTestClass` + +NewFileSchemaTestClassWithDefaults instantiates a new FileSchemaTestClass 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 + +### GetFile + +`func (o *FileSchemaTestClass) GetFile() File` + +GetFile returns the File field if non-nil, zero value otherwise. + +### GetFileOk + +`func (o *FileSchemaTestClass) GetFileOk() (*File, bool)` + +GetFileOk returns a tuple with the File field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFile + +`func (o *FileSchemaTestClass) SetFile(v File)` + +SetFile sets File field to given value. + +### HasFile + +`func (o *FileSchemaTestClass) HasFile() bool` + +HasFile returns a boolean if a field has been set. + +### GetFiles + +`func (o *FileSchemaTestClass) GetFiles() []File` + +GetFiles returns the Files field if non-nil, zero value otherwise. + +### GetFilesOk + +`func (o *FileSchemaTestClass) GetFilesOk() (*[]File, bool)` + +GetFilesOk returns a tuple with the Files field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFiles + +`func (o *FileSchemaTestClass) SetFiles(v []File)` + +SetFiles sets Files field to given value. + +### HasFiles + +`func (o *FileSchemaTestClass) HasFiles() bool` + +HasFiles 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Foo.md b/samples/openapi3/client/petstore/go/go-petstore/Foo.md new file mode 100644 index 00000000000..7f1593a87f4 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Foo.md @@ -0,0 +1,56 @@ +# Foo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | Pointer to **string** | | [optional] [default to "bar"] + +## Methods + +### NewFoo + +`func NewFoo() *Foo` + +NewFoo instantiates a new Foo 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 + +### NewFooWithDefaults + +`func NewFooWithDefaults() *Foo` + +NewFooWithDefaults instantiates a new Foo 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 + +### GetBar + +`func (o *Foo) GetBar() string` + +GetBar returns the Bar field if non-nil, zero value otherwise. + +### GetBarOk + +`func (o *Foo) GetBarOk() (*string, bool)` + +GetBarOk returns a tuple with the Bar field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBar + +`func (o *Foo) SetBar(v string)` + +SetBar sets Bar field to given value. + +### HasBar + +`func (o *Foo) HasBar() bool` + +HasBar 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/FormatTest.md b/samples/openapi3/client/petstore/go/go-petstore/FormatTest.md new file mode 100644 index 00000000000..f94ef3040f2 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/FormatTest.md @@ -0,0 +1,400 @@ +# FormatTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Integer** | Pointer to **int32** | | [optional] +**Int32** | Pointer to **int32** | | [optional] +**Int64** | Pointer to **int64** | | [optional] +**Number** | **float32** | | +**Float** | Pointer to **float32** | | [optional] +**Double** | Pointer to **float64** | | [optional] +**String** | Pointer to **string** | | [optional] +**Byte** | **string** | | +**Binary** | Pointer to [***os.File**](*os.File.md) | | [optional] +**Date** | **string** | | +**DateTime** | Pointer to [**time.Time**](time.Time.md) | | [optional] +**Uuid** | Pointer to **string** | | [optional] +**Password** | **string** | | +**PatternWithDigits** | Pointer to **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] +**PatternWithDigitsAndDelimiter** | Pointer to **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] + +## Methods + +### NewFormatTest + +`func NewFormatTest(number float32, byte_ string, date string, password string, ) *FormatTest` + +NewFormatTest instantiates a new FormatTest 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 + +### NewFormatTestWithDefaults + +`func NewFormatTestWithDefaults() *FormatTest` + +NewFormatTestWithDefaults instantiates a new FormatTest 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 + +### GetInteger + +`func (o *FormatTest) GetInteger() int32` + +GetInteger returns the Integer field if non-nil, zero value otherwise. + +### GetIntegerOk + +`func (o *FormatTest) GetIntegerOk() (*int32, bool)` + +GetIntegerOk returns a tuple with the Integer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInteger + +`func (o *FormatTest) SetInteger(v int32)` + +SetInteger sets Integer field to given value. + +### HasInteger + +`func (o *FormatTest) HasInteger() bool` + +HasInteger returns a boolean if a field has been set. + +### GetInt32 + +`func (o *FormatTest) GetInt32() int32` + +GetInt32 returns the Int32 field if non-nil, zero value otherwise. + +### GetInt32Ok + +`func (o *FormatTest) GetInt32Ok() (*int32, bool)` + +GetInt32Ok returns a tuple with the Int32 field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInt32 + +`func (o *FormatTest) SetInt32(v int32)` + +SetInt32 sets Int32 field to given value. + +### HasInt32 + +`func (o *FormatTest) HasInt32() bool` + +HasInt32 returns a boolean if a field has been set. + +### GetInt64 + +`func (o *FormatTest) GetInt64() int64` + +GetInt64 returns the Int64 field if non-nil, zero value otherwise. + +### GetInt64Ok + +`func (o *FormatTest) GetInt64Ok() (*int64, bool)` + +GetInt64Ok returns a tuple with the Int64 field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInt64 + +`func (o *FormatTest) SetInt64(v int64)` + +SetInt64 sets Int64 field to given value. + +### HasInt64 + +`func (o *FormatTest) HasInt64() bool` + +HasInt64 returns a boolean if a field has been set. + +### GetNumber + +`func (o *FormatTest) GetNumber() float32` + +GetNumber returns the Number field if non-nil, zero value otherwise. + +### GetNumberOk + +`func (o *FormatTest) 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 *FormatTest) SetNumber(v float32)` + +SetNumber sets Number field to given value. + + +### GetFloat + +`func (o *FormatTest) GetFloat() float32` + +GetFloat returns the Float field if non-nil, zero value otherwise. + +### GetFloatOk + +`func (o *FormatTest) 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 *FormatTest) SetFloat(v float32)` + +SetFloat sets Float field to given value. + +### HasFloat + +`func (o *FormatTest) HasFloat() bool` + +HasFloat returns a boolean if a field has been set. + +### GetDouble + +`func (o *FormatTest) GetDouble() float64` + +GetDouble returns the Double field if non-nil, zero value otherwise. + +### GetDoubleOk + +`func (o *FormatTest) 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 *FormatTest) SetDouble(v float64)` + +SetDouble sets Double field to given value. + +### HasDouble + +`func (o *FormatTest) HasDouble() bool` + +HasDouble returns a boolean if a field has been set. + +### GetString + +`func (o *FormatTest) GetString() string` + +GetString returns the String field if non-nil, zero value otherwise. + +### GetStringOk + +`func (o *FormatTest) GetStringOk() (*string, bool)` + +GetStringOk returns a tuple with the String field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetString + +`func (o *FormatTest) SetString(v string)` + +SetString sets String field to given value. + +### HasString + +`func (o *FormatTest) HasString() bool` + +HasString returns a boolean if a field has been set. + +### GetByte + +`func (o *FormatTest) GetByte() string` + +GetByte returns the Byte field if non-nil, zero value otherwise. + +### GetByteOk + +`func (o *FormatTest) GetByteOk() (*string, bool)` + +GetByteOk returns a tuple with the Byte field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetByte + +`func (o *FormatTest) SetByte(v string)` + +SetByte sets Byte field to given value. + + +### GetBinary + +`func (o *FormatTest) GetBinary() *os.File` + +GetBinary returns the Binary field if non-nil, zero value otherwise. + +### GetBinaryOk + +`func (o *FormatTest) GetBinaryOk() (**os.File, bool)` + +GetBinaryOk returns a tuple with the Binary field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBinary + +`func (o *FormatTest) SetBinary(v *os.File)` + +SetBinary sets Binary field to given value. + +### HasBinary + +`func (o *FormatTest) HasBinary() bool` + +HasBinary returns a boolean if a field has been set. + +### GetDate + +`func (o *FormatTest) GetDate() string` + +GetDate returns the Date field if non-nil, zero value otherwise. + +### GetDateOk + +`func (o *FormatTest) GetDateOk() (*string, 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 *FormatTest) SetDate(v string)` + +SetDate sets Date field to given value. + + +### GetDateTime + +`func (o *FormatTest) GetDateTime() time.Time` + +GetDateTime returns the DateTime field if non-nil, zero value otherwise. + +### GetDateTimeOk + +`func (o *FormatTest) GetDateTimeOk() (*time.Time, bool)` + +GetDateTimeOk returns a tuple with the DateTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDateTime + +`func (o *FormatTest) SetDateTime(v time.Time)` + +SetDateTime sets DateTime field to given value. + +### HasDateTime + +`func (o *FormatTest) HasDateTime() bool` + +HasDateTime returns a boolean if a field has been set. + +### GetUuid + +`func (o *FormatTest) GetUuid() string` + +GetUuid returns the Uuid field if non-nil, zero value otherwise. + +### GetUuidOk + +`func (o *FormatTest) GetUuidOk() (*string, bool)` + +GetUuidOk returns a tuple with the Uuid field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUuid + +`func (o *FormatTest) SetUuid(v string)` + +SetUuid sets Uuid field to given value. + +### HasUuid + +`func (o *FormatTest) HasUuid() bool` + +HasUuid returns a boolean if a field has been set. + +### GetPassword + +`func (o *FormatTest) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *FormatTest) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *FormatTest) SetPassword(v string)` + +SetPassword sets Password field to given value. + + +### GetPatternWithDigits + +`func (o *FormatTest) GetPatternWithDigits() string` + +GetPatternWithDigits returns the PatternWithDigits field if non-nil, zero value otherwise. + +### GetPatternWithDigitsOk + +`func (o *FormatTest) GetPatternWithDigitsOk() (*string, bool)` + +GetPatternWithDigitsOk returns a tuple with the PatternWithDigits field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPatternWithDigits + +`func (o *FormatTest) SetPatternWithDigits(v string)` + +SetPatternWithDigits sets PatternWithDigits field to given value. + +### HasPatternWithDigits + +`func (o *FormatTest) HasPatternWithDigits() bool` + +HasPatternWithDigits returns a boolean if a field has been set. + +### GetPatternWithDigitsAndDelimiter + +`func (o *FormatTest) GetPatternWithDigitsAndDelimiter() string` + +GetPatternWithDigitsAndDelimiter returns the PatternWithDigitsAndDelimiter field if non-nil, zero value otherwise. + +### GetPatternWithDigitsAndDelimiterOk + +`func (o *FormatTest) GetPatternWithDigitsAndDelimiterOk() (*string, bool)` + +GetPatternWithDigitsAndDelimiterOk returns a tuple with the PatternWithDigitsAndDelimiter field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPatternWithDigitsAndDelimiter + +`func (o *FormatTest) SetPatternWithDigitsAndDelimiter(v string)` + +SetPatternWithDigitsAndDelimiter sets PatternWithDigitsAndDelimiter field to given value. + +### HasPatternWithDigitsAndDelimiter + +`func (o *FormatTest) HasPatternWithDigitsAndDelimiter() bool` + +HasPatternWithDigitsAndDelimiter 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Fruit.md b/samples/openapi3/client/petstore/go/go-petstore/Fruit.md new file mode 100644 index 00000000000..bccbd0baf80 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Fruit.md @@ -0,0 +1,108 @@ +# Fruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | Pointer to **string** | | [optional] +**Cultivar** | Pointer to **string** | | [optional] +**LengthCm** | Pointer to **float32** | | [optional] + +## Methods + +### NewFruit + +`func NewFruit() *Fruit` + +NewFruit instantiates a new Fruit 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 + +### NewFruitWithDefaults + +`func NewFruitWithDefaults() *Fruit` + +NewFruitWithDefaults instantiates a new Fruit 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 + +### GetColor + +`func (o *Fruit) GetColor() string` + +GetColor returns the Color field if non-nil, zero value otherwise. + +### GetColorOk + +`func (o *Fruit) 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 *Fruit) SetColor(v string)` + +SetColor sets Color field to given value. + +### HasColor + +`func (o *Fruit) HasColor() bool` + +HasColor returns a boolean if a field has been set. + +### GetCultivar + +`func (o *Fruit) GetCultivar() string` + +GetCultivar returns the Cultivar field if non-nil, zero value otherwise. + +### GetCultivarOk + +`func (o *Fruit) GetCultivarOk() (*string, bool)` + +GetCultivarOk returns a tuple with the Cultivar field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCultivar + +`func (o *Fruit) SetCultivar(v string)` + +SetCultivar sets Cultivar field to given value. + +### HasCultivar + +`func (o *Fruit) HasCultivar() bool` + +HasCultivar returns a boolean if a field has been set. + +### GetLengthCm + +`func (o *Fruit) GetLengthCm() float32` + +GetLengthCm returns the LengthCm field if non-nil, zero value otherwise. + +### GetLengthCmOk + +`func (o *Fruit) GetLengthCmOk() (*float32, bool)` + +GetLengthCmOk returns a tuple with the LengthCm field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLengthCm + +`func (o *Fruit) SetLengthCm(v float32)` + +SetLengthCm sets LengthCm field to given value. + +### HasLengthCm + +`func (o *Fruit) HasLengthCm() bool` + +HasLengthCm 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/FruitReq.md b/samples/openapi3/client/petstore/go/go-petstore/FruitReq.md new file mode 100644 index 00000000000..1128c2be20e --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/FruitReq.md @@ -0,0 +1,124 @@ +# FruitReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Cultivar** | **string** | | +**Mealy** | Pointer to **bool** | | [optional] +**LengthCm** | **float32** | | +**Sweet** | Pointer to **bool** | | [optional] + +## Methods + +### NewFruitReq + +`func NewFruitReq(cultivar string, lengthCm float32, ) *FruitReq` + +NewFruitReq instantiates a new FruitReq 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 + +### NewFruitReqWithDefaults + +`func NewFruitReqWithDefaults() *FruitReq` + +NewFruitReqWithDefaults instantiates a new FruitReq 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 + +### GetCultivar + +`func (o *FruitReq) GetCultivar() string` + +GetCultivar returns the Cultivar field if non-nil, zero value otherwise. + +### GetCultivarOk + +`func (o *FruitReq) GetCultivarOk() (*string, bool)` + +GetCultivarOk returns a tuple with the Cultivar field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCultivar + +`func (o *FruitReq) SetCultivar(v string)` + +SetCultivar sets Cultivar field to given value. + + +### GetMealy + +`func (o *FruitReq) GetMealy() bool` + +GetMealy returns the Mealy field if non-nil, zero value otherwise. + +### GetMealyOk + +`func (o *FruitReq) GetMealyOk() (*bool, bool)` + +GetMealyOk returns a tuple with the Mealy field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMealy + +`func (o *FruitReq) SetMealy(v bool)` + +SetMealy sets Mealy field to given value. + +### HasMealy + +`func (o *FruitReq) HasMealy() bool` + +HasMealy returns a boolean if a field has been set. + +### GetLengthCm + +`func (o *FruitReq) GetLengthCm() float32` + +GetLengthCm returns the LengthCm field if non-nil, zero value otherwise. + +### GetLengthCmOk + +`func (o *FruitReq) GetLengthCmOk() (*float32, bool)` + +GetLengthCmOk returns a tuple with the LengthCm field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLengthCm + +`func (o *FruitReq) SetLengthCm(v float32)` + +SetLengthCm sets LengthCm field to given value. + + +### GetSweet + +`func (o *FruitReq) GetSweet() bool` + +GetSweet returns the Sweet field if non-nil, zero value otherwise. + +### GetSweetOk + +`func (o *FruitReq) GetSweetOk() (*bool, bool)` + +GetSweetOk returns a tuple with the Sweet field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSweet + +`func (o *FruitReq) SetSweet(v bool)` + +SetSweet sets Sweet field to given value. + +### HasSweet + +`func (o *FruitReq) HasSweet() bool` + +HasSweet 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/GmFruit.md b/samples/openapi3/client/petstore/go/go-petstore/GmFruit.md new file mode 100644 index 00000000000..3de5c85bb0b --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/GmFruit.md @@ -0,0 +1,108 @@ +# GmFruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | Pointer to **string** | | [optional] +**Cultivar** | Pointer to **string** | | [optional] +**LengthCm** | Pointer to **float32** | | [optional] + +## Methods + +### NewGmFruit + +`func NewGmFruit() *GmFruit` + +NewGmFruit instantiates a new GmFruit 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 + +### NewGmFruitWithDefaults + +`func NewGmFruitWithDefaults() *GmFruit` + +NewGmFruitWithDefaults instantiates a new GmFruit 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 + +### GetColor + +`func (o *GmFruit) GetColor() string` + +GetColor returns the Color field if non-nil, zero value otherwise. + +### GetColorOk + +`func (o *GmFruit) 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 *GmFruit) SetColor(v string)` + +SetColor sets Color field to given value. + +### HasColor + +`func (o *GmFruit) HasColor() bool` + +HasColor returns a boolean if a field has been set. + +### GetCultivar + +`func (o *GmFruit) GetCultivar() string` + +GetCultivar returns the Cultivar field if non-nil, zero value otherwise. + +### GetCultivarOk + +`func (o *GmFruit) GetCultivarOk() (*string, bool)` + +GetCultivarOk returns a tuple with the Cultivar field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCultivar + +`func (o *GmFruit) SetCultivar(v string)` + +SetCultivar sets Cultivar field to given value. + +### HasCultivar + +`func (o *GmFruit) HasCultivar() bool` + +HasCultivar returns a boolean if a field has been set. + +### GetLengthCm + +`func (o *GmFruit) GetLengthCm() float32` + +GetLengthCm returns the LengthCm field if non-nil, zero value otherwise. + +### GetLengthCmOk + +`func (o *GmFruit) GetLengthCmOk() (*float32, bool)` + +GetLengthCmOk returns a tuple with the LengthCm field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLengthCm + +`func (o *GmFruit) SetLengthCm(v float32)` + +SetLengthCm sets LengthCm field to given value. + +### HasLengthCm + +`func (o *GmFruit) HasLengthCm() bool` + +HasLengthCm 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/go/go-petstore/HasOnlyReadOnly.md new file mode 100644 index 00000000000..7f54d772840 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/HasOnlyReadOnly.md @@ -0,0 +1,82 @@ +# HasOnlyReadOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | Pointer to **string** | | [optional] [readonly] +**Foo** | Pointer to **string** | | [optional] [readonly] + +## Methods + +### NewHasOnlyReadOnly + +`func NewHasOnlyReadOnly() *HasOnlyReadOnly` + +NewHasOnlyReadOnly instantiates a new HasOnlyReadOnly 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 + +### NewHasOnlyReadOnlyWithDefaults + +`func NewHasOnlyReadOnlyWithDefaults() *HasOnlyReadOnly` + +NewHasOnlyReadOnlyWithDefaults instantiates a new HasOnlyReadOnly 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 + +### GetBar + +`func (o *HasOnlyReadOnly) GetBar() string` + +GetBar returns the Bar field if non-nil, zero value otherwise. + +### GetBarOk + +`func (o *HasOnlyReadOnly) GetBarOk() (*string, bool)` + +GetBarOk returns a tuple with the Bar field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBar + +`func (o *HasOnlyReadOnly) SetBar(v string)` + +SetBar sets Bar field to given value. + +### HasBar + +`func (o *HasOnlyReadOnly) HasBar() bool` + +HasBar returns a boolean if a field has been set. + +### GetFoo + +`func (o *HasOnlyReadOnly) GetFoo() string` + +GetFoo returns the Foo field if non-nil, zero value otherwise. + +### GetFooOk + +`func (o *HasOnlyReadOnly) GetFooOk() (*string, bool)` + +GetFooOk returns a tuple with the Foo field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFoo + +`func (o *HasOnlyReadOnly) SetFoo(v string)` + +SetFoo sets Foo field to given value. + +### HasFoo + +`func (o *HasOnlyReadOnly) HasFoo() bool` + +HasFoo 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/HealthCheckResult.md b/samples/openapi3/client/petstore/go/go-petstore/HealthCheckResult.md new file mode 100644 index 00000000000..7f057faf717 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/HealthCheckResult.md @@ -0,0 +1,66 @@ +# HealthCheckResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**NullableMessage** | Pointer to **NullableString** | | [optional] + +## Methods + +### NewHealthCheckResult + +`func NewHealthCheckResult() *HealthCheckResult` + +NewHealthCheckResult instantiates a new HealthCheckResult 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 + +### NewHealthCheckResultWithDefaults + +`func NewHealthCheckResultWithDefaults() *HealthCheckResult` + +NewHealthCheckResultWithDefaults instantiates a new HealthCheckResult 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 + +### GetNullableMessage + +`func (o *HealthCheckResult) GetNullableMessage() string` + +GetNullableMessage returns the NullableMessage field if non-nil, zero value otherwise. + +### GetNullableMessageOk + +`func (o *HealthCheckResult) GetNullableMessageOk() (*string, bool)` + +GetNullableMessageOk returns a tuple with the NullableMessage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNullableMessage + +`func (o *HealthCheckResult) SetNullableMessage(v string)` + +SetNullableMessage sets NullableMessage field to given value. + +### HasNullableMessage + +`func (o *HealthCheckResult) HasNullableMessage() bool` + +HasNullableMessage returns a boolean if a field has been set. + +### SetNullableMessageNil + +`func (o *HealthCheckResult) SetNullableMessageNil(b bool)` + + SetNullableMessageNil sets the value for NullableMessage to be an explicit nil + +### UnsetNullableMessage +`func (o *HealthCheckResult) UnsetNullableMessage()` + +UnsetNullableMessage ensures that no value is present for NullableMessage, 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/InlineObject.md b/samples/openapi3/client/petstore/go/go-petstore/InlineObject.md new file mode 100644 index 00000000000..4b0ad91e390 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/InlineObject.md @@ -0,0 +1,82 @@ +# InlineObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | Updated name of the pet | [optional] +**Status** | Pointer to **string** | Updated status of the pet | [optional] + +## Methods + +### NewInlineObject + +`func NewInlineObject() *InlineObject` + +NewInlineObject instantiates a new InlineObject 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 + +### NewInlineObjectWithDefaults + +`func NewInlineObjectWithDefaults() *InlineObject` + +NewInlineObjectWithDefaults instantiates a new InlineObject 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 + +### GetName + +`func (o *InlineObject) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *InlineObject) 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 *InlineObject) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *InlineObject) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetStatus + +`func (o *InlineObject) GetStatus() string` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *InlineObject) 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 *InlineObject) SetStatus(v string)` + +SetStatus sets Status field to given value. + +### HasStatus + +`func (o *InlineObject) 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/InlineObject1.md b/samples/openapi3/client/petstore/go/go-petstore/InlineObject1.md new file mode 100644 index 00000000000..ab137f8670f --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/InlineObject1.md @@ -0,0 +1,82 @@ +# InlineObject1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AdditionalMetadata** | Pointer to **string** | Additional data to pass to server | [optional] +**File** | Pointer to [***os.File**](*os.File.md) | file to upload | [optional] + +## Methods + +### NewInlineObject1 + +`func NewInlineObject1() *InlineObject1` + +NewInlineObject1 instantiates a new InlineObject1 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 + +### NewInlineObject1WithDefaults + +`func NewInlineObject1WithDefaults() *InlineObject1` + +NewInlineObject1WithDefaults instantiates a new InlineObject1 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 + +### GetAdditionalMetadata + +`func (o *InlineObject1) GetAdditionalMetadata() string` + +GetAdditionalMetadata returns the AdditionalMetadata field if non-nil, zero value otherwise. + +### GetAdditionalMetadataOk + +`func (o *InlineObject1) GetAdditionalMetadataOk() (*string, bool)` + +GetAdditionalMetadataOk returns a tuple with the AdditionalMetadata field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAdditionalMetadata + +`func (o *InlineObject1) SetAdditionalMetadata(v string)` + +SetAdditionalMetadata sets AdditionalMetadata field to given value. + +### HasAdditionalMetadata + +`func (o *InlineObject1) HasAdditionalMetadata() bool` + +HasAdditionalMetadata returns a boolean if a field has been set. + +### GetFile + +`func (o *InlineObject1) GetFile() *os.File` + +GetFile returns the File field if non-nil, zero value otherwise. + +### GetFileOk + +`func (o *InlineObject1) GetFileOk() (**os.File, bool)` + +GetFileOk returns a tuple with the File field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFile + +`func (o *InlineObject1) SetFile(v *os.File)` + +SetFile sets File field to given value. + +### HasFile + +`func (o *InlineObject1) HasFile() bool` + +HasFile 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/InlineObject2.md b/samples/openapi3/client/petstore/go/go-petstore/InlineObject2.md new file mode 100644 index 00000000000..0b6a0dbf0a4 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/InlineObject2.md @@ -0,0 +1,82 @@ +# InlineObject2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumFormStringArray** | Pointer to **[]string** | Form parameter enum test (string array) | [optional] +**EnumFormString** | Pointer to **string** | Form parameter enum test (string) | [optional] [default to "-efg"] + +## Methods + +### NewInlineObject2 + +`func NewInlineObject2() *InlineObject2` + +NewInlineObject2 instantiates a new InlineObject2 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 + +### NewInlineObject2WithDefaults + +`func NewInlineObject2WithDefaults() *InlineObject2` + +NewInlineObject2WithDefaults instantiates a new InlineObject2 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 + +### GetEnumFormStringArray + +`func (o *InlineObject2) GetEnumFormStringArray() []string` + +GetEnumFormStringArray returns the EnumFormStringArray field if non-nil, zero value otherwise. + +### GetEnumFormStringArrayOk + +`func (o *InlineObject2) GetEnumFormStringArrayOk() (*[]string, bool)` + +GetEnumFormStringArrayOk returns a tuple with the EnumFormStringArray field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnumFormStringArray + +`func (o *InlineObject2) SetEnumFormStringArray(v []string)` + +SetEnumFormStringArray sets EnumFormStringArray field to given value. + +### HasEnumFormStringArray + +`func (o *InlineObject2) HasEnumFormStringArray() bool` + +HasEnumFormStringArray returns a boolean if a field has been set. + +### GetEnumFormString + +`func (o *InlineObject2) GetEnumFormString() string` + +GetEnumFormString returns the EnumFormString field if non-nil, zero value otherwise. + +### GetEnumFormStringOk + +`func (o *InlineObject2) GetEnumFormStringOk() (*string, bool)` + +GetEnumFormStringOk returns a tuple with the EnumFormString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnumFormString + +`func (o *InlineObject2) SetEnumFormString(v string)` + +SetEnumFormString sets EnumFormString field to given value. + +### HasEnumFormString + +`func (o *InlineObject2) HasEnumFormString() bool` + +HasEnumFormString 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/InlineObject3.md b/samples/openapi3/client/petstore/go/go-petstore/InlineObject3.md new file mode 100644 index 00000000000..e0c1472b2f7 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/InlineObject3.md @@ -0,0 +1,374 @@ +# InlineObject3 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Integer** | Pointer to **int32** | None | [optional] +**Int32** | Pointer to **int32** | None | [optional] +**Int64** | Pointer to **int64** | None | [optional] +**Number** | **float32** | None | +**Float** | Pointer to **float32** | None | [optional] +**Double** | **float64** | None | +**String** | Pointer to **string** | None | [optional] +**PatternWithoutDelimiter** | **string** | None | +**Byte** | **string** | None | +**Binary** | Pointer to [***os.File**](*os.File.md) | None | [optional] +**Date** | Pointer to **string** | None | [optional] +**DateTime** | Pointer to [**time.Time**](time.Time.md) | None | [optional] +**Password** | Pointer to **string** | None | [optional] +**Callback** | Pointer to **string** | None | [optional] + +## Methods + +### NewInlineObject3 + +`func NewInlineObject3(number float32, double float64, patternWithoutDelimiter string, byte_ string, ) *InlineObject3` + +NewInlineObject3 instantiates a new InlineObject3 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 + +### NewInlineObject3WithDefaults + +`func NewInlineObject3WithDefaults() *InlineObject3` + +NewInlineObject3WithDefaults instantiates a new InlineObject3 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 + +### GetInteger + +`func (o *InlineObject3) GetInteger() int32` + +GetInteger returns the Integer field if non-nil, zero value otherwise. + +### GetIntegerOk + +`func (o *InlineObject3) GetIntegerOk() (*int32, bool)` + +GetIntegerOk returns a tuple with the Integer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInteger + +`func (o *InlineObject3) SetInteger(v int32)` + +SetInteger sets Integer field to given value. + +### HasInteger + +`func (o *InlineObject3) HasInteger() bool` + +HasInteger returns a boolean if a field has been set. + +### GetInt32 + +`func (o *InlineObject3) GetInt32() int32` + +GetInt32 returns the Int32 field if non-nil, zero value otherwise. + +### GetInt32Ok + +`func (o *InlineObject3) GetInt32Ok() (*int32, bool)` + +GetInt32Ok returns a tuple with the Int32 field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInt32 + +`func (o *InlineObject3) SetInt32(v int32)` + +SetInt32 sets Int32 field to given value. + +### HasInt32 + +`func (o *InlineObject3) HasInt32() bool` + +HasInt32 returns a boolean if a field has been set. + +### GetInt64 + +`func (o *InlineObject3) GetInt64() int64` + +GetInt64 returns the Int64 field if non-nil, zero value otherwise. + +### GetInt64Ok + +`func (o *InlineObject3) GetInt64Ok() (*int64, bool)` + +GetInt64Ok returns a tuple with the Int64 field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInt64 + +`func (o *InlineObject3) SetInt64(v int64)` + +SetInt64 sets Int64 field to given value. + +### HasInt64 + +`func (o *InlineObject3) HasInt64() bool` + +HasInt64 returns a boolean if a field has been set. + +### GetNumber + +`func (o *InlineObject3) GetNumber() float32` + +GetNumber returns the Number field if non-nil, zero value otherwise. + +### GetNumberOk + +`func (o *InlineObject3) 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 *InlineObject3) SetNumber(v float32)` + +SetNumber sets Number field to given value. + + +### GetFloat + +`func (o *InlineObject3) GetFloat() float32` + +GetFloat returns the Float field if non-nil, zero value otherwise. + +### GetFloatOk + +`func (o *InlineObject3) 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 *InlineObject3) SetFloat(v float32)` + +SetFloat sets Float field to given value. + +### HasFloat + +`func (o *InlineObject3) HasFloat() bool` + +HasFloat returns a boolean if a field has been set. + +### GetDouble + +`func (o *InlineObject3) GetDouble() float64` + +GetDouble returns the Double field if non-nil, zero value otherwise. + +### GetDoubleOk + +`func (o *InlineObject3) 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 *InlineObject3) SetDouble(v float64)` + +SetDouble sets Double field to given value. + + +### GetString + +`func (o *InlineObject3) GetString() string` + +GetString returns the String field if non-nil, zero value otherwise. + +### GetStringOk + +`func (o *InlineObject3) GetStringOk() (*string, bool)` + +GetStringOk returns a tuple with the String field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetString + +`func (o *InlineObject3) SetString(v string)` + +SetString sets String field to given value. + +### HasString + +`func (o *InlineObject3) HasString() bool` + +HasString returns a boolean if a field has been set. + +### GetPatternWithoutDelimiter + +`func (o *InlineObject3) GetPatternWithoutDelimiter() string` + +GetPatternWithoutDelimiter returns the PatternWithoutDelimiter field if non-nil, zero value otherwise. + +### GetPatternWithoutDelimiterOk + +`func (o *InlineObject3) GetPatternWithoutDelimiterOk() (*string, bool)` + +GetPatternWithoutDelimiterOk returns a tuple with the PatternWithoutDelimiter field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPatternWithoutDelimiter + +`func (o *InlineObject3) SetPatternWithoutDelimiter(v string)` + +SetPatternWithoutDelimiter sets PatternWithoutDelimiter field to given value. + + +### GetByte + +`func (o *InlineObject3) GetByte() string` + +GetByte returns the Byte field if non-nil, zero value otherwise. + +### GetByteOk + +`func (o *InlineObject3) GetByteOk() (*string, bool)` + +GetByteOk returns a tuple with the Byte field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetByte + +`func (o *InlineObject3) SetByte(v string)` + +SetByte sets Byte field to given value. + + +### GetBinary + +`func (o *InlineObject3) GetBinary() *os.File` + +GetBinary returns the Binary field if non-nil, zero value otherwise. + +### GetBinaryOk + +`func (o *InlineObject3) GetBinaryOk() (**os.File, bool)` + +GetBinaryOk returns a tuple with the Binary field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBinary + +`func (o *InlineObject3) SetBinary(v *os.File)` + +SetBinary sets Binary field to given value. + +### HasBinary + +`func (o *InlineObject3) HasBinary() bool` + +HasBinary returns a boolean if a field has been set. + +### GetDate + +`func (o *InlineObject3) GetDate() string` + +GetDate returns the Date field if non-nil, zero value otherwise. + +### GetDateOk + +`func (o *InlineObject3) GetDateOk() (*string, 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 *InlineObject3) SetDate(v string)` + +SetDate sets Date field to given value. + +### HasDate + +`func (o *InlineObject3) HasDate() bool` + +HasDate returns a boolean if a field has been set. + +### GetDateTime + +`func (o *InlineObject3) GetDateTime() time.Time` + +GetDateTime returns the DateTime field if non-nil, zero value otherwise. + +### GetDateTimeOk + +`func (o *InlineObject3) GetDateTimeOk() (*time.Time, bool)` + +GetDateTimeOk returns a tuple with the DateTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDateTime + +`func (o *InlineObject3) SetDateTime(v time.Time)` + +SetDateTime sets DateTime field to given value. + +### HasDateTime + +`func (o *InlineObject3) HasDateTime() bool` + +HasDateTime returns a boolean if a field has been set. + +### GetPassword + +`func (o *InlineObject3) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *InlineObject3) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *InlineObject3) SetPassword(v string)` + +SetPassword sets Password field to given value. + +### HasPassword + +`func (o *InlineObject3) HasPassword() bool` + +HasPassword returns a boolean if a field has been set. + +### GetCallback + +`func (o *InlineObject3) GetCallback() string` + +GetCallback returns the Callback field if non-nil, zero value otherwise. + +### GetCallbackOk + +`func (o *InlineObject3) GetCallbackOk() (*string, bool)` + +GetCallbackOk returns a tuple with the Callback field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCallback + +`func (o *InlineObject3) SetCallback(v string)` + +SetCallback sets Callback field to given value. + +### HasCallback + +`func (o *InlineObject3) HasCallback() bool` + +HasCallback 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/InlineObject4.md b/samples/openapi3/client/petstore/go/go-petstore/InlineObject4.md new file mode 100644 index 00000000000..e716f8dd913 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/InlineObject4.md @@ -0,0 +1,72 @@ +# InlineObject4 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Param** | **string** | field1 | +**Param2** | **string** | field2 | + +## Methods + +### NewInlineObject4 + +`func NewInlineObject4(param string, param2 string, ) *InlineObject4` + +NewInlineObject4 instantiates a new InlineObject4 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 + +### NewInlineObject4WithDefaults + +`func NewInlineObject4WithDefaults() *InlineObject4` + +NewInlineObject4WithDefaults instantiates a new InlineObject4 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 + +### GetParam + +`func (o *InlineObject4) GetParam() string` + +GetParam returns the Param field if non-nil, zero value otherwise. + +### GetParamOk + +`func (o *InlineObject4) GetParamOk() (*string, bool)` + +GetParamOk returns a tuple with the Param field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetParam + +`func (o *InlineObject4) SetParam(v string)` + +SetParam sets Param field to given value. + + +### GetParam2 + +`func (o *InlineObject4) GetParam2() string` + +GetParam2 returns the Param2 field if non-nil, zero value otherwise. + +### GetParam2Ok + +`func (o *InlineObject4) GetParam2Ok() (*string, bool)` + +GetParam2Ok returns a tuple with the Param2 field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetParam2 + +`func (o *InlineObject4) SetParam2(v string)` + +SetParam2 sets Param2 field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/InlineObject5.md b/samples/openapi3/client/petstore/go/go-petstore/InlineObject5.md new file mode 100644 index 00000000000..a6a4f9367b5 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/InlineObject5.md @@ -0,0 +1,77 @@ +# InlineObject5 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AdditionalMetadata** | Pointer to **string** | Additional data to pass to server | [optional] +**RequiredFile** | [***os.File**](*os.File.md) | file to upload | + +## Methods + +### NewInlineObject5 + +`func NewInlineObject5(requiredFile *os.File, ) *InlineObject5` + +NewInlineObject5 instantiates a new InlineObject5 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 + +### NewInlineObject5WithDefaults + +`func NewInlineObject5WithDefaults() *InlineObject5` + +NewInlineObject5WithDefaults instantiates a new InlineObject5 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 + +### GetAdditionalMetadata + +`func (o *InlineObject5) GetAdditionalMetadata() string` + +GetAdditionalMetadata returns the AdditionalMetadata field if non-nil, zero value otherwise. + +### GetAdditionalMetadataOk + +`func (o *InlineObject5) GetAdditionalMetadataOk() (*string, bool)` + +GetAdditionalMetadataOk returns a tuple with the AdditionalMetadata field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAdditionalMetadata + +`func (o *InlineObject5) SetAdditionalMetadata(v string)` + +SetAdditionalMetadata sets AdditionalMetadata field to given value. + +### HasAdditionalMetadata + +`func (o *InlineObject5) HasAdditionalMetadata() bool` + +HasAdditionalMetadata returns a boolean if a field has been set. + +### GetRequiredFile + +`func (o *InlineObject5) GetRequiredFile() *os.File` + +GetRequiredFile returns the RequiredFile field if non-nil, zero value otherwise. + +### GetRequiredFileOk + +`func (o *InlineObject5) GetRequiredFileOk() (**os.File, bool)` + +GetRequiredFileOk returns a tuple with the RequiredFile field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRequiredFile + +`func (o *InlineObject5) SetRequiredFile(v *os.File)` + +SetRequiredFile sets RequiredFile field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/InlineResponseDefault.md b/samples/openapi3/client/petstore/go/go-petstore/InlineResponseDefault.md new file mode 100644 index 00000000000..0736bb1fb42 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/InlineResponseDefault.md @@ -0,0 +1,56 @@ +# InlineResponseDefault + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | Pointer to [**Foo**](Foo.md) | | [optional] + +## Methods + +### NewInlineResponseDefault + +`func NewInlineResponseDefault() *InlineResponseDefault` + +NewInlineResponseDefault instantiates a new InlineResponseDefault 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 + +### NewInlineResponseDefaultWithDefaults + +`func NewInlineResponseDefaultWithDefaults() *InlineResponseDefault` + +NewInlineResponseDefaultWithDefaults instantiates a new InlineResponseDefault 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 + +### GetString + +`func (o *InlineResponseDefault) GetString() Foo` + +GetString returns the String field if non-nil, zero value otherwise. + +### GetStringOk + +`func (o *InlineResponseDefault) GetStringOk() (*Foo, bool)` + +GetStringOk returns a tuple with the String field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetString + +`func (o *InlineResponseDefault) SetString(v Foo)` + +SetString sets String field to given value. + +### HasString + +`func (o *InlineResponseDefault) HasString() bool` + +HasString 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/List.md b/samples/openapi3/client/petstore/go/go-petstore/List.md new file mode 100644 index 00000000000..271c8236a8b --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/List.md @@ -0,0 +1,56 @@ +# List + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Var123List** | Pointer to **string** | | [optional] + +## Methods + +### NewList + +`func NewList() *List` + +NewList instantiates a new List 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 + +### NewListWithDefaults + +`func NewListWithDefaults() *List` + +NewListWithDefaults instantiates a new List 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 + +### GetVar123List + +`func (o *List) GetVar123List() string` + +GetVar123List returns the Var123List field if non-nil, zero value otherwise. + +### GetVar123ListOk + +`func (o *List) GetVar123ListOk() (*string, bool)` + +GetVar123ListOk returns a tuple with the Var123List field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVar123List + +`func (o *List) SetVar123List(v string)` + +SetVar123List sets Var123List field to given value. + +### HasVar123List + +`func (o *List) HasVar123List() bool` + +HasVar123List 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Mammal.md b/samples/openapi3/client/petstore/go/go-petstore/Mammal.md new file mode 100644 index 00000000000..6e926911167 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Mammal.md @@ -0,0 +1,129 @@ +# Mammal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**HasBaleen** | Pointer to **bool** | | [optional] +**HasTeeth** | Pointer to **bool** | | [optional] +**ClassName** | **string** | | +**Type** | Pointer to **string** | | [optional] + +## Methods + +### NewMammal + +`func NewMammal(className string, ) *Mammal` + +NewMammal instantiates a new Mammal 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 + +### NewMammalWithDefaults + +`func NewMammalWithDefaults() *Mammal` + +NewMammalWithDefaults instantiates a new Mammal 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 + +### GetHasBaleen + +`func (o *Mammal) GetHasBaleen() bool` + +GetHasBaleen returns the HasBaleen field if non-nil, zero value otherwise. + +### GetHasBaleenOk + +`func (o *Mammal) GetHasBaleenOk() (*bool, bool)` + +GetHasBaleenOk returns a tuple with the HasBaleen field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHasBaleen + +`func (o *Mammal) SetHasBaleen(v bool)` + +SetHasBaleen sets HasBaleen field to given value. + +### HasHasBaleen + +`func (o *Mammal) HasHasBaleen() bool` + +HasHasBaleen returns a boolean if a field has been set. + +### GetHasTeeth + +`func (o *Mammal) GetHasTeeth() bool` + +GetHasTeeth returns the HasTeeth field if non-nil, zero value otherwise. + +### GetHasTeethOk + +`func (o *Mammal) GetHasTeethOk() (*bool, bool)` + +GetHasTeethOk returns a tuple with the HasTeeth field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHasTeeth + +`func (o *Mammal) SetHasTeeth(v bool)` + +SetHasTeeth sets HasTeeth field to given value. + +### HasHasTeeth + +`func (o *Mammal) HasHasTeeth() bool` + +HasHasTeeth returns a boolean if a field has been set. + +### GetClassName + +`func (o *Mammal) GetClassName() string` + +GetClassName returns the ClassName field if non-nil, zero value otherwise. + +### GetClassNameOk + +`func (o *Mammal) GetClassNameOk() (*string, bool)` + +GetClassNameOk returns a tuple with the ClassName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetClassName + +`func (o *Mammal) SetClassName(v string)` + +SetClassName sets ClassName field to given value. + + +### GetType + +`func (o *Mammal) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *Mammal) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *Mammal) SetType(v string)` + +SetType sets Type field to given value. + +### HasType + +`func (o *Mammal) HasType() bool` + +HasType 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/MapTest.md b/samples/openapi3/client/petstore/go/go-petstore/MapTest.md new file mode 100644 index 00000000000..6b35263c4e3 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/MapTest.md @@ -0,0 +1,134 @@ +# MapTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MapMapOfString** | Pointer to [**map[string]map[string]string**](map.md) | | [optional] +**MapOfEnumString** | Pointer to **map[string]string** | | [optional] +**DirectMap** | Pointer to **map[string]bool** | | [optional] +**IndirectMap** | Pointer to **map[string]bool** | | [optional] + +## Methods + +### NewMapTest + +`func NewMapTest() *MapTest` + +NewMapTest instantiates a new MapTest 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 + +### NewMapTestWithDefaults + +`func NewMapTestWithDefaults() *MapTest` + +NewMapTestWithDefaults instantiates a new MapTest 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 + +### GetMapMapOfString + +`func (o *MapTest) GetMapMapOfString() map[string]map[string]string` + +GetMapMapOfString returns the MapMapOfString field if non-nil, zero value otherwise. + +### GetMapMapOfStringOk + +`func (o *MapTest) GetMapMapOfStringOk() (*map[string]map[string]string, bool)` + +GetMapMapOfStringOk returns a tuple with the MapMapOfString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMapMapOfString + +`func (o *MapTest) SetMapMapOfString(v map[string]map[string]string)` + +SetMapMapOfString sets MapMapOfString field to given value. + +### HasMapMapOfString + +`func (o *MapTest) HasMapMapOfString() bool` + +HasMapMapOfString returns a boolean if a field has been set. + +### GetMapOfEnumString + +`func (o *MapTest) GetMapOfEnumString() map[string]string` + +GetMapOfEnumString returns the MapOfEnumString field if non-nil, zero value otherwise. + +### GetMapOfEnumStringOk + +`func (o *MapTest) GetMapOfEnumStringOk() (*map[string]string, bool)` + +GetMapOfEnumStringOk returns a tuple with the MapOfEnumString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMapOfEnumString + +`func (o *MapTest) SetMapOfEnumString(v map[string]string)` + +SetMapOfEnumString sets MapOfEnumString field to given value. + +### HasMapOfEnumString + +`func (o *MapTest) HasMapOfEnumString() bool` + +HasMapOfEnumString returns a boolean if a field has been set. + +### GetDirectMap + +`func (o *MapTest) GetDirectMap() map[string]bool` + +GetDirectMap returns the DirectMap field if non-nil, zero value otherwise. + +### GetDirectMapOk + +`func (o *MapTest) GetDirectMapOk() (*map[string]bool, bool)` + +GetDirectMapOk returns a tuple with the DirectMap field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDirectMap + +`func (o *MapTest) SetDirectMap(v map[string]bool)` + +SetDirectMap sets DirectMap field to given value. + +### HasDirectMap + +`func (o *MapTest) HasDirectMap() bool` + +HasDirectMap returns a boolean if a field has been set. + +### GetIndirectMap + +`func (o *MapTest) GetIndirectMap() map[string]bool` + +GetIndirectMap returns the IndirectMap field if non-nil, zero value otherwise. + +### GetIndirectMapOk + +`func (o *MapTest) GetIndirectMapOk() (*map[string]bool, bool)` + +GetIndirectMapOk returns a tuple with the IndirectMap field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIndirectMap + +`func (o *MapTest) SetIndirectMap(v map[string]bool)` + +SetIndirectMap sets IndirectMap field to given value. + +### HasIndirectMap + +`func (o *MapTest) HasIndirectMap() bool` + +HasIndirectMap 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/go/go-petstore/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..f726ffe63e1 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,108 @@ +# MixedPropertiesAndAdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Uuid** | Pointer to **string** | | [optional] +**DateTime** | Pointer to [**time.Time**](time.Time.md) | | [optional] +**Map** | Pointer to [**map[string]Animal**](Animal.md) | | [optional] + +## Methods + +### NewMixedPropertiesAndAdditionalPropertiesClass + +`func NewMixedPropertiesAndAdditionalPropertiesClass() *MixedPropertiesAndAdditionalPropertiesClass` + +NewMixedPropertiesAndAdditionalPropertiesClass instantiates a new MixedPropertiesAndAdditionalPropertiesClass 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 + +### NewMixedPropertiesAndAdditionalPropertiesClassWithDefaults + +`func NewMixedPropertiesAndAdditionalPropertiesClassWithDefaults() *MixedPropertiesAndAdditionalPropertiesClass` + +NewMixedPropertiesAndAdditionalPropertiesClassWithDefaults instantiates a new MixedPropertiesAndAdditionalPropertiesClass 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 + +### GetUuid + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) GetUuid() string` + +GetUuid returns the Uuid field if non-nil, zero value otherwise. + +### GetUuidOk + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) GetUuidOk() (*string, bool)` + +GetUuidOk returns a tuple with the Uuid field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUuid + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) SetUuid(v string)` + +SetUuid sets Uuid field to given value. + +### HasUuid + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) HasUuid() bool` + +HasUuid returns a boolean if a field has been set. + +### GetDateTime + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) GetDateTime() time.Time` + +GetDateTime returns the DateTime field if non-nil, zero value otherwise. + +### GetDateTimeOk + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) GetDateTimeOk() (*time.Time, bool)` + +GetDateTimeOk returns a tuple with the DateTime field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDateTime + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) SetDateTime(v time.Time)` + +SetDateTime sets DateTime field to given value. + +### HasDateTime + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) HasDateTime() bool` + +HasDateTime returns a boolean if a field has been set. + +### GetMap + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) GetMap() map[string]Animal` + +GetMap returns the Map field if non-nil, zero value otherwise. + +### GetMapOk + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) GetMapOk() (*map[string]Animal, bool)` + +GetMapOk returns a tuple with the Map field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMap + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) SetMap(v map[string]Animal)` + +SetMap sets Map field to given value. + +### HasMap + +`func (o *MixedPropertiesAndAdditionalPropertiesClass) HasMap() bool` + +HasMap 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Name.md b/samples/openapi3/client/petstore/go/go-petstore/Name.md new file mode 100644 index 00000000000..18cf04789d6 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Name.md @@ -0,0 +1,129 @@ +# Name + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **int32** | | +**SnakeCase** | Pointer to **int32** | | [optional] [readonly] +**Property** | Pointer to **string** | | [optional] +**Var123Number** | Pointer to **int32** | | [optional] [readonly] + +## Methods + +### NewName + +`func NewName(name int32, ) *Name` + +NewName instantiates a new Name 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 + +### NewNameWithDefaults + +`func NewNameWithDefaults() *Name` + +NewNameWithDefaults instantiates a new Name 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 + +### GetName + +`func (o *Name) GetName() int32` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Name) GetNameOk() (*int32, 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 *Name) SetName(v int32)` + +SetName sets Name field to given value. + + +### GetSnakeCase + +`func (o *Name) GetSnakeCase() int32` + +GetSnakeCase returns the SnakeCase field if non-nil, zero value otherwise. + +### GetSnakeCaseOk + +`func (o *Name) GetSnakeCaseOk() (*int32, bool)` + +GetSnakeCaseOk returns a tuple with the SnakeCase field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSnakeCase + +`func (o *Name) SetSnakeCase(v int32)` + +SetSnakeCase sets SnakeCase field to given value. + +### HasSnakeCase + +`func (o *Name) HasSnakeCase() bool` + +HasSnakeCase returns a boolean if a field has been set. + +### GetProperty + +`func (o *Name) GetProperty() string` + +GetProperty returns the Property field if non-nil, zero value otherwise. + +### GetPropertyOk + +`func (o *Name) GetPropertyOk() (*string, bool)` + +GetPropertyOk returns a tuple with the Property field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProperty + +`func (o *Name) SetProperty(v string)` + +SetProperty sets Property field to given value. + +### HasProperty + +`func (o *Name) HasProperty() bool` + +HasProperty returns a boolean if a field has been set. + +### GetVar123Number + +`func (o *Name) GetVar123Number() int32` + +GetVar123Number returns the Var123Number field if non-nil, zero value otherwise. + +### GetVar123NumberOk + +`func (o *Name) GetVar123NumberOk() (*int32, bool)` + +GetVar123NumberOk returns a tuple with the Var123Number field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVar123Number + +`func (o *Name) SetVar123Number(v int32)` + +SetVar123Number sets Var123Number field to given value. + +### HasVar123Number + +`func (o *Name) HasVar123Number() bool` + +HasVar123Number 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/NullableClass.md b/samples/openapi3/client/petstore/go/go-petstore/NullableClass.md new file mode 100644 index 00000000000..e24e6447515 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/NullableClass.md @@ -0,0 +1,442 @@ +# NullableClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**IntegerProp** | Pointer to **NullableInt32** | | [optional] +**NumberProp** | Pointer to **NullableFloat32** | | [optional] +**BooleanProp** | Pointer to **NullableBool** | | [optional] +**StringProp** | Pointer to **NullableString** | | [optional] +**DateProp** | Pointer to **NullableString** | | [optional] +**DatetimeProp** | Pointer to [**NullableTime**](time.Time.md) | | [optional] +**ArrayNullableProp** | Pointer to **[]map[string]interface{}** | | [optional] +**ArrayAndItemsNullableProp** | Pointer to **[]map[string]interface{}** | | [optional] +**ArrayItemsNullable** | Pointer to **[]map[string]interface{}** | | [optional] +**ObjectNullableProp** | Pointer to **map[string]map[string]interface{}** | | [optional] +**ObjectAndItemsNullableProp** | Pointer to **map[string]map[string]interface{}** | | [optional] +**ObjectItemsNullable** | Pointer to **map[string]map[string]interface{}** | | [optional] + +## Methods + +### NewNullableClass + +`func NewNullableClass() *NullableClass` + +NewNullableClass instantiates a new NullableClass 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 + +### NewNullableClassWithDefaults + +`func NewNullableClassWithDefaults() *NullableClass` + +NewNullableClassWithDefaults instantiates a new NullableClass 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 + +### GetIntegerProp + +`func (o *NullableClass) GetIntegerProp() int32` + +GetIntegerProp returns the IntegerProp field if non-nil, zero value otherwise. + +### GetIntegerPropOk + +`func (o *NullableClass) GetIntegerPropOk() (*int32, bool)` + +GetIntegerPropOk returns a tuple with the IntegerProp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIntegerProp + +`func (o *NullableClass) SetIntegerProp(v int32)` + +SetIntegerProp sets IntegerProp field to given value. + +### HasIntegerProp + +`func (o *NullableClass) HasIntegerProp() bool` + +HasIntegerProp returns a boolean if a field has been set. + +### SetIntegerPropNil + +`func (o *NullableClass) SetIntegerPropNil(b bool)` + + SetIntegerPropNil sets the value for IntegerProp to be an explicit nil + +### UnsetIntegerProp +`func (o *NullableClass) UnsetIntegerProp()` + +UnsetIntegerProp ensures that no value is present for IntegerProp, not even an explicit nil +### GetNumberProp + +`func (o *NullableClass) GetNumberProp() float32` + +GetNumberProp returns the NumberProp field if non-nil, zero value otherwise. + +### GetNumberPropOk + +`func (o *NullableClass) GetNumberPropOk() (*float32, bool)` + +GetNumberPropOk returns a tuple with the NumberProp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNumberProp + +`func (o *NullableClass) SetNumberProp(v float32)` + +SetNumberProp sets NumberProp field to given value. + +### HasNumberProp + +`func (o *NullableClass) HasNumberProp() bool` + +HasNumberProp returns a boolean if a field has been set. + +### SetNumberPropNil + +`func (o *NullableClass) SetNumberPropNil(b bool)` + + SetNumberPropNil sets the value for NumberProp to be an explicit nil + +### UnsetNumberProp +`func (o *NullableClass) UnsetNumberProp()` + +UnsetNumberProp ensures that no value is present for NumberProp, not even an explicit nil +### GetBooleanProp + +`func (o *NullableClass) GetBooleanProp() bool` + +GetBooleanProp returns the BooleanProp field if non-nil, zero value otherwise. + +### GetBooleanPropOk + +`func (o *NullableClass) GetBooleanPropOk() (*bool, bool)` + +GetBooleanPropOk returns a tuple with the BooleanProp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBooleanProp + +`func (o *NullableClass) SetBooleanProp(v bool)` + +SetBooleanProp sets BooleanProp field to given value. + +### HasBooleanProp + +`func (o *NullableClass) HasBooleanProp() bool` + +HasBooleanProp returns a boolean if a field has been set. + +### SetBooleanPropNil + +`func (o *NullableClass) SetBooleanPropNil(b bool)` + + SetBooleanPropNil sets the value for BooleanProp to be an explicit nil + +### UnsetBooleanProp +`func (o *NullableClass) UnsetBooleanProp()` + +UnsetBooleanProp ensures that no value is present for BooleanProp, not even an explicit nil +### GetStringProp + +`func (o *NullableClass) GetStringProp() string` + +GetStringProp returns the StringProp field if non-nil, zero value otherwise. + +### GetStringPropOk + +`func (o *NullableClass) GetStringPropOk() (*string, bool)` + +GetStringPropOk returns a tuple with the StringProp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStringProp + +`func (o *NullableClass) SetStringProp(v string)` + +SetStringProp sets StringProp field to given value. + +### HasStringProp + +`func (o *NullableClass) HasStringProp() bool` + +HasStringProp returns a boolean if a field has been set. + +### SetStringPropNil + +`func (o *NullableClass) SetStringPropNil(b bool)` + + SetStringPropNil sets the value for StringProp to be an explicit nil + +### UnsetStringProp +`func (o *NullableClass) UnsetStringProp()` + +UnsetStringProp ensures that no value is present for StringProp, not even an explicit nil +### GetDateProp + +`func (o *NullableClass) GetDateProp() string` + +GetDateProp returns the DateProp field if non-nil, zero value otherwise. + +### GetDatePropOk + +`func (o *NullableClass) GetDatePropOk() (*string, bool)` + +GetDatePropOk returns a tuple with the DateProp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDateProp + +`func (o *NullableClass) SetDateProp(v string)` + +SetDateProp sets DateProp field to given value. + +### HasDateProp + +`func (o *NullableClass) HasDateProp() bool` + +HasDateProp returns a boolean if a field has been set. + +### SetDatePropNil + +`func (o *NullableClass) SetDatePropNil(b bool)` + + SetDatePropNil sets the value for DateProp to be an explicit nil + +### UnsetDateProp +`func (o *NullableClass) UnsetDateProp()` + +UnsetDateProp ensures that no value is present for DateProp, not even an explicit nil +### GetDatetimeProp + +`func (o *NullableClass) GetDatetimeProp() time.Time` + +GetDatetimeProp returns the DatetimeProp field if non-nil, zero value otherwise. + +### GetDatetimePropOk + +`func (o *NullableClass) GetDatetimePropOk() (*time.Time, bool)` + +GetDatetimePropOk returns a tuple with the DatetimeProp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDatetimeProp + +`func (o *NullableClass) SetDatetimeProp(v time.Time)` + +SetDatetimeProp sets DatetimeProp field to given value. + +### HasDatetimeProp + +`func (o *NullableClass) HasDatetimeProp() bool` + +HasDatetimeProp returns a boolean if a field has been set. + +### SetDatetimePropNil + +`func (o *NullableClass) SetDatetimePropNil(b bool)` + + SetDatetimePropNil sets the value for DatetimeProp to be an explicit nil + +### UnsetDatetimeProp +`func (o *NullableClass) UnsetDatetimeProp()` + +UnsetDatetimeProp ensures that no value is present for DatetimeProp, not even an explicit nil +### GetArrayNullableProp + +`func (o *NullableClass) GetArrayNullableProp() []map[string]interface{}` + +GetArrayNullableProp returns the ArrayNullableProp field if non-nil, zero value otherwise. + +### GetArrayNullablePropOk + +`func (o *NullableClass) GetArrayNullablePropOk() (*[]map[string]interface{}, bool)` + +GetArrayNullablePropOk returns a tuple with the ArrayNullableProp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayNullableProp + +`func (o *NullableClass) SetArrayNullableProp(v []map[string]interface{})` + +SetArrayNullableProp sets ArrayNullableProp field to given value. + +### HasArrayNullableProp + +`func (o *NullableClass) HasArrayNullableProp() bool` + +HasArrayNullableProp returns a boolean if a field has been set. + +### SetArrayNullablePropNil + +`func (o *NullableClass) SetArrayNullablePropNil(b bool)` + + SetArrayNullablePropNil sets the value for ArrayNullableProp to be an explicit nil + +### UnsetArrayNullableProp +`func (o *NullableClass) UnsetArrayNullableProp()` + +UnsetArrayNullableProp ensures that no value is present for ArrayNullableProp, not even an explicit nil +### GetArrayAndItemsNullableProp + +`func (o *NullableClass) GetArrayAndItemsNullableProp() []map[string]interface{}` + +GetArrayAndItemsNullableProp returns the ArrayAndItemsNullableProp field if non-nil, zero value otherwise. + +### GetArrayAndItemsNullablePropOk + +`func (o *NullableClass) GetArrayAndItemsNullablePropOk() (*[]map[string]interface{}, bool)` + +GetArrayAndItemsNullablePropOk returns a tuple with the ArrayAndItemsNullableProp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayAndItemsNullableProp + +`func (o *NullableClass) SetArrayAndItemsNullableProp(v []map[string]interface{})` + +SetArrayAndItemsNullableProp sets ArrayAndItemsNullableProp field to given value. + +### HasArrayAndItemsNullableProp + +`func (o *NullableClass) HasArrayAndItemsNullableProp() bool` + +HasArrayAndItemsNullableProp returns a boolean if a field has been set. + +### SetArrayAndItemsNullablePropNil + +`func (o *NullableClass) SetArrayAndItemsNullablePropNil(b bool)` + + SetArrayAndItemsNullablePropNil sets the value for ArrayAndItemsNullableProp to be an explicit nil + +### UnsetArrayAndItemsNullableProp +`func (o *NullableClass) UnsetArrayAndItemsNullableProp()` + +UnsetArrayAndItemsNullableProp ensures that no value is present for ArrayAndItemsNullableProp, not even an explicit nil +### GetArrayItemsNullable + +`func (o *NullableClass) GetArrayItemsNullable() []map[string]interface{}` + +GetArrayItemsNullable returns the ArrayItemsNullable field if non-nil, zero value otherwise. + +### GetArrayItemsNullableOk + +`func (o *NullableClass) GetArrayItemsNullableOk() (*[]map[string]interface{}, bool)` + +GetArrayItemsNullableOk returns a tuple with the ArrayItemsNullable field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayItemsNullable + +`func (o *NullableClass) SetArrayItemsNullable(v []map[string]interface{})` + +SetArrayItemsNullable sets ArrayItemsNullable field to given value. + +### HasArrayItemsNullable + +`func (o *NullableClass) HasArrayItemsNullable() bool` + +HasArrayItemsNullable returns a boolean if a field has been set. + +### GetObjectNullableProp + +`func (o *NullableClass) GetObjectNullableProp() map[string]map[string]interface{}` + +GetObjectNullableProp returns the ObjectNullableProp field if non-nil, zero value otherwise. + +### GetObjectNullablePropOk + +`func (o *NullableClass) GetObjectNullablePropOk() (*map[string]map[string]interface{}, bool)` + +GetObjectNullablePropOk returns a tuple with the ObjectNullableProp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetObjectNullableProp + +`func (o *NullableClass) SetObjectNullableProp(v map[string]map[string]interface{})` + +SetObjectNullableProp sets ObjectNullableProp field to given value. + +### HasObjectNullableProp + +`func (o *NullableClass) HasObjectNullableProp() bool` + +HasObjectNullableProp returns a boolean if a field has been set. + +### SetObjectNullablePropNil + +`func (o *NullableClass) SetObjectNullablePropNil(b bool)` + + SetObjectNullablePropNil sets the value for ObjectNullableProp to be an explicit nil + +### UnsetObjectNullableProp +`func (o *NullableClass) UnsetObjectNullableProp()` + +UnsetObjectNullableProp ensures that no value is present for ObjectNullableProp, not even an explicit nil +### GetObjectAndItemsNullableProp + +`func (o *NullableClass) GetObjectAndItemsNullableProp() map[string]map[string]interface{}` + +GetObjectAndItemsNullableProp returns the ObjectAndItemsNullableProp field if non-nil, zero value otherwise. + +### GetObjectAndItemsNullablePropOk + +`func (o *NullableClass) GetObjectAndItemsNullablePropOk() (*map[string]map[string]interface{}, bool)` + +GetObjectAndItemsNullablePropOk returns a tuple with the ObjectAndItemsNullableProp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetObjectAndItemsNullableProp + +`func (o *NullableClass) SetObjectAndItemsNullableProp(v map[string]map[string]interface{})` + +SetObjectAndItemsNullableProp sets ObjectAndItemsNullableProp field to given value. + +### HasObjectAndItemsNullableProp + +`func (o *NullableClass) HasObjectAndItemsNullableProp() bool` + +HasObjectAndItemsNullableProp returns a boolean if a field has been set. + +### SetObjectAndItemsNullablePropNil + +`func (o *NullableClass) SetObjectAndItemsNullablePropNil(b bool)` + + SetObjectAndItemsNullablePropNil sets the value for ObjectAndItemsNullableProp to be an explicit nil + +### UnsetObjectAndItemsNullableProp +`func (o *NullableClass) UnsetObjectAndItemsNullableProp()` + +UnsetObjectAndItemsNullableProp ensures that no value is present for ObjectAndItemsNullableProp, not even an explicit nil +### GetObjectItemsNullable + +`func (o *NullableClass) GetObjectItemsNullable() map[string]map[string]interface{}` + +GetObjectItemsNullable returns the ObjectItemsNullable field if non-nil, zero value otherwise. + +### GetObjectItemsNullableOk + +`func (o *NullableClass) GetObjectItemsNullableOk() (*map[string]map[string]interface{}, bool)` + +GetObjectItemsNullableOk returns a tuple with the ObjectItemsNullable field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetObjectItemsNullable + +`func (o *NullableClass) SetObjectItemsNullable(v map[string]map[string]interface{})` + +SetObjectItemsNullable sets ObjectItemsNullable field to given value. + +### HasObjectItemsNullable + +`func (o *NullableClass) HasObjectItemsNullable() bool` + +HasObjectItemsNullable 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/NumberOnly.md b/samples/openapi3/client/petstore/go/go-petstore/NumberOnly.md new file mode 100644 index 00000000000..81941828b62 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/NumberOnly.md @@ -0,0 +1,56 @@ +# NumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustNumber** | Pointer to **float32** | | [optional] + +## Methods + +### NewNumberOnly + +`func NewNumberOnly() *NumberOnly` + +NewNumberOnly instantiates a new NumberOnly 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 + +### NewNumberOnlyWithDefaults + +`func NewNumberOnlyWithDefaults() *NumberOnly` + +NewNumberOnlyWithDefaults instantiates a new NumberOnly 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 + +### GetJustNumber + +`func (o *NumberOnly) GetJustNumber() float32` + +GetJustNumber returns the JustNumber field if non-nil, zero value otherwise. + +### GetJustNumberOk + +`func (o *NumberOnly) GetJustNumberOk() (*float32, bool)` + +GetJustNumberOk returns a tuple with the JustNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetJustNumber + +`func (o *NumberOnly) SetJustNumber(v float32)` + +SetJustNumber sets JustNumber field to given value. + +### HasJustNumber + +`func (o *NumberOnly) HasJustNumber() bool` + +HasJustNumber 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Order.md b/samples/openapi3/client/petstore/go/go-petstore/Order.md new file mode 100644 index 00000000000..78cace2f229 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Order.md @@ -0,0 +1,186 @@ +# Order + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int64** | | [optional] +**PetId** | Pointer to **int64** | | [optional] +**Quantity** | Pointer to **int32** | | [optional] +**ShipDate** | Pointer to [**time.Time**](time.Time.md) | | [optional] +**Status** | Pointer to **string** | Order Status | [optional] +**Complete** | Pointer to **bool** | | [optional] [default to false] + +## Methods + +### NewOrder + +`func NewOrder() *Order` + +NewOrder instantiates a new Order 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 + +### NewOrderWithDefaults + +`func NewOrderWithDefaults() *Order` + +NewOrderWithDefaults instantiates a new Order 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 *Order) GetId() int64` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Order) 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 *Order) SetId(v int64)` + +SetId sets Id field to given value. + +### HasId + +`func (o *Order) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetPetId + +`func (o *Order) GetPetId() int64` + +GetPetId returns the PetId field if non-nil, zero value otherwise. + +### GetPetIdOk + +`func (o *Order) GetPetIdOk() (*int64, bool)` + +GetPetIdOk returns a tuple with the PetId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPetId + +`func (o *Order) SetPetId(v int64)` + +SetPetId sets PetId field to given value. + +### HasPetId + +`func (o *Order) HasPetId() bool` + +HasPetId returns a boolean if a field has been set. + +### GetQuantity + +`func (o *Order) GetQuantity() int32` + +GetQuantity returns the Quantity field if non-nil, zero value otherwise. + +### GetQuantityOk + +`func (o *Order) GetQuantityOk() (*int32, bool)` + +GetQuantityOk returns a tuple with the Quantity field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetQuantity + +`func (o *Order) SetQuantity(v int32)` + +SetQuantity sets Quantity field to given value. + +### HasQuantity + +`func (o *Order) HasQuantity() bool` + +HasQuantity returns a boolean if a field has been set. + +### GetShipDate + +`func (o *Order) GetShipDate() time.Time` + +GetShipDate returns the ShipDate field if non-nil, zero value otherwise. + +### GetShipDateOk + +`func (o *Order) GetShipDateOk() (*time.Time, bool)` + +GetShipDateOk returns a tuple with the ShipDate field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShipDate + +`func (o *Order) SetShipDate(v time.Time)` + +SetShipDate sets ShipDate field to given value. + +### HasShipDate + +`func (o *Order) HasShipDate() bool` + +HasShipDate returns a boolean if a field has been set. + +### GetStatus + +`func (o *Order) GetStatus() string` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *Order) 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 *Order) SetStatus(v string)` + +SetStatus sets Status field to given value. + +### HasStatus + +`func (o *Order) HasStatus() bool` + +HasStatus returns a boolean if a field has been set. + +### GetComplete + +`func (o *Order) GetComplete() bool` + +GetComplete returns the Complete field if non-nil, zero value otherwise. + +### GetCompleteOk + +`func (o *Order) GetCompleteOk() (*bool, bool)` + +GetCompleteOk returns a tuple with the Complete field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetComplete + +`func (o *Order) SetComplete(v bool)` + +SetComplete sets Complete field to given value. + +### HasComplete + +`func (o *Order) HasComplete() bool` + +HasComplete 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/OuterComposite.md b/samples/openapi3/client/petstore/go/go-petstore/OuterComposite.md new file mode 100644 index 00000000000..1ebf86c0a2e --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/OuterComposite.md @@ -0,0 +1,108 @@ +# OuterComposite + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MyNumber** | Pointer to **float32** | | [optional] +**MyString** | Pointer to **string** | | [optional] +**MyBoolean** | Pointer to **bool** | | [optional] + +## Methods + +### NewOuterComposite + +`func NewOuterComposite() *OuterComposite` + +NewOuterComposite instantiates a new OuterComposite 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 + +### NewOuterCompositeWithDefaults + +`func NewOuterCompositeWithDefaults() *OuterComposite` + +NewOuterCompositeWithDefaults instantiates a new OuterComposite 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 + +### GetMyNumber + +`func (o *OuterComposite) GetMyNumber() float32` + +GetMyNumber returns the MyNumber field if non-nil, zero value otherwise. + +### GetMyNumberOk + +`func (o *OuterComposite) GetMyNumberOk() (*float32, bool)` + +GetMyNumberOk returns a tuple with the MyNumber field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMyNumber + +`func (o *OuterComposite) SetMyNumber(v float32)` + +SetMyNumber sets MyNumber field to given value. + +### HasMyNumber + +`func (o *OuterComposite) HasMyNumber() bool` + +HasMyNumber returns a boolean if a field has been set. + +### GetMyString + +`func (o *OuterComposite) GetMyString() string` + +GetMyString returns the MyString field if non-nil, zero value otherwise. + +### GetMyStringOk + +`func (o *OuterComposite) GetMyStringOk() (*string, bool)` + +GetMyStringOk returns a tuple with the MyString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMyString + +`func (o *OuterComposite) SetMyString(v string)` + +SetMyString sets MyString field to given value. + +### HasMyString + +`func (o *OuterComposite) HasMyString() bool` + +HasMyString returns a boolean if a field has been set. + +### GetMyBoolean + +`func (o *OuterComposite) GetMyBoolean() bool` + +GetMyBoolean returns the MyBoolean field if non-nil, zero value otherwise. + +### GetMyBooleanOk + +`func (o *OuterComposite) GetMyBooleanOk() (*bool, bool)` + +GetMyBooleanOk returns a tuple with the MyBoolean field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMyBoolean + +`func (o *OuterComposite) SetMyBoolean(v bool)` + +SetMyBoolean sets MyBoolean field to given value. + +### HasMyBoolean + +`func (o *OuterComposite) HasMyBoolean() bool` + +HasMyBoolean 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/OuterEnum.md b/samples/openapi3/client/petstore/go/go-petstore/OuterEnum.md new file mode 100644 index 00000000000..13bed2d17fd --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/OuterEnum.md @@ -0,0 +1,11 @@ +# OuterEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/go/go-petstore/OuterEnumDefaultValue.md new file mode 100644 index 00000000000..50f8ab0096c --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/OuterEnumDefaultValue.md @@ -0,0 +1,11 @@ +# OuterEnumDefaultValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/OuterEnumInteger.md b/samples/openapi3/client/petstore/go/go-petstore/OuterEnumInteger.md new file mode 100644 index 00000000000..eb033db7cc5 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/OuterEnumInteger.md @@ -0,0 +1,11 @@ +# OuterEnumInteger + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/go/go-petstore/OuterEnumIntegerDefaultValue.md new file mode 100644 index 00000000000..7a163432954 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,11 @@ +# OuterEnumIntegerDefaultValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Pet.md b/samples/openapi3/client/petstore/go/go-petstore/Pet.md new file mode 100644 index 00000000000..a6eae34657d --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Pet.md @@ -0,0 +1,176 @@ +# Pet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int64** | | [optional] +**Category** | Pointer to [**Category**](Category.md) | | [optional] +**Name** | **string** | | +**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. + +### 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. + +### 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. + + +### 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/PetApi.md b/samples/openapi3/client/petstore/go/go-petstore/PetApi.md new file mode 100644 index 00000000000..6fdd89f81ba --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/PetApi.md @@ -0,0 +1,625 @@ +# \PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AddPet**](PetApi.md#AddPet) | **Post** /pet | Add a new pet to the store +[**DeletePet**](PetApi.md#DeletePet) | **Delete** /pet/{petId} | Deletes a pet +[**FindPetsByStatus**](PetApi.md#FindPetsByStatus) | **Get** /pet/findByStatus | Finds Pets by status +[**FindPetsByTags**](PetApi.md#FindPetsByTags) | **Get** /pet/findByTags | Finds Pets by tags +[**GetPetById**](PetApi.md#GetPetById) | **Get** /pet/{petId} | Find pet by ID +[**UpdatePet**](PetApi.md#UpdatePet) | **Put** /pet | Update an existing pet +[**UpdatePetWithForm**](PetApi.md#UpdatePetWithForm) | **Post** /pet/{petId} | Updates a pet in the store with form data +[**UploadFile**](PetApi.md#UploadFile) | **Post** /pet/{petId}/uploadImage | uploads an image +[**UploadFileWithRequiredFile**](PetApi.md#UploadFileWithRequiredFile) | **Post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + + +## AddPet + +> AddPet(ctx).Pet(pet).Execute() + +Add a new pet to the store + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + pet := openapiclient.Pet{Id: int64(123), Category: openapiclient.Category{Id: int64(123), Name: "Name_example"}, Name: "Name_example", PhotoUrls: []string{"PhotoUrls_example"), Tags: []Tag{openapiclient.Tag{Id: int64(123), Name: "Name_example"}), Status: "Status_example"} // Pet | Pet object that needs to be added to the store + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.AddPet(context.Background(), pet).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.AddPet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiAddPetRequest 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 + + (empty response body) + +### Authorization + +[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +[[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) + + +## DeletePet + +> DeletePet(ctx, petId).ApiKey(apiKey).Execute() + +Deletes a pet + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | Pet id to delete + apiKey := "apiKey_example" // string | (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.DeletePet(context.Background(), petId).ApiKey(apiKey).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.DeletePet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64** | Pet id to delete | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeletePetRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **apiKey** | **string** | | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## FindPetsByStatus + +> []Pet FindPetsByStatus(ctx).Status(status).Execute() + +Finds Pets by status + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + status := []string{"Status_example"} // []string | Status values that need to be considered for filter + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.FindPetsByStatus(context.Background(), status).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.FindPetsByStatus``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FindPetsByStatus`: []Pet + fmt.Fprintf(os.Stdout, "Response from `PetApi.FindPetsByStatus`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFindPetsByStatusRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**[]string**](string.md) | Status values that need to be considered for filter | + +### Return type + +[**[]Pet**](Pet.md) + +### Authorization + +[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, 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) + + +## FindPetsByTags + +> []Pet FindPetsByTags(ctx).Tags(tags).Execute() + +Finds Pets by tags + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + tags := []string{"Inner_example"} // []string | Tags to filter by + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.FindPetsByTags(context.Background(), tags).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.FindPetsByTags``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FindPetsByTags`: []Pet + fmt.Fprintf(os.Stdout, "Response from `PetApi.FindPetsByTags`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFindPetsByTagsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**[]string**](string.md) | Tags to filter by | + +### Return type + +[**[]Pet**](Pet.md) + +### Authorization + +[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, 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) + + +## GetPetById + +> Pet GetPetById(ctx, petId).Execute() + +Find pet by ID + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet to return + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.GetPetById(context.Background(), petId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.GetPetById``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetPetById`: Pet + fmt.Fprintf(os.Stdout, "Response from `PetApi.GetPetById`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64** | ID of pet to return | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetPetByIdRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, 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) + + +## UpdatePet + +> UpdatePet(ctx).Pet(pet).Execute() + +Update an existing pet + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + pet := openapiclient.Pet{Id: int64(123), Category: openapiclient.Category{Id: int64(123), Name: "Name_example"}, Name: "Name_example", PhotoUrls: []string{"PhotoUrls_example"), Tags: []Tag{openapiclient.Tag{Id: int64(123), Name: "Name_example"}), Status: "Status_example"} // Pet | Pet object that needs to be added to the store + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UpdatePet(context.Background(), pet).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UpdatePet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdatePetRequest 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 + + (empty response body) + +### Authorization + +[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +[[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) + + +## UpdatePetWithForm + +> UpdatePetWithForm(ctx, petId).Name(name).Status(status).Execute() + +Updates a pet in the store with form data + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet that needs to be updated + name := "name_example" // string | Updated name of the pet (optional) + status := "status_example" // string | Updated status of the pet (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UpdatePetWithForm(context.Background(), petId).Name(name).Status(status).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UpdatePetWithForm``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64** | ID of pet that needs to be updated | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdatePetWithFormRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **name** | **string** | Updated name of the pet | + **status** | **string** | Updated status of the pet | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +[[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) + + +## UploadFile + +> ApiResponse UploadFile(ctx, petId).AdditionalMetadata(additionalMetadata).File(file).Execute() + +uploads an image + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet to update + additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional) + file := 987 // *os.File | file to upload (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UploadFile(context.Background(), petId).AdditionalMetadata(additionalMetadata).File(file).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UploadFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UploadFile`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `PetApi.UploadFile`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64** | ID of pet to update | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUploadFileRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **additionalMetadata** | **string** | Additional data to pass to server | + **file** | ***os.File** | file to upload | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **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) + + +## UploadFileWithRequiredFile + +> ApiResponse UploadFileWithRequiredFile(ctx, petId).RequiredFile(requiredFile).AdditionalMetadata(additionalMetadata).Execute() + +uploads an image (required) + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet to update + requiredFile := 987 // *os.File | file to upload + additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UploadFileWithRequiredFile(context.Background(), petId, requiredFile).AdditionalMetadata(additionalMetadata).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UploadFileWithRequiredFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UploadFileWithRequiredFile`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `PetApi.UploadFileWithRequiredFile`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64** | ID of pet to update | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUploadFileWithRequiredFileRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **requiredFile** | ***os.File** | file to upload | + **additionalMetadata** | **string** | Additional data to pass to server | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **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) + diff --git a/samples/openapi3/client/petstore/go/go-petstore/ReadOnlyFirst.md b/samples/openapi3/client/petstore/go/go-petstore/ReadOnlyFirst.md new file mode 100644 index 00000000000..2e25d6d230e --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/ReadOnlyFirst.md @@ -0,0 +1,82 @@ +# ReadOnlyFirst + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | Pointer to **string** | | [optional] [readonly] +**Baz** | Pointer to **string** | | [optional] + +## Methods + +### NewReadOnlyFirst + +`func NewReadOnlyFirst() *ReadOnlyFirst` + +NewReadOnlyFirst instantiates a new ReadOnlyFirst 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 + +### NewReadOnlyFirstWithDefaults + +`func NewReadOnlyFirstWithDefaults() *ReadOnlyFirst` + +NewReadOnlyFirstWithDefaults instantiates a new ReadOnlyFirst 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 + +### GetBar + +`func (o *ReadOnlyFirst) GetBar() string` + +GetBar returns the Bar field if non-nil, zero value otherwise. + +### GetBarOk + +`func (o *ReadOnlyFirst) GetBarOk() (*string, bool)` + +GetBarOk returns a tuple with the Bar field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBar + +`func (o *ReadOnlyFirst) SetBar(v string)` + +SetBar sets Bar field to given value. + +### HasBar + +`func (o *ReadOnlyFirst) HasBar() bool` + +HasBar returns a boolean if a field has been set. + +### GetBaz + +`func (o *ReadOnlyFirst) GetBaz() string` + +GetBaz returns the Baz field if non-nil, zero value otherwise. + +### GetBazOk + +`func (o *ReadOnlyFirst) GetBazOk() (*string, bool)` + +GetBazOk returns a tuple with the Baz field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBaz + +`func (o *ReadOnlyFirst) SetBaz(v string)` + +SetBaz sets Baz field to given value. + +### HasBaz + +`func (o *ReadOnlyFirst) HasBaz() bool` + +HasBaz 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Return.md b/samples/openapi3/client/petstore/go/go-petstore/Return.md new file mode 100644 index 00000000000..d6be5a42f31 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Return.md @@ -0,0 +1,56 @@ +# Return + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Return** | Pointer to **int32** | | [optional] + +## Methods + +### NewReturn + +`func NewReturn() *Return` + +NewReturn instantiates a new Return 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 + +### NewReturnWithDefaults + +`func NewReturnWithDefaults() *Return` + +NewReturnWithDefaults instantiates a new Return 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 + +### GetReturn + +`func (o *Return) GetReturn() int32` + +GetReturn returns the Return field if non-nil, zero value otherwise. + +### GetReturnOk + +`func (o *Return) GetReturnOk() (*int32, bool)` + +GetReturnOk returns a tuple with the Return field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetReturn + +`func (o *Return) SetReturn(v int32)` + +SetReturn sets Return field to given value. + +### HasReturn + +`func (o *Return) HasReturn() bool` + +HasReturn 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/SpecialModelName.md b/samples/openapi3/client/petstore/go/go-petstore/SpecialModelName.md new file mode 100644 index 00000000000..3e5a187c1d1 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/SpecialModelName.md @@ -0,0 +1,56 @@ +# SpecialModelName + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SpecialPropertyName** | Pointer to **int64** | | [optional] + +## Methods + +### NewSpecialModelName + +`func NewSpecialModelName() *SpecialModelName` + +NewSpecialModelName instantiates a new SpecialModelName 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 + +### NewSpecialModelNameWithDefaults + +`func NewSpecialModelNameWithDefaults() *SpecialModelName` + +NewSpecialModelNameWithDefaults instantiates a new SpecialModelName 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 + +### GetSpecialPropertyName + +`func (o *SpecialModelName) GetSpecialPropertyName() int64` + +GetSpecialPropertyName returns the SpecialPropertyName field if non-nil, zero value otherwise. + +### GetSpecialPropertyNameOk + +`func (o *SpecialModelName) GetSpecialPropertyNameOk() (*int64, bool)` + +GetSpecialPropertyNameOk returns a tuple with the SpecialPropertyName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSpecialPropertyName + +`func (o *SpecialModelName) SetSpecialPropertyName(v int64)` + +SetSpecialPropertyName sets SpecialPropertyName field to given value. + +### HasSpecialPropertyName + +`func (o *SpecialModelName) HasSpecialPropertyName() bool` + +HasSpecialPropertyName 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/StoreApi.md b/samples/openapi3/client/petstore/go/go-petstore/StoreApi.md new file mode 100644 index 00000000000..80617c8683b --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/StoreApi.md @@ -0,0 +1,275 @@ +# \StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**DeleteOrder**](StoreApi.md#DeleteOrder) | **Delete** /store/order/{order_id} | Delete purchase order by ID +[**GetInventory**](StoreApi.md#GetInventory) | **Get** /store/inventory | Returns pet inventories by status +[**GetOrderById**](StoreApi.md#GetOrderById) | **Get** /store/order/{order_id} | Find purchase order by ID +[**PlaceOrder**](StoreApi.md#PlaceOrder) | **Post** /store/order | Place an order for a pet + + + +## DeleteOrder + +> DeleteOrder(ctx, orderId).Execute() + +Delete purchase order by ID + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + orderId := "orderId_example" // string | ID of the order that needs to be deleted + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.DeleteOrder(context.Background(), orderId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.DeleteOrder``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**orderId** | **string** | ID of the order that needs to be deleted | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteOrderRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## GetInventory + +> map[string]int32 GetInventory(ctx).Execute() + +Returns pet inventories by status + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.GetInventory(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.GetInventory``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetInventory`: map[string]int32 + fmt.Fprintf(os.Stdout, "Response from `StoreApi.GetInventory`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetInventoryRequest struct via the builder pattern + + +### Return type + +**map[string]int32** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetOrderById + +> Order GetOrderById(ctx, orderId).Execute() + +Find purchase order by ID + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + orderId := 987 // int64 | ID of pet that needs to be fetched + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.GetOrderById(context.Background(), orderId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.GetOrderById``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetOrderById`: Order + fmt.Fprintf(os.Stdout, "Response from `StoreApi.GetOrderById`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**orderId** | **int64** | ID of pet that needs to be fetched | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetOrderByIdRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, 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) + + +## PlaceOrder + +> Order PlaceOrder(ctx).Order(order).Execute() + +Place an order for a pet + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + order := openapiclient.Order{Id: int64(123), PetId: int64(123), Quantity: 123, ShipDate: "TODO", Status: "Status_example", Complete: false} // Order | order placed for purchasing the pet + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.PlaceOrder(context.Background(), order).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.PlaceOrder``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `PlaceOrder`: Order + fmt.Fprintf(os.Stdout, "Response from `StoreApi.PlaceOrder`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiPlaceOrderRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**Order**](Order.md) | order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/xml, 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) + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Tag.md b/samples/openapi3/client/petstore/go/go-petstore/Tag.md new file mode 100644 index 00000000000..391be6b4900 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Tag.md @@ -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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/User.md b/samples/openapi3/client/petstore/go/go-petstore/User.md new file mode 100644 index 00000000000..26c9305363e --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/User.md @@ -0,0 +1,372 @@ +# User + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int64** | | [optional] +**Username** | Pointer to **string** | | [optional] +**FirstName** | Pointer to **string** | | [optional] +**LastName** | Pointer to **string** | | [optional] +**Email** | Pointer to **string** | | [optional] +**Password** | Pointer to **string** | | [optional] +**Phone** | Pointer to **string** | | [optional] +**UserStatus** | Pointer to **int32** | User Status | [optional] +**ArbitraryObject** | Pointer to **map[string]interface{}** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] +**ArbitraryNullableObject** | Pointer to **map[string]interface{}** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] +**ArbitraryTypeValue** | Pointer to **interface{}** | test code generation for any type Value can be any type - string, number, boolean, array or object. | [optional] +**ArbitraryNullableTypeValue** | Pointer to **interface{}** | test code generation for any type Value can be any type - string, number, boolean, array, object or the 'null' value. | [optional] + +## Methods + +### NewUser + +`func NewUser() *User` + +NewUser instantiates a new User 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 + +### NewUserWithDefaults + +`func NewUserWithDefaults() *User` + +NewUserWithDefaults instantiates a new User 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 *User) GetId() int64` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *User) 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 *User) SetId(v int64)` + +SetId sets Id field to given value. + +### HasId + +`func (o *User) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetUsername + +`func (o *User) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *User) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *User) SetUsername(v string)` + +SetUsername sets Username field to given value. + +### HasUsername + +`func (o *User) HasUsername() bool` + +HasUsername returns a boolean if a field has been set. + +### GetFirstName + +`func (o *User) GetFirstName() string` + +GetFirstName returns the FirstName field if non-nil, zero value otherwise. + +### GetFirstNameOk + +`func (o *User) GetFirstNameOk() (*string, bool)` + +GetFirstNameOk returns a tuple with the FirstName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFirstName + +`func (o *User) SetFirstName(v string)` + +SetFirstName sets FirstName field to given value. + +### HasFirstName + +`func (o *User) HasFirstName() bool` + +HasFirstName returns a boolean if a field has been set. + +### GetLastName + +`func (o *User) GetLastName() string` + +GetLastName returns the LastName field if non-nil, zero value otherwise. + +### GetLastNameOk + +`func (o *User) GetLastNameOk() (*string, bool)` + +GetLastNameOk returns a tuple with the LastName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastName + +`func (o *User) SetLastName(v string)` + +SetLastName sets LastName field to given value. + +### HasLastName + +`func (o *User) HasLastName() bool` + +HasLastName returns a boolean if a field has been set. + +### GetEmail + +`func (o *User) GetEmail() string` + +GetEmail returns the Email field if non-nil, zero value otherwise. + +### GetEmailOk + +`func (o *User) GetEmailOk() (*string, bool)` + +GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEmail + +`func (o *User) SetEmail(v string)` + +SetEmail sets Email field to given value. + +### HasEmail + +`func (o *User) HasEmail() bool` + +HasEmail returns a boolean if a field has been set. + +### GetPassword + +`func (o *User) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *User) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *User) SetPassword(v string)` + +SetPassword sets Password field to given value. + +### HasPassword + +`func (o *User) HasPassword() bool` + +HasPassword returns a boolean if a field has been set. + +### GetPhone + +`func (o *User) GetPhone() string` + +GetPhone returns the Phone field if non-nil, zero value otherwise. + +### GetPhoneOk + +`func (o *User) GetPhoneOk() (*string, bool)` + +GetPhoneOk returns a tuple with the Phone field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPhone + +`func (o *User) SetPhone(v string)` + +SetPhone sets Phone field to given value. + +### HasPhone + +`func (o *User) HasPhone() bool` + +HasPhone returns a boolean if a field has been set. + +### GetUserStatus + +`func (o *User) GetUserStatus() int32` + +GetUserStatus returns the UserStatus field if non-nil, zero value otherwise. + +### GetUserStatusOk + +`func (o *User) GetUserStatusOk() (*int32, bool)` + +GetUserStatusOk returns a tuple with the UserStatus field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUserStatus + +`func (o *User) SetUserStatus(v int32)` + +SetUserStatus sets UserStatus field to given value. + +### HasUserStatus + +`func (o *User) HasUserStatus() bool` + +HasUserStatus returns a boolean if a field has been set. + +### GetArbitraryObject + +`func (o *User) GetArbitraryObject() map[string]interface{}` + +GetArbitraryObject returns the ArbitraryObject field if non-nil, zero value otherwise. + +### GetArbitraryObjectOk + +`func (o *User) GetArbitraryObjectOk() (*map[string]interface{}, bool)` + +GetArbitraryObjectOk returns a tuple with the ArbitraryObject field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArbitraryObject + +`func (o *User) SetArbitraryObject(v map[string]interface{})` + +SetArbitraryObject sets ArbitraryObject field to given value. + +### HasArbitraryObject + +`func (o *User) HasArbitraryObject() bool` + +HasArbitraryObject returns a boolean if a field has been set. + +### GetArbitraryNullableObject + +`func (o *User) GetArbitraryNullableObject() map[string]interface{}` + +GetArbitraryNullableObject returns the ArbitraryNullableObject field if non-nil, zero value otherwise. + +### GetArbitraryNullableObjectOk + +`func (o *User) GetArbitraryNullableObjectOk() (*map[string]interface{}, bool)` + +GetArbitraryNullableObjectOk returns a tuple with the ArbitraryNullableObject field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArbitraryNullableObject + +`func (o *User) SetArbitraryNullableObject(v map[string]interface{})` + +SetArbitraryNullableObject sets ArbitraryNullableObject field to given value. + +### HasArbitraryNullableObject + +`func (o *User) HasArbitraryNullableObject() bool` + +HasArbitraryNullableObject returns a boolean if a field has been set. + +### SetArbitraryNullableObjectNil + +`func (o *User) SetArbitraryNullableObjectNil(b bool)` + + SetArbitraryNullableObjectNil sets the value for ArbitraryNullableObject to be an explicit nil + +### UnsetArbitraryNullableObject +`func (o *User) UnsetArbitraryNullableObject()` + +UnsetArbitraryNullableObject ensures that no value is present for ArbitraryNullableObject, not even an explicit nil +### GetArbitraryTypeValue + +`func (o *User) GetArbitraryTypeValue() interface{}` + +GetArbitraryTypeValue returns the ArbitraryTypeValue field if non-nil, zero value otherwise. + +### GetArbitraryTypeValueOk + +`func (o *User) GetArbitraryTypeValueOk() (*interface{}, bool)` + +GetArbitraryTypeValueOk returns a tuple with the ArbitraryTypeValue field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArbitraryTypeValue + +`func (o *User) SetArbitraryTypeValue(v interface{})` + +SetArbitraryTypeValue sets ArbitraryTypeValue field to given value. + +### HasArbitraryTypeValue + +`func (o *User) HasArbitraryTypeValue() bool` + +HasArbitraryTypeValue returns a boolean if a field has been set. + +### SetArbitraryTypeValueNil + +`func (o *User) SetArbitraryTypeValueNil(b bool)` + + SetArbitraryTypeValueNil sets the value for ArbitraryTypeValue to be an explicit nil + +### UnsetArbitraryTypeValue +`func (o *User) UnsetArbitraryTypeValue()` + +UnsetArbitraryTypeValue ensures that no value is present for ArbitraryTypeValue, not even an explicit nil +### GetArbitraryNullableTypeValue + +`func (o *User) GetArbitraryNullableTypeValue() interface{}` + +GetArbitraryNullableTypeValue returns the ArbitraryNullableTypeValue field if non-nil, zero value otherwise. + +### GetArbitraryNullableTypeValueOk + +`func (o *User) GetArbitraryNullableTypeValueOk() (*interface{}, bool)` + +GetArbitraryNullableTypeValueOk returns a tuple with the ArbitraryNullableTypeValue field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArbitraryNullableTypeValue + +`func (o *User) SetArbitraryNullableTypeValue(v interface{})` + +SetArbitraryNullableTypeValue sets ArbitraryNullableTypeValue field to given value. + +### HasArbitraryNullableTypeValue + +`func (o *User) HasArbitraryNullableTypeValue() bool` + +HasArbitraryNullableTypeValue returns a boolean if a field has been set. + +### SetArbitraryNullableTypeValueNil + +`func (o *User) SetArbitraryNullableTypeValueNil(b bool)` + + SetArbitraryNullableTypeValueNil sets the value for ArbitraryNullableTypeValue to be an explicit nil + +### UnsetArbitraryNullableTypeValue +`func (o *User) UnsetArbitraryNullableTypeValue()` + +UnsetArbitraryNullableTypeValue ensures that no value is present for ArbitraryNullableTypeValue, 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) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/UserApi.md b/samples/openapi3/client/petstore/go/go-petstore/UserApi.md new file mode 100644 index 00000000000..71205efd786 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/UserApi.md @@ -0,0 +1,533 @@ +# \UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateUser**](UserApi.md#CreateUser) | **Post** /user | Create user +[**CreateUsersWithArrayInput**](UserApi.md#CreateUsersWithArrayInput) | **Post** /user/createWithArray | Creates list of users with given input array +[**CreateUsersWithListInput**](UserApi.md#CreateUsersWithListInput) | **Post** /user/createWithList | Creates list of users with given input array +[**DeleteUser**](UserApi.md#DeleteUser) | **Delete** /user/{username} | Delete user +[**GetUserByName**](UserApi.md#GetUserByName) | **Get** /user/{username} | Get user by user name +[**LoginUser**](UserApi.md#LoginUser) | **Get** /user/login | Logs user into the system +[**LogoutUser**](UserApi.md#LogoutUser) | **Get** /user/logout | Logs out current logged in user session +[**UpdateUser**](UserApi.md#UpdateUser) | **Put** /user/{username} | Updated user + + + +## CreateUser + +> CreateUser(ctx).User(user).Execute() + +Create user + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + user := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: 123, ArbitraryNullableObject: 123, ArbitraryTypeValue: 123, ArbitraryNullableTypeValue: 123} // User | Created user object + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.CreateUser(context.Background(), user).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**User**](User.md) | Created user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[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) + + +## CreateUsersWithArrayInput + +> CreateUsersWithArrayInput(ctx).User(user).Execute() + +Creates list of users with given input array + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + user := []User{openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: 123, ArbitraryNullableObject: 123, ArbitraryTypeValue: 123, ArbitraryNullableTypeValue: 123}} // []User | List of user object + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.CreateUsersWithArrayInput(context.Background(), user).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUsersWithArrayInput``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUsersWithArrayInputRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**[]User**](User.md) | List of user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[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) + + +## CreateUsersWithListInput + +> CreateUsersWithListInput(ctx).User(user).Execute() + +Creates list of users with given input array + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + user := []User{} // []User | List of user object + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.CreateUsersWithListInput(context.Background(), user).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUsersWithListInput``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUsersWithListInputRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**[]User**](User.md) | List of user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[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) + + +## DeleteUser + +> DeleteUser(ctx, username).Execute() + +Delete user + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The name that needs to be deleted + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.DeleteUser(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.DeleteUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | The name that needs to be deleted | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## GetUserByName + +> User GetUserByName(ctx, username).Execute() + +Get user by user name + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The name that needs to be fetched. Use user1 for testing. + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.GetUserByName(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.GetUserByName``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserByName`: User + fmt.Fprintf(os.Stdout, "Response from `UserApi.GetUserByName`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | The name that needs to be fetched. Use user1 for testing. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserByNameRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, 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) + + +## LoginUser + +> string LoginUser(ctx).Username(username).Password(password).Execute() + +Logs user into the system + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The user name for login + password := "password_example" // string | The password for login in clear text + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.LoginUser(context.Background(), username, password).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.LoginUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LoginUser`: string + fmt.Fprintf(os.Stdout, "Response from `UserApi.LoginUser`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiLoginUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string** | The user name for login | + **password** | **string** | The password for login in clear text | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, 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) + + +## LogoutUser + +> LogoutUser(ctx).Execute() + +Logs out current logged in user session + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.LogoutUser(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.LogoutUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiLogoutUserRequest struct via the builder pattern + + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[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) + + +## UpdateUser + +> UpdateUser(ctx, username).User(user).Execute() + +Updated user + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | name that need to be deleted + user := // User | Updated user object + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.UpdateUser(context.Background(), username, user).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.UpdateUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | name that need to be deleted | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **user** | [**User**](User.md) | Updated user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Whale.md b/samples/openapi3/client/petstore/go/go-petstore/Whale.md new file mode 100644 index 00000000000..f4478f61265 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Whale.md @@ -0,0 +1,103 @@ +# Whale + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**HasBaleen** | Pointer to **bool** | | [optional] +**HasTeeth** | Pointer to **bool** | | [optional] +**ClassName** | **string** | | + +## Methods + +### NewWhale + +`func NewWhale(className string, ) *Whale` + +NewWhale instantiates a new Whale 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 + +### NewWhaleWithDefaults + +`func NewWhaleWithDefaults() *Whale` + +NewWhaleWithDefaults instantiates a new Whale 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 + +### GetHasBaleen + +`func (o *Whale) GetHasBaleen() bool` + +GetHasBaleen returns the HasBaleen field if non-nil, zero value otherwise. + +### GetHasBaleenOk + +`func (o *Whale) GetHasBaleenOk() (*bool, bool)` + +GetHasBaleenOk returns a tuple with the HasBaleen field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHasBaleen + +`func (o *Whale) SetHasBaleen(v bool)` + +SetHasBaleen sets HasBaleen field to given value. + +### HasHasBaleen + +`func (o *Whale) HasHasBaleen() bool` + +HasHasBaleen returns a boolean if a field has been set. + +### GetHasTeeth + +`func (o *Whale) GetHasTeeth() bool` + +GetHasTeeth returns the HasTeeth field if non-nil, zero value otherwise. + +### GetHasTeethOk + +`func (o *Whale) GetHasTeethOk() (*bool, bool)` + +GetHasTeethOk returns a tuple with the HasTeeth field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHasTeeth + +`func (o *Whale) SetHasTeeth(v bool)` + +SetHasTeeth sets HasTeeth field to given value. + +### HasHasTeeth + +`func (o *Whale) HasHasTeeth() bool` + +HasHasTeeth returns a boolean if a field has been set. + +### GetClassName + +`func (o *Whale) GetClassName() string` + +GetClassName returns the ClassName field if non-nil, zero value otherwise. + +### GetClassNameOk + +`func (o *Whale) GetClassNameOk() (*string, bool)` + +GetClassNameOk returns a tuple with the ClassName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetClassName + +`func (o *Whale) SetClassName(v string)` + +SetClassName sets ClassName field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/Zebra.md b/samples/openapi3/client/petstore/go/go-petstore/Zebra.md new file mode 100644 index 00000000000..72f9fea8dbc --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/Zebra.md @@ -0,0 +1,77 @@ +# Zebra + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type** | Pointer to **string** | | [optional] +**ClassName** | **string** | | + +## Methods + +### NewZebra + +`func NewZebra(className string, ) *Zebra` + +NewZebra instantiates a new Zebra 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 + +### NewZebraWithDefaults + +`func NewZebraWithDefaults() *Zebra` + +NewZebraWithDefaults instantiates a new Zebra 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 + +### GetType + +`func (o *Zebra) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *Zebra) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *Zebra) SetType(v string)` + +SetType sets Type field to given value. + +### HasType + +`func (o *Zebra) HasType() bool` + +HasType returns a boolean if a field has been set. + +### GetClassName + +`func (o *Zebra) GetClassName() string` + +GetClassName returns the ClassName field if non-nil, zero value otherwise. + +### GetClassNameOk + +`func (o *Zebra) GetClassNameOk() (*string, bool)` + +GetClassNameOk returns a tuple with the ClassName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetClassName + +`func (o *Zebra) SetClassName(v string)` + +SetClassName sets ClassName field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/api_another_fake.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/api_another_fake.go new file mode 100644 index 00000000000..4aed6e7c47c --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/api_another_fake.go @@ -0,0 +1,131 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" +) + +// Linger please +var ( + _ _context.Context +) + +// AnotherFakeApiService AnotherFakeApi service +type AnotherFakeApiService service + +type apiCall123TestSpecialTagsRequest struct { + ctx _context.Context + apiService *AnotherFakeApiService + client *Client +} + +func (r apiCall123TestSpecialTagsRequest) Client(client Client) apiCall123TestSpecialTagsRequest { + r.client = &client + return r +} +/* +Call123TestSpecialTags To test special tags +To test special tags and operation ID starting with number + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiCall123TestSpecialTagsRequest +*/ +func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context) apiCall123TestSpecialTagsRequest { + return apiCall123TestSpecialTagsRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return Client +*/ +func (r apiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Client + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "AnotherFakeApiService.Call123TestSpecialTags") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/another-fake/dummy" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.client == nil { + return localVarReturnValue, nil, reportError("client is required and must be specified") + } + + // 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.client + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/api_default.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/api_default.go new file mode 100644 index 00000000000..85cfd5a1b4e --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/api_default.go @@ -0,0 +1,127 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" +) + +// Linger please +var ( + _ _context.Context +) + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type apiFooGetRequest struct { + ctx _context.Context + apiService *DefaultApiService +} + +/* +FooGet Method for FooGet + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiFooGetRequest +*/ +func (a *DefaultApiService) FooGet(ctx _context.Context) apiFooGetRequest { + return apiFooGetRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return InlineResponseDefault +*/ +func (r apiFooGetRequest) Execute() (InlineResponseDefault, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponseDefault + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.FooGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/foo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v InlineResponseDefault + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/api_fake.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/api_fake.go new file mode 100644 index 00000000000..4743dcc145a --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/api_fake.go @@ -0,0 +1,1690 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "os" + "time" + "reflect" +) + +// Linger please +var ( + _ _context.Context +) + +// FakeApiService FakeApi service +type FakeApiService service + +type apiFakeHealthGetRequest struct { + ctx _context.Context + apiService *FakeApiService +} + +/* +FakeHealthGet Health check endpoint + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiFakeHealthGetRequest +*/ +func (a *FakeApiService) FakeHealthGet(ctx _context.Context) apiFakeHealthGetRequest { + return apiFakeHealthGetRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return HealthCheckResult +*/ +func (r apiFakeHealthGetRequest) Execute() (HealthCheckResult, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue HealthCheckResult + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeHealthGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/health" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiFakeOuterBooleanSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + body *bool +} + +func (r apiFakeOuterBooleanSerializeRequest) Body(body bool) apiFakeOuterBooleanSerializeRequest { + r.body = &body + return r +} +/* +FakeOuterBooleanSerialize Method for FakeOuterBooleanSerialize +Test serialization of outer boolean types + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiFakeOuterBooleanSerializeRequest +*/ +func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context) apiFakeOuterBooleanSerializeRequest { + return apiFakeOuterBooleanSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return bool +*/ +func (r apiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue bool + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterBooleanSerialize") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/outer/boolean" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiFakeOuterCompositeSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + outerComposite *OuterComposite +} + +func (r apiFakeOuterCompositeSerializeRequest) OuterComposite(outerComposite OuterComposite) apiFakeOuterCompositeSerializeRequest { + r.outerComposite = &outerComposite + return r +} +/* +FakeOuterCompositeSerialize Method for FakeOuterCompositeSerialize +Test serialization of object with outer number type + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiFakeOuterCompositeSerializeRequest +*/ +func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context) apiFakeOuterCompositeSerializeRequest { + return apiFakeOuterCompositeSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return OuterComposite +*/ +func (r apiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue OuterComposite + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterCompositeSerialize") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/outer/composite" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.outerComposite + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiFakeOuterNumberSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + body *float32 +} + +func (r apiFakeOuterNumberSerializeRequest) Body(body float32) apiFakeOuterNumberSerializeRequest { + r.body = &body + return r +} +/* +FakeOuterNumberSerialize Method for FakeOuterNumberSerialize +Test serialization of outer number types + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiFakeOuterNumberSerializeRequest +*/ +func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context) apiFakeOuterNumberSerializeRequest { + return apiFakeOuterNumberSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return float32 +*/ +func (r apiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue float32 + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterNumberSerialize") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/outer/number" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiFakeOuterStringSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + body *string +} + +func (r apiFakeOuterStringSerializeRequest) Body(body string) apiFakeOuterStringSerializeRequest { + r.body = &body + return r +} +/* +FakeOuterStringSerialize Method for FakeOuterStringSerialize +Test serialization of outer string types + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiFakeOuterStringSerializeRequest +*/ +func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context) apiFakeOuterStringSerializeRequest { + return apiFakeOuterStringSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return string +*/ +func (r apiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue string + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterStringSerialize") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/outer/string" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiTestBodyWithFileSchemaRequest struct { + ctx _context.Context + apiService *FakeApiService + fileSchemaTestClass *FileSchemaTestClass +} + +func (r apiTestBodyWithFileSchemaRequest) FileSchemaTestClass(fileSchemaTestClass FileSchemaTestClass) apiTestBodyWithFileSchemaRequest { + r.fileSchemaTestClass = &fileSchemaTestClass + return r +} +/* +TestBodyWithFileSchema Method for TestBodyWithFileSchema +For this test, the body for this request much reference a schema named `File`. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestBodyWithFileSchemaRequest +*/ +func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context) apiTestBodyWithFileSchemaRequest { + return apiTestBodyWithFileSchemaRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestBodyWithFileSchemaRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithFileSchema") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/body-with-file-schema" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.fileSchemaTestClass == nil { + return nil, reportError("fileSchemaTestClass is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.fileSchemaTestClass + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiTestBodyWithQueryParamsRequest struct { + ctx _context.Context + apiService *FakeApiService + query *string + user *User +} + +func (r apiTestBodyWithQueryParamsRequest) Query(query string) apiTestBodyWithQueryParamsRequest { + r.query = &query + return r +} +func (r apiTestBodyWithQueryParamsRequest) User(user User) apiTestBodyWithQueryParamsRequest { + r.user = &user + return r +} +/* +TestBodyWithQueryParams Method for TestBodyWithQueryParams + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestBodyWithQueryParamsRequest +*/ +func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context) apiTestBodyWithQueryParamsRequest { + return apiTestBodyWithQueryParamsRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestBodyWithQueryParamsRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithQueryParams") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/body-with-query-params" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.query == nil { + return nil, reportError("query is required and must be specified") + } + if r.user == nil { + return nil, reportError("user is required and must be specified") + } + + localVarQueryParams.Add("query", parameterToString(*r.query, "")) + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.user + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiTestClientModelRequest struct { + ctx _context.Context + apiService *FakeApiService + client *Client +} + +func (r apiTestClientModelRequest) Client(client Client) apiTestClientModelRequest { + r.client = &client + return r +} +/* +TestClientModel To test \"client\" model +To test "client" model + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestClientModelRequest +*/ +func (a *FakeApiService) TestClientModel(ctx _context.Context) apiTestClientModelRequest { + return apiTestClientModelRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return Client +*/ +func (r apiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Client + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestClientModel") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.client == nil { + return localVarReturnValue, nil, reportError("client is required and must be specified") + } + + // 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.client + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiTestEndpointParametersRequest struct { + ctx _context.Context + apiService *FakeApiService + number *float32 + double *float64 + patternWithoutDelimiter *string + byte_ *string + integer *int32 + int32_ *int32 + int64_ *int64 + float *float32 + string_ *string + binary **os.File + date *string + dateTime *time.Time + password *string + callback *string +} + +func (r apiTestEndpointParametersRequest) Number(number float32) apiTestEndpointParametersRequest { + r.number = &number + return r +} +func (r apiTestEndpointParametersRequest) Double(double float64) apiTestEndpointParametersRequest { + r.double = &double + return r +} +func (r apiTestEndpointParametersRequest) PatternWithoutDelimiter(patternWithoutDelimiter string) apiTestEndpointParametersRequest { + r.patternWithoutDelimiter = &patternWithoutDelimiter + return r +} +func (r apiTestEndpointParametersRequest) Byte_(byte_ string) apiTestEndpointParametersRequest { + r.byte_ = &byte_ + return r +} +func (r apiTestEndpointParametersRequest) Integer(integer int32) apiTestEndpointParametersRequest { + r.integer = &integer + return r +} +func (r apiTestEndpointParametersRequest) Int32_(int32_ int32) apiTestEndpointParametersRequest { + r.int32_ = &int32_ + return r +} +func (r apiTestEndpointParametersRequest) Int64_(int64_ int64) apiTestEndpointParametersRequest { + r.int64_ = &int64_ + return r +} +func (r apiTestEndpointParametersRequest) Float(float float32) apiTestEndpointParametersRequest { + r.float = &float + return r +} +func (r apiTestEndpointParametersRequest) String_(string_ string) apiTestEndpointParametersRequest { + r.string_ = &string_ + return r +} +func (r apiTestEndpointParametersRequest) Binary(binary *os.File) apiTestEndpointParametersRequest { + r.binary = &binary + return r +} +func (r apiTestEndpointParametersRequest) Date(date string) apiTestEndpointParametersRequest { + r.date = &date + return r +} +func (r apiTestEndpointParametersRequest) DateTime(dateTime time.Time) apiTestEndpointParametersRequest { + r.dateTime = &dateTime + return r +} +func (r apiTestEndpointParametersRequest) Password(password string) apiTestEndpointParametersRequest { + r.password = &password + return r +} +func (r apiTestEndpointParametersRequest) Callback(callback string) apiTestEndpointParametersRequest { + r.callback = &callback + return r +} +/* +TestEndpointParameters Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ +Fake endpoint for testing various parameters +å‡ç«¯é»ž +å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ +가짜 엔드 í¬ì¸íЏ + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestEndpointParametersRequest +*/ +func (a *FakeApiService) TestEndpointParameters(ctx _context.Context) apiTestEndpointParametersRequest { + return apiTestEndpointParametersRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestEndpointParametersRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEndpointParameters") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.number == nil { + return nil, reportError("number is required and must be specified") + } + if *r.number < 32.1 { + return nil, reportError("number must be greater than 32.1") + } + if *r.number > 543.2 { + return nil, reportError("number must be less than 543.2") + } + if r.double == nil { + return nil, reportError("double is required and must be specified") + } + if *r.double < 67.8 { + return nil, reportError("double must be greater than 67.8") + } + if *r.double > 123.4 { + return nil, reportError("double must be less than 123.4") + } + if r.patternWithoutDelimiter == nil { + return nil, reportError("patternWithoutDelimiter is required and must be specified") + } + if r.byte_ == nil { + return nil, reportError("byte_ is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.integer != nil { + localVarFormParams.Add("integer", parameterToString(*r.integer, "")) + } + if r.int32_ != nil { + localVarFormParams.Add("int32", parameterToString(*r.int32_, "")) + } + if r.int64_ != nil { + localVarFormParams.Add("int64", parameterToString(*r.int64_, "")) + } + localVarFormParams.Add("number", parameterToString(*r.number, "")) + if r.float != nil { + localVarFormParams.Add("float", parameterToString(*r.float, "")) + } + localVarFormParams.Add("double", parameterToString(*r.double, "")) + if r.string_ != nil { + localVarFormParams.Add("string", parameterToString(*r.string_, "")) + } + localVarFormParams.Add("pattern_without_delimiter", parameterToString(*r.patternWithoutDelimiter, "")) + localVarFormParams.Add("byte", parameterToString(*r.byte_, "")) + localVarFormFileName = "binary" + var localVarFile *os.File + if r.binary != nil { + localVarFile = *r.binary + } + if localVarFile != nil { + fbs, _ := _ioutil.ReadAll(localVarFile) + localVarFileBytes = fbs + localVarFileName = localVarFile.Name() + localVarFile.Close() + } + if r.date != nil { + localVarFormParams.Add("date", parameterToString(*r.date, "")) + } + if r.dateTime != nil { + localVarFormParams.Add("dateTime", parameterToString(*r.dateTime, "")) + } + if r.password != nil { + localVarFormParams.Add("password", parameterToString(*r.password, "")) + } + if r.callback != nil { + localVarFormParams.Add("callback", parameterToString(*r.callback, "")) + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiTestEnumParametersRequest struct { + ctx _context.Context + apiService *FakeApiService + enumHeaderStringArray *[]string + enumHeaderString *string + enumQueryStringArray *[]string + enumQueryString *string + enumQueryInteger *int32 + enumQueryDouble *float64 + enumFormStringArray *[]string + enumFormString *string +} + +func (r apiTestEnumParametersRequest) EnumHeaderStringArray(enumHeaderStringArray []string) apiTestEnumParametersRequest { + r.enumHeaderStringArray = &enumHeaderStringArray + return r +} +func (r apiTestEnumParametersRequest) EnumHeaderString(enumHeaderString string) apiTestEnumParametersRequest { + r.enumHeaderString = &enumHeaderString + return r +} +func (r apiTestEnumParametersRequest) EnumQueryStringArray(enumQueryStringArray []string) apiTestEnumParametersRequest { + r.enumQueryStringArray = &enumQueryStringArray + return r +} +func (r apiTestEnumParametersRequest) EnumQueryString(enumQueryString string) apiTestEnumParametersRequest { + r.enumQueryString = &enumQueryString + return r +} +func (r apiTestEnumParametersRequest) EnumQueryInteger(enumQueryInteger int32) apiTestEnumParametersRequest { + r.enumQueryInteger = &enumQueryInteger + return r +} +func (r apiTestEnumParametersRequest) EnumQueryDouble(enumQueryDouble float64) apiTestEnumParametersRequest { + r.enumQueryDouble = &enumQueryDouble + return r +} +func (r apiTestEnumParametersRequest) EnumFormStringArray(enumFormStringArray []string) apiTestEnumParametersRequest { + r.enumFormStringArray = &enumFormStringArray + return r +} +func (r apiTestEnumParametersRequest) EnumFormString(enumFormString string) apiTestEnumParametersRequest { + r.enumFormString = &enumFormString + return r +} +/* +TestEnumParameters To test enum parameters +To test enum parameters + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestEnumParametersRequest +*/ +func (a *FakeApiService) TestEnumParameters(ctx _context.Context) apiTestEnumParametersRequest { + return apiTestEnumParametersRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestEnumParametersRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEnumParameters") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.enumQueryStringArray != nil { + t := *r.enumQueryStringArray + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("enum_query_string_array", parameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("enum_query_string_array", parameterToString(t, "multi")) + } + } + if r.enumQueryString != nil { + localVarQueryParams.Add("enum_query_string", parameterToString(*r.enumQueryString, "")) + } + if r.enumQueryInteger != nil { + localVarQueryParams.Add("enum_query_integer", parameterToString(*r.enumQueryInteger, "")) + } + if r.enumQueryDouble != nil { + localVarQueryParams.Add("enum_query_double", parameterToString(*r.enumQueryDouble, "")) + } + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.enumHeaderStringArray != nil { + localVarHeaderParams["enum_header_string_array"] = parameterToString(*r.enumHeaderStringArray, "csv") + } + if r.enumHeaderString != nil { + localVarHeaderParams["enum_header_string"] = parameterToString(*r.enumHeaderString, "") + } + if r.enumFormStringArray != nil { + localVarFormParams.Add("enum_form_string_array", parameterToString(*r.enumFormStringArray, "csv")) + } + if r.enumFormString != nil { + localVarFormParams.Add("enum_form_string", parameterToString(*r.enumFormString, "")) + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiTestGroupParametersRequest struct { + ctx _context.Context + apiService *FakeApiService + requiredStringGroup *int32 + requiredBooleanGroup *bool + requiredInt64Group *int64 + stringGroup *int32 + booleanGroup *bool + int64Group *int64 +} + +func (r apiTestGroupParametersRequest) RequiredStringGroup(requiredStringGroup int32) apiTestGroupParametersRequest { + r.requiredStringGroup = &requiredStringGroup + return r +} +func (r apiTestGroupParametersRequest) RequiredBooleanGroup(requiredBooleanGroup bool) apiTestGroupParametersRequest { + r.requiredBooleanGroup = &requiredBooleanGroup + return r +} +func (r apiTestGroupParametersRequest) RequiredInt64Group(requiredInt64Group int64) apiTestGroupParametersRequest { + r.requiredInt64Group = &requiredInt64Group + return r +} +func (r apiTestGroupParametersRequest) StringGroup(stringGroup int32) apiTestGroupParametersRequest { + r.stringGroup = &stringGroup + return r +} +func (r apiTestGroupParametersRequest) BooleanGroup(booleanGroup bool) apiTestGroupParametersRequest { + r.booleanGroup = &booleanGroup + return r +} +func (r apiTestGroupParametersRequest) Int64Group(int64Group int64) apiTestGroupParametersRequest { + r.int64Group = &int64Group + return r +} +/* +TestGroupParameters Fake endpoint to test group parameters (optional) +Fake endpoint to test group parameters (optional) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestGroupParametersRequest +*/ +func (a *FakeApiService) TestGroupParameters(ctx _context.Context) apiTestGroupParametersRequest { + return apiTestGroupParametersRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestGroupParametersRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestGroupParameters") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.requiredStringGroup == nil { + return nil, reportError("requiredStringGroup is required and must be specified") + } + if r.requiredBooleanGroup == nil { + return nil, reportError("requiredBooleanGroup is required and must be specified") + } + if r.requiredInt64Group == nil { + return nil, reportError("requiredInt64Group is required and must be specified") + } + + localVarQueryParams.Add("required_string_group", parameterToString(*r.requiredStringGroup, "")) + localVarQueryParams.Add("required_int64_group", parameterToString(*r.requiredInt64Group, "")) + if r.stringGroup != nil { + localVarQueryParams.Add("string_group", parameterToString(*r.stringGroup, "")) + } + if r.int64Group != nil { + localVarQueryParams.Add("int64_group", parameterToString(*r.int64Group, "")) + } + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + localVarHeaderParams["required_boolean_group"] = parameterToString(*r.requiredBooleanGroup, "") + if r.booleanGroup != nil { + localVarHeaderParams["boolean_group"] = parameterToString(*r.booleanGroup, "") + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiTestInlineAdditionalPropertiesRequest struct { + ctx _context.Context + apiService *FakeApiService + requestBody *map[string]string +} + +func (r apiTestInlineAdditionalPropertiesRequest) RequestBody(requestBody map[string]string) apiTestInlineAdditionalPropertiesRequest { + r.requestBody = &requestBody + return r +} +/* +TestInlineAdditionalProperties test inline additionalProperties + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestInlineAdditionalPropertiesRequest +*/ +func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context) apiTestInlineAdditionalPropertiesRequest { + return apiTestInlineAdditionalPropertiesRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestInlineAdditionalPropertiesRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestInlineAdditionalProperties") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/inline-additionalProperties" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.requestBody == nil { + return nil, reportError("requestBody is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.requestBody + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiTestJsonFormDataRequest struct { + ctx _context.Context + apiService *FakeApiService + param *string + param2 *string +} + +func (r apiTestJsonFormDataRequest) Param(param string) apiTestJsonFormDataRequest { + r.param = ¶m + return r +} +func (r apiTestJsonFormDataRequest) Param2(param2 string) apiTestJsonFormDataRequest { + r.param2 = ¶m2 + return r +} +/* +TestJsonFormData test json serialization of form data + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestJsonFormDataRequest +*/ +func (a *FakeApiService) TestJsonFormData(ctx _context.Context) apiTestJsonFormDataRequest { + return apiTestJsonFormDataRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestJsonFormDataRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestJsonFormData") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/jsonFormData" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.param == nil { + return nil, reportError("param is required and must be specified") + } + if r.param2 == nil { + return nil, reportError("param2 is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + localVarFormParams.Add("param", parameterToString(*r.param, "")) + localVarFormParams.Add("param2", parameterToString(*r.param2, "")) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiTestQueryParameterCollectionFormatRequest struct { + ctx _context.Context + apiService *FakeApiService + pipe *[]string + ioutil *[]string + http *[]string + url *[]string + context *[]string +} + +func (r apiTestQueryParameterCollectionFormatRequest) Pipe(pipe []string) apiTestQueryParameterCollectionFormatRequest { + r.pipe = &pipe + return r +} +func (r apiTestQueryParameterCollectionFormatRequest) Ioutil(ioutil []string) apiTestQueryParameterCollectionFormatRequest { + r.ioutil = &ioutil + return r +} +func (r apiTestQueryParameterCollectionFormatRequest) Http(http []string) apiTestQueryParameterCollectionFormatRequest { + r.http = &http + return r +} +func (r apiTestQueryParameterCollectionFormatRequest) Url(url []string) apiTestQueryParameterCollectionFormatRequest { + r.url = &url + return r +} +func (r apiTestQueryParameterCollectionFormatRequest) Context(context []string) apiTestQueryParameterCollectionFormatRequest { + r.context = &context + return r +} +/* +TestQueryParameterCollectionFormat Method for TestQueryParameterCollectionFormat +To test the collection format in query parameters + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestQueryParameterCollectionFormatRequest +*/ +func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context) apiTestQueryParameterCollectionFormatRequest { + return apiTestQueryParameterCollectionFormatRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiTestQueryParameterCollectionFormatRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestQueryParameterCollectionFormat") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/test-query-paramters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pipe == nil { + return nil, reportError("pipe is required and must be specified") + } + if r.ioutil == nil { + return nil, reportError("ioutil is required and must be specified") + } + if r.http == nil { + return nil, reportError("http is required and must be specified") + } + if r.url == nil { + return nil, reportError("url is required and must be specified") + } + if r.context == nil { + return nil, reportError("context is required and must be specified") + } + + { + t := *r.pipe + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("pipe", parameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("pipe", parameterToString(t, "multi")) + } + } + localVarQueryParams.Add("ioutil", parameterToString(*r.ioutil, "csv")) + localVarQueryParams.Add("http", parameterToString(*r.http, "ssv")) + localVarQueryParams.Add("url", parameterToString(*r.url, "csv")) + { + t := *r.context + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("context", parameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("context", parameterToString(t, "multi")) + } + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/api_fake_classname_tags123.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/api_fake_classname_tags123.go new file mode 100644 index 00000000000..8efc1bb8e66 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/api_fake_classname_tags123.go @@ -0,0 +1,145 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" +) + +// Linger please +var ( + _ _context.Context +) + +// FakeClassnameTags123ApiService FakeClassnameTags123Api service +type FakeClassnameTags123ApiService service + +type apiTestClassnameRequest struct { + ctx _context.Context + apiService *FakeClassnameTags123ApiService + client *Client +} + +func (r apiTestClassnameRequest) Client(client Client) apiTestClassnameRequest { + r.client = &client + return r +} +/* +TestClassname To test class name in snake case +To test class name in snake case + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiTestClassnameRequest +*/ +func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context) apiTestClassnameRequest { + return apiTestClassnameRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return Client +*/ +func (r apiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Client + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeClassnameTags123ApiService.TestClassname") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake_classname_test" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.client == nil { + return localVarReturnValue, nil, reportError("client is required and must be specified") + } + + // 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.client + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["api_key_query"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarQueryParams.Add("api_key_query", key) + } + } + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/api_pet.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/api_pet.go new file mode 100644 index 00000000000..318ee2f6ea2 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/api_pet.go @@ -0,0 +1,977 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + "os" +) + +// Linger please +var ( + _ _context.Context +) + +// PetApiService PetApi service +type PetApiService service + +type apiAddPetRequest struct { + ctx _context.Context + apiService *PetApiService + pet *Pet +} + +func (r apiAddPetRequest) Pet(pet Pet) apiAddPetRequest { + r.pet = &pet + return r +} +/* +AddPet Add a new pet to the store + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiAddPetRequest +*/ +func (a *PetApiService) AddPet(ctx _context.Context) apiAddPetRequest { + return apiAddPetRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiAddPetRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.AddPet") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pet == nil { + return nil, reportError("pet is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json", "application/xml"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.pet + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiDeletePetRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + apiKey *string +} + +func (r apiDeletePetRequest) ApiKey(apiKey string) apiDeletePetRequest { + r.apiKey = &apiKey + return r +} +/* +DeletePet Deletes a pet + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId Pet id to delete +@return apiDeletePetRequest +*/ +func (a *PetApiService) DeletePet(ctx _context.Context, petId int64) apiDeletePetRequest { + return apiDeletePetRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request +*/ +func (r apiDeletePetRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.DeletePet") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet/{petId}" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.PathEscape(parameterToString(r.petId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.apiKey != nil { + localVarHeaderParams["api_key"] = parameterToString(*r.apiKey, "") + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiFindPetsByStatusRequest struct { + ctx _context.Context + apiService *PetApiService + status *[]string +} + +func (r apiFindPetsByStatusRequest) Status(status []string) apiFindPetsByStatusRequest { + r.status = &status + return r +} +/* +FindPetsByStatus Finds Pets by status +Multiple status values can be provided with comma separated strings + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiFindPetsByStatusRequest +*/ +func (a *PetApiService) FindPetsByStatus(ctx _context.Context) apiFindPetsByStatusRequest { + return apiFindPetsByStatusRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return []Pet +*/ +func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []Pet + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByStatus") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet/findByStatus" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.status == nil { + return localVarReturnValue, nil, reportError("status is required and must be specified") + } + + localVarQueryParams.Add("status", parameterToString(*r.status, "csv")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/xml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiFindPetsByTagsRequest struct { + ctx _context.Context + apiService *PetApiService + tags *[]string +} + +func (r apiFindPetsByTagsRequest) Tags(tags []string) apiFindPetsByTagsRequest { + r.tags = &tags + return r +} +/* +FindPetsByTags Finds Pets by tags +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiFindPetsByTagsRequest +*/ +func (a *PetApiService) FindPetsByTags(ctx _context.Context) apiFindPetsByTagsRequest { + return apiFindPetsByTagsRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return []Pet +*/ +func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []Pet + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByTags") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet/findByTags" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.tags == nil { + return localVarReturnValue, nil, reportError("tags is required and must be specified") + } + + localVarQueryParams.Add("tags", parameterToString(*r.tags, "csv")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/xml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiGetPetByIdRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 +} + +/* +GetPetById Find pet by ID +Returns a single pet + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId ID of pet to return +@return apiGetPetByIdRequest +*/ +func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) apiGetPetByIdRequest { + return apiGetPetByIdRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request +@return Pet +*/ +func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Pet + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.GetPetById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet/{petId}" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.PathEscape(parameterToString(r.petId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"application/xml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["api_key"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["api_key"] = key + } + } + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiUpdatePetRequest struct { + ctx _context.Context + apiService *PetApiService + pet *Pet +} + +func (r apiUpdatePetRequest) Pet(pet Pet) apiUpdatePetRequest { + r.pet = &pet + return r +} +/* +UpdatePet Update an existing pet + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiUpdatePetRequest +*/ +func (a *PetApiService) UpdatePet(ctx _context.Context) apiUpdatePetRequest { + return apiUpdatePetRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiUpdatePetRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePet") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pet == nil { + return nil, reportError("pet is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json", "application/xml"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.pet + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiUpdatePetWithFormRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + name *string + status *string +} + +func (r apiUpdatePetWithFormRequest) Name(name string) apiUpdatePetWithFormRequest { + r.name = &name + return r +} +func (r apiUpdatePetWithFormRequest) Status(status string) apiUpdatePetWithFormRequest { + r.status = &status + return r +} +/* +UpdatePetWithForm Updates a pet in the store with form data + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId ID of pet that needs to be updated +@return apiUpdatePetWithFormRequest +*/ +func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64) apiUpdatePetWithFormRequest { + return apiUpdatePetWithFormRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request +*/ +func (r apiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePetWithForm") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet/{petId}" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.PathEscape(parameterToString(r.petId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.name != nil { + localVarFormParams.Add("name", parameterToString(*r.name, "")) + } + if r.status != nil { + localVarFormParams.Add("status", parameterToString(*r.status, "")) + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiUploadFileRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + additionalMetadata *string + file **os.File +} + +func (r apiUploadFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileRequest { + r.additionalMetadata = &additionalMetadata + return r +} +func (r apiUploadFileRequest) File(file *os.File) apiUploadFileRequest { + r.file = &file + return r +} +/* +UploadFile uploads an image + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId ID of pet to update +@return apiUploadFileRequest +*/ +func (a *PetApiService) UploadFile(ctx _context.Context, petId int64) apiUploadFileRequest { + return apiUploadFileRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request +@return ApiResponse +*/ +func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ApiResponse + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFile") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/pet/{petId}/uploadImage" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.PathEscape(parameterToString(r.petId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // 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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.additionalMetadata != nil { + localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, "")) + } + localVarFormFileName = "file" + var localVarFile *os.File + if r.file != nil { + localVarFile = *r.file + } + if localVarFile != nil { + fbs, _ := _ioutil.ReadAll(localVarFile) + localVarFileBytes = fbs + localVarFileName = localVarFile.Name() + localVarFile.Close() + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiUploadFileWithRequiredFileRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + requiredFile **os.File + additionalMetadata *string +} + +func (r apiUploadFileWithRequiredFileRequest) RequiredFile(requiredFile *os.File) apiUploadFileWithRequiredFileRequest { + r.requiredFile = &requiredFile + return r +} +func (r apiUploadFileWithRequiredFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileWithRequiredFileRequest { + r.additionalMetadata = &additionalMetadata + return r +} +/* +UploadFileWithRequiredFile uploads an image (required) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId ID of pet to update +@return apiUploadFileWithRequiredFileRequest +*/ +func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64) apiUploadFileWithRequiredFileRequest { + return apiUploadFileWithRequiredFileRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request +@return ApiResponse +*/ +func (r apiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ApiResponse + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFileWithRequiredFile") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/{petId}/uploadImageWithRequiredFile" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.PathEscape(parameterToString(r.petId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.requiredFile == nil { + return localVarReturnValue, nil, reportError("requiredFile 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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.additionalMetadata != nil { + localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, "")) + } + localVarFormFileName = "requiredFile" + localVarFile := *r.requiredFile + if localVarFile != nil { + fbs, _ := _ioutil.ReadAll(localVarFile) + localVarFileBytes = fbs + localVarFileName = localVarFile.Name() + localVarFile.Close() + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/api_store.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/api_store.go new file mode 100644 index 00000000000..1857755301c --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/api_store.go @@ -0,0 +1,433 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// StoreApiService StoreApi service +type StoreApiService service + +type apiDeleteOrderRequest struct { + ctx _context.Context + apiService *StoreApiService + orderId string +} + +/* +DeleteOrder Delete purchase order by ID +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param orderId ID of the order that needs to be deleted +@return apiDeleteOrderRequest +*/ +func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) apiDeleteOrderRequest { + return apiDeleteOrderRequest{ + apiService: a, + ctx: ctx, + orderId: orderId, + } +} + +/* +Execute executes the request +*/ +func (r apiDeleteOrderRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.DeleteOrder") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/store/order/{order_id}" + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.PathEscape(parameterToString(r.orderId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiGetInventoryRequest struct { + ctx _context.Context + apiService *StoreApiService +} + +/* +GetInventory Returns pet inventories by status +Returns a map of status codes to quantities + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiGetInventoryRequest +*/ +func (a *StoreApiService) GetInventory(ctx _context.Context) apiGetInventoryRequest { + return apiGetInventoryRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return map[string]int32 +*/ +func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]int32 + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetInventory") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/store/inventory" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["api_key"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["api_key"] = key + } + } + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiGetOrderByIdRequest struct { + ctx _context.Context + apiService *StoreApiService + orderId int64 +} + +/* +GetOrderById Find purchase order by ID +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param orderId ID of pet that needs to be fetched +@return apiGetOrderByIdRequest +*/ +func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) apiGetOrderByIdRequest { + return apiGetOrderByIdRequest{ + apiService: a, + ctx: ctx, + orderId: orderId, + } +} + +/* +Execute executes the request +@return Order +*/ +func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Order + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetOrderById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/store/order/{order_id}" + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.PathEscape(parameterToString(r.orderId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.orderId < 1 { + return localVarReturnValue, nil, reportError("orderId must be greater than 1") + } + if r.orderId > 5 { + return localVarReturnValue, nil, reportError("orderId must be less than 5") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/xml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiPlaceOrderRequest struct { + ctx _context.Context + apiService *StoreApiService + order *Order +} + +func (r apiPlaceOrderRequest) Order(order Order) apiPlaceOrderRequest { + r.order = &order + return r +} +/* +PlaceOrder Place an order for a pet + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiPlaceOrderRequest +*/ +func (a *StoreApiService) PlaceOrder(ctx _context.Context) apiPlaceOrderRequest { + return apiPlaceOrderRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return Order +*/ +func (r apiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Order + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.PlaceOrder") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/store/order" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.order == nil { + return localVarReturnValue, nil, reportError("order is required and must be specified") + } + + // 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/xml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.order + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/api_user.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/api_user.go new file mode 100644 index 00000000000..4a8a6ac10c5 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/api_user.go @@ -0,0 +1,786 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// UserApiService UserApi service +type UserApiService service + +type apiCreateUserRequest struct { + ctx _context.Context + apiService *UserApiService + user *User +} + +func (r apiCreateUserRequest) User(user User) apiCreateUserRequest { + r.user = &user + return r +} +/* +CreateUser Create user +This can only be done by the logged in user. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiCreateUserRequest +*/ +func (a *UserApiService) CreateUser(ctx _context.Context) apiCreateUserRequest { + return apiCreateUserRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiCreateUserRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUser") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.user == nil { + return nil, reportError("user is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.user + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiCreateUsersWithArrayInputRequest struct { + ctx _context.Context + apiService *UserApiService + user *[]User +} + +func (r apiCreateUsersWithArrayInputRequest) User(user []User) apiCreateUsersWithArrayInputRequest { + r.user = &user + return r +} +/* +CreateUsersWithArrayInput Creates list of users with given input array + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiCreateUsersWithArrayInputRequest +*/ +func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context) apiCreateUsersWithArrayInputRequest { + return apiCreateUsersWithArrayInputRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithArrayInput") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/createWithArray" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.user == nil { + return nil, reportError("user is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.user + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiCreateUsersWithListInputRequest struct { + ctx _context.Context + apiService *UserApiService + user *[]User +} + +func (r apiCreateUsersWithListInputRequest) User(user []User) apiCreateUsersWithListInputRequest { + r.user = &user + return r +} +/* +CreateUsersWithListInput Creates list of users with given input array + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiCreateUsersWithListInputRequest +*/ +func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context) apiCreateUsersWithListInputRequest { + return apiCreateUsersWithListInputRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithListInput") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/createWithList" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.user == nil { + return nil, reportError("user is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.user + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiDeleteUserRequest struct { + ctx _context.Context + apiService *UserApiService + username string +} + +/* +DeleteUser Delete user +This can only be done by the logged in user. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param username The name that needs to be deleted +@return apiDeleteUserRequest +*/ +func (a *UserApiService) DeleteUser(ctx _context.Context, username string) apiDeleteUserRequest { + return apiDeleteUserRequest{ + apiService: a, + ctx: ctx, + username: username, + } +} + +/* +Execute executes the request +*/ +func (r apiDeleteUserRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.DeleteUser") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.PathEscape(parameterToString(r.username, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiGetUserByNameRequest struct { + ctx _context.Context + apiService *UserApiService + username string +} + +/* +GetUserByName Get user by user name + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param username The name that needs to be fetched. Use user1 for testing. +@return apiGetUserByNameRequest +*/ +func (a *UserApiService) GetUserByName(ctx _context.Context, username string) apiGetUserByNameRequest { + return apiGetUserByNameRequest{ + apiService: a, + ctx: ctx, + username: username, + } +} + +/* +Execute executes the request +@return User +*/ +func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue User + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.GetUserByName") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.PathEscape(parameterToString(r.username, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{"application/xml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiLoginUserRequest struct { + ctx _context.Context + apiService *UserApiService + username *string + password *string +} + +func (r apiLoginUserRequest) Username(username string) apiLoginUserRequest { + r.username = &username + return r +} +func (r apiLoginUserRequest) Password(password string) apiLoginUserRequest { + r.password = &password + return r +} +/* +LoginUser Logs user into the system + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiLoginUserRequest +*/ +func (a *UserApiService) LoginUser(ctx _context.Context) apiLoginUserRequest { + return apiLoginUserRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +@return string +*/ +func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue string + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LoginUser") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/login" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.username == nil { + return localVarReturnValue, nil, reportError("username is required and must be specified") + } + if r.password == nil { + return localVarReturnValue, nil, reportError("password is required and must be specified") + } + + localVarQueryParams.Add("username", parameterToString(*r.username, "")) + localVarQueryParams.Add("password", parameterToString(*r.password, "")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/xml", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = r.apiService.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 apiLogoutUserRequest struct { + ctx _context.Context + apiService *UserApiService +} + +/* +LogoutUser Logs out current logged in user session + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiLogoutUserRequest +*/ +func (a *UserApiService) LogoutUser(ctx _context.Context) apiLogoutUserRequest { + return apiLogoutUserRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request +*/ +func (r apiLogoutUserRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LogoutUser") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/logout" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} +type apiUpdateUserRequest struct { + ctx _context.Context + apiService *UserApiService + username string + user *User +} + +func (r apiUpdateUserRequest) User(user User) apiUpdateUserRequest { + r.user = &user + return r +} +/* +UpdateUser Updated user +This can only be done by the logged in user. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param username name that need to be deleted +@return apiUpdateUserRequest +*/ +func (a *UserApiService) UpdateUser(ctx _context.Context, username string) apiUpdateUserRequest { + return apiUpdateUserRequest{ + apiService: a, + ctx: ctx, + username: username, + } +} + +/* +Execute executes the request +*/ +func (r apiUpdateUserRequest) Execute() (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.UpdateUser") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.PathEscape(parameterToString(r.username, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.user == nil { + return nil, reportError("user is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.user + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := r.apiService.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_200_response.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_200_response.go new file mode 100644 index 00000000000..f1dcea6f973 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_200_response.go @@ -0,0 +1,176 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Model200Response Model for testing model name starting with number +type Model200Response struct { + Name *int32 `json:"name,omitempty"` + Class *string `json:"class,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Model200Response Model200Response + +// NewModel200Response instantiates a new Model200Response 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 NewModel200Response() *Model200Response { + this := Model200Response{} + return &this +} + +// NewModel200ResponseWithDefaults instantiates a new Model200Response 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 NewModel200ResponseWithDefaults() *Model200Response { + this := Model200Response{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Model200Response) GetName() int32 { + if o == nil || o.Name == nil { + var ret int32 + 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 *Model200Response) GetNameOk() (*int32, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Model200Response) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given int32 and assigns it to the Name field. +func (o *Model200Response) SetName(v int32) { + o.Name = &v +} + +// GetClass returns the Class field value if set, zero value otherwise. +func (o *Model200Response) GetClass() string { + if o == nil || o.Class == nil { + var ret string + return ret + } + return *o.Class +} + +// GetClassOk returns a tuple with the Class field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Model200Response) GetClassOk() (*string, bool) { + if o == nil || o.Class == nil { + return nil, false + } + return o.Class, true +} + +// HasClass returns a boolean if a field has been set. +func (o *Model200Response) HasClass() bool { + if o != nil && o.Class != nil { + return true + } + + return false +} + +// SetClass gets a reference to the given string and assigns it to the Class field. +func (o *Model200Response) SetClass(v string) { + o.Class = &v +} + +func (o Model200Response) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Class != nil { + toSerialize["class"] = o.Class + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Model200Response) UnmarshalJSON(bytes []byte) (err error) { + varModel200Response := _Model200Response{} + + if err = json.Unmarshal(bytes, &varModel200Response); err == nil { + *o = Model200Response(varModel200Response) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "class") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableModel200Response struct { + value *Model200Response + isSet bool +} + +func (v NullableModel200Response) Get() *Model200Response { + return v.value +} + +func (v *NullableModel200Response) Set(val *Model200Response) { + v.value = val + v.isSet = true +} + +func (v NullableModel200Response) IsSet() bool { + return v.isSet +} + +func (v *NullableModel200Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModel200Response(val *Model200Response) *NullableModel200Response { + return &NullableModel200Response{value: val, isSet: true} +} + +func (v NullableModel200Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModel200Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model__special_model_name_.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model__special_model_name_.go new file mode 100644 index 00000000000..83aea0db4ea --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model__special_model_name_.go @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// SpecialModelName struct for SpecialModelName +type SpecialModelName struct { + SpecialPropertyName *int64 `json:"$special[property.name],omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpecialModelName SpecialModelName + +// NewSpecialModelName instantiates a new SpecialModelName 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 NewSpecialModelName() *SpecialModelName { + this := SpecialModelName{} + return &this +} + +// NewSpecialModelNameWithDefaults instantiates a new SpecialModelName 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 NewSpecialModelNameWithDefaults() *SpecialModelName { + this := SpecialModelName{} + return &this +} + +// GetSpecialPropertyName returns the SpecialPropertyName field value if set, zero value otherwise. +func (o *SpecialModelName) GetSpecialPropertyName() int64 { + if o == nil || o.SpecialPropertyName == nil { + var ret int64 + return ret + } + return *o.SpecialPropertyName +} + +// GetSpecialPropertyNameOk returns a tuple with the SpecialPropertyName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpecialModelName) GetSpecialPropertyNameOk() (*int64, bool) { + if o == nil || o.SpecialPropertyName == nil { + return nil, false + } + return o.SpecialPropertyName, true +} + +// HasSpecialPropertyName returns a boolean if a field has been set. +func (o *SpecialModelName) HasSpecialPropertyName() bool { + if o != nil && o.SpecialPropertyName != nil { + return true + } + + return false +} + +// SetSpecialPropertyName gets a reference to the given int64 and assigns it to the SpecialPropertyName field. +func (o *SpecialModelName) SetSpecialPropertyName(v int64) { + o.SpecialPropertyName = &v +} + +func (o SpecialModelName) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.SpecialPropertyName != nil { + toSerialize["$special[property.name]"] = o.SpecialPropertyName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *SpecialModelName) UnmarshalJSON(bytes []byte) (err error) { + varSpecialModelName := _SpecialModelName{} + + if err = json.Unmarshal(bytes, &varSpecialModelName); err == nil { + *o = SpecialModelName(varSpecialModelName) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "$special[property.name]") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpecialModelName struct { + value *SpecialModelName + isSet bool +} + +func (v NullableSpecialModelName) Get() *SpecialModelName { + return v.value +} + +func (v *NullableSpecialModelName) Set(val *SpecialModelName) { + v.value = val + v.isSet = true +} + +func (v NullableSpecialModelName) IsSet() bool { + return v.isSet +} + +func (v *NullableSpecialModelName) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpecialModelName(val *SpecialModelName) *NullableSpecialModelName { + return &NullableSpecialModelName{value: val, isSet: true} +} + +func (v NullableSpecialModelName) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpecialModelName) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_additional_properties_class.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_additional_properties_class.go new file mode 100644 index 00000000000..927cd61dc49 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_additional_properties_class.go @@ -0,0 +1,176 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// AdditionalPropertiesClass struct for AdditionalPropertiesClass +type AdditionalPropertiesClass struct { + MapProperty *map[string]string `json:"map_property,omitempty"` + MapOfMapProperty *map[string]map[string]string `json:"map_of_map_property,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _AdditionalPropertiesClass AdditionalPropertiesClass + +// NewAdditionalPropertiesClass instantiates a new AdditionalPropertiesClass 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 NewAdditionalPropertiesClass() *AdditionalPropertiesClass { + this := AdditionalPropertiesClass{} + return &this +} + +// NewAdditionalPropertiesClassWithDefaults instantiates a new AdditionalPropertiesClass 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 NewAdditionalPropertiesClassWithDefaults() *AdditionalPropertiesClass { + this := AdditionalPropertiesClass{} + return &this +} + +// GetMapProperty returns the MapProperty field value if set, zero value otherwise. +func (o *AdditionalPropertiesClass) GetMapProperty() map[string]string { + if o == nil || o.MapProperty == nil { + var ret map[string]string + return ret + } + return *o.MapProperty +} + +// GetMapPropertyOk returns a tuple with the MapProperty field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdditionalPropertiesClass) GetMapPropertyOk() (*map[string]string, bool) { + if o == nil || o.MapProperty == nil { + return nil, false + } + return o.MapProperty, true +} + +// HasMapProperty returns a boolean if a field has been set. +func (o *AdditionalPropertiesClass) HasMapProperty() bool { + if o != nil && o.MapProperty != nil { + return true + } + + return false +} + +// SetMapProperty gets a reference to the given map[string]string and assigns it to the MapProperty field. +func (o *AdditionalPropertiesClass) SetMapProperty(v map[string]string) { + o.MapProperty = &v +} + +// GetMapOfMapProperty returns the MapOfMapProperty field value if set, zero value otherwise. +func (o *AdditionalPropertiesClass) GetMapOfMapProperty() map[string]map[string]string { + if o == nil || o.MapOfMapProperty == nil { + var ret map[string]map[string]string + return ret + } + return *o.MapOfMapProperty +} + +// GetMapOfMapPropertyOk returns a tuple with the MapOfMapProperty field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AdditionalPropertiesClass) GetMapOfMapPropertyOk() (*map[string]map[string]string, bool) { + if o == nil || o.MapOfMapProperty == nil { + return nil, false + } + return o.MapOfMapProperty, true +} + +// HasMapOfMapProperty returns a boolean if a field has been set. +func (o *AdditionalPropertiesClass) HasMapOfMapProperty() bool { + if o != nil && o.MapOfMapProperty != nil { + return true + } + + return false +} + +// SetMapOfMapProperty gets a reference to the given map[string]map[string]string and assigns it to the MapOfMapProperty field. +func (o *AdditionalPropertiesClass) SetMapOfMapProperty(v map[string]map[string]string) { + o.MapOfMapProperty = &v +} + +func (o AdditionalPropertiesClass) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.MapProperty != nil { + toSerialize["map_property"] = o.MapProperty + } + if o.MapOfMapProperty != nil { + toSerialize["map_of_map_property"] = o.MapOfMapProperty + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *AdditionalPropertiesClass) UnmarshalJSON(bytes []byte) (err error) { + varAdditionalPropertiesClass := _AdditionalPropertiesClass{} + + if err = json.Unmarshal(bytes, &varAdditionalPropertiesClass); err == nil { + *o = AdditionalPropertiesClass(varAdditionalPropertiesClass) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "map_property") + delete(additionalProperties, "map_of_map_property") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAdditionalPropertiesClass struct { + value *AdditionalPropertiesClass + isSet bool +} + +func (v NullableAdditionalPropertiesClass) Get() *AdditionalPropertiesClass { + return v.value +} + +func (v *NullableAdditionalPropertiesClass) Set(val *AdditionalPropertiesClass) { + v.value = val + v.isSet = true +} + +func (v NullableAdditionalPropertiesClass) IsSet() bool { + return v.isSet +} + +func (v *NullableAdditionalPropertiesClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdditionalPropertiesClass(val *AdditionalPropertiesClass) *NullableAdditionalPropertiesClass { + return &NullableAdditionalPropertiesClass{value: val, isSet: true} +} + +func (v NullableAdditionalPropertiesClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdditionalPropertiesClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_animal.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_animal.go new file mode 100644 index 00000000000..de5e106e58b --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_animal.go @@ -0,0 +1,173 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Animal struct for Animal +type Animal struct { + ClassName string `json:"className"` + Color *string `json:"color,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Animal Animal + +// NewAnimal instantiates a new Animal 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 NewAnimal(className string, ) *Animal { + this := Animal{} + this.ClassName = className + var color string = "red" + this.Color = &color + return &this +} + +// NewAnimalWithDefaults instantiates a new Animal 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 NewAnimalWithDefaults() *Animal { + this := Animal{} + var color string = "red" + this.Color = &color + return &this +} + +// GetClassName returns the ClassName field value +func (o *Animal) GetClassName() string { + if o == nil { + var ret string + return ret + } + + return o.ClassName +} + +// GetClassNameOk returns a tuple with the ClassName field value +// and a boolean to check if the value has been set. +func (o *Animal) GetClassNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClassName, true +} + +// SetClassName sets field value +func (o *Animal) SetClassName(v string) { + o.ClassName = v +} + +// GetColor returns the Color field value if set, zero value otherwise. +func (o *Animal) GetColor() string { + if o == nil || o.Color == nil { + 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 *Animal) GetColorOk() (*string, bool) { + if o == nil || o.Color == nil { + return nil, false + } + return o.Color, true +} + +// HasColor returns a boolean if a field has been set. +func (o *Animal) HasColor() bool { + if o != nil && o.Color != nil { + return true + } + + return false +} + +// SetColor gets a reference to the given string and assigns it to the Color field. +func (o *Animal) SetColor(v string) { + o.Color = &v +} + +func (o Animal) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["className"] = o.ClassName + } + if o.Color != nil { + toSerialize["color"] = o.Color + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Animal) UnmarshalJSON(bytes []byte) (err error) { + varAnimal := _Animal{} + + if err = json.Unmarshal(bytes, &varAnimal); err == nil { + *o = Animal(varAnimal) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "className") + delete(additionalProperties, "color") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAnimal struct { + value *Animal + isSet bool +} + +func (v NullableAnimal) Get() *Animal { + return v.value +} + +func (v *NullableAnimal) Set(val *Animal) { + v.value = val + v.isSet = true +} + +func (v NullableAnimal) IsSet() bool { + return v.isSet +} + +func (v *NullableAnimal) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAnimal(val *Animal) *NullableAnimal { + return &NullableAnimal{value: val, isSet: true} +} + +func (v NullableAnimal) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAnimal) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_api_response.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_api_response.go new file mode 100644 index 00000000000..c73431ad186 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_api_response.go @@ -0,0 +1,213 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ApiResponse struct for ApiResponse +type ApiResponse struct { + Code *int32 `json:"code,omitempty"` + Type *string `json:"type,omitempty"` + Message *string `json:"message,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ApiResponse ApiResponse + +// NewApiResponse instantiates a new ApiResponse 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 NewApiResponse() *ApiResponse { + this := ApiResponse{} + return &this +} + +// NewApiResponseWithDefaults instantiates a new ApiResponse 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 NewApiResponseWithDefaults() *ApiResponse { + this := ApiResponse{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *ApiResponse) GetCode() int32 { + if o == nil || o.Code == nil { + var ret int32 + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponse) GetCodeOk() (*int32, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *ApiResponse) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given int32 and assigns it to the Code field. +func (o *ApiResponse) SetCode(v int32) { + o.Code = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ApiResponse) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponse) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ApiResponse) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *ApiResponse) SetType(v string) { + o.Type = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *ApiResponse) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponse) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *ApiResponse) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *ApiResponse) SetMessage(v string) { + o.Message = &v +} + +func (o ApiResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *ApiResponse) UnmarshalJSON(bytes []byte) (err error) { + varApiResponse := _ApiResponse{} + + if err = json.Unmarshal(bytes, &varApiResponse); err == nil { + *o = ApiResponse(varApiResponse) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "type") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableApiResponse struct { + value *ApiResponse + isSet bool +} + +func (v NullableApiResponse) Get() *ApiResponse { + return v.value +} + +func (v *NullableApiResponse) Set(val *ApiResponse) { + v.value = val + v.isSet = true +} + +func (v NullableApiResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableApiResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApiResponse(val *ApiResponse) *NullableApiResponse { + return &NullableApiResponse{value: val, isSet: true} +} + +func (v NullableApiResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApiResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_apple.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_apple.go new file mode 100644 index 00000000000..afb785cf830 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_apple.go @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Apple struct for Apple +type Apple struct { + Cultivar *string `json:"cultivar,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Apple Apple + +// NewApple instantiates a new Apple 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 NewApple() *Apple { + this := Apple{} + return &this +} + +// NewAppleWithDefaults instantiates a new Apple 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 NewAppleWithDefaults() *Apple { + this := Apple{} + return &this +} + +// GetCultivar returns the Cultivar field value if set, zero value otherwise. +func (o *Apple) GetCultivar() string { + if o == nil || o.Cultivar == nil { + var ret string + return ret + } + return *o.Cultivar +} + +// GetCultivarOk returns a tuple with the Cultivar field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Apple) GetCultivarOk() (*string, bool) { + if o == nil || o.Cultivar == nil { + return nil, false + } + return o.Cultivar, true +} + +// HasCultivar returns a boolean if a field has been set. +func (o *Apple) HasCultivar() bool { + if o != nil && o.Cultivar != nil { + return true + } + + return false +} + +// SetCultivar gets a reference to the given string and assigns it to the Cultivar field. +func (o *Apple) SetCultivar(v string) { + o.Cultivar = &v +} + +func (o Apple) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Cultivar != nil { + toSerialize["cultivar"] = o.Cultivar + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Apple) UnmarshalJSON(bytes []byte) (err error) { + varApple := _Apple{} + + if err = json.Unmarshal(bytes, &varApple); err == nil { + *o = Apple(varApple) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "cultivar") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableApple struct { + value *Apple + isSet bool +} + +func (v NullableApple) Get() *Apple { + return v.value +} + +func (v *NullableApple) Set(val *Apple) { + v.value = val + v.isSet = true +} + +func (v NullableApple) IsSet() bool { + return v.isSet +} + +func (v *NullableApple) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApple(val *Apple) *NullableApple { + return &NullableApple{value: val, isSet: true} +} + +func (v NullableApple) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApple) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_apple_req.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_apple_req.go new file mode 100644 index 00000000000..e10641dc978 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_apple_req.go @@ -0,0 +1,169 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// AppleReq struct for AppleReq +type AppleReq struct { + Cultivar string `json:"cultivar"` + Mealy *bool `json:"mealy,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _AppleReq AppleReq + +// NewAppleReq instantiates a new AppleReq 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 NewAppleReq(cultivar string, ) *AppleReq { + this := AppleReq{} + this.Cultivar = cultivar + return &this +} + +// NewAppleReqWithDefaults instantiates a new AppleReq 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 NewAppleReqWithDefaults() *AppleReq { + this := AppleReq{} + return &this +} + +// GetCultivar returns the Cultivar field value +func (o *AppleReq) GetCultivar() string { + if o == nil { + var ret string + return ret + } + + return o.Cultivar +} + +// GetCultivarOk returns a tuple with the Cultivar field value +// and a boolean to check if the value has been set. +func (o *AppleReq) GetCultivarOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Cultivar, true +} + +// SetCultivar sets field value +func (o *AppleReq) SetCultivar(v string) { + o.Cultivar = v +} + +// GetMealy returns the Mealy field value if set, zero value otherwise. +func (o *AppleReq) GetMealy() bool { + if o == nil || o.Mealy == nil { + var ret bool + return ret + } + return *o.Mealy +} + +// GetMealyOk returns a tuple with the Mealy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AppleReq) GetMealyOk() (*bool, bool) { + if o == nil || o.Mealy == nil { + return nil, false + } + return o.Mealy, true +} + +// HasMealy returns a boolean if a field has been set. +func (o *AppleReq) HasMealy() bool { + if o != nil && o.Mealy != nil { + return true + } + + return false +} + +// SetMealy gets a reference to the given bool and assigns it to the Mealy field. +func (o *AppleReq) SetMealy(v bool) { + o.Mealy = &v +} + +func (o AppleReq) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["cultivar"] = o.Cultivar + } + if o.Mealy != nil { + toSerialize["mealy"] = o.Mealy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *AppleReq) UnmarshalJSON(bytes []byte) (err error) { + varAppleReq := _AppleReq{} + + if err = json.Unmarshal(bytes, &varAppleReq); err == nil { + *o = AppleReq(varAppleReq) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "cultivar") + delete(additionalProperties, "mealy") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAppleReq struct { + value *AppleReq + isSet bool +} + +func (v NullableAppleReq) Get() *AppleReq { + return v.value +} + +func (v *NullableAppleReq) Set(val *AppleReq) { + v.value = val + v.isSet = true +} + +func (v NullableAppleReq) IsSet() bool { + return v.isSet +} + +func (v *NullableAppleReq) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAppleReq(val *AppleReq) *NullableAppleReq { + return &NullableAppleReq{value: val, isSet: true} +} + +func (v NullableAppleReq) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAppleReq) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_array_of_array_of_number_only.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_array_of_array_of_number_only.go new file mode 100644 index 00000000000..1af9a061306 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_array_of_array_of_number_only.go @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ArrayOfArrayOfNumberOnly struct for ArrayOfArrayOfNumberOnly +type ArrayOfArrayOfNumberOnly struct { + ArrayArrayNumber *[][]float32 `json:"ArrayArrayNumber,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ArrayOfArrayOfNumberOnly ArrayOfArrayOfNumberOnly + +// NewArrayOfArrayOfNumberOnly instantiates a new ArrayOfArrayOfNumberOnly 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 NewArrayOfArrayOfNumberOnly() *ArrayOfArrayOfNumberOnly { + this := ArrayOfArrayOfNumberOnly{} + return &this +} + +// NewArrayOfArrayOfNumberOnlyWithDefaults instantiates a new ArrayOfArrayOfNumberOnly 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 NewArrayOfArrayOfNumberOnlyWithDefaults() *ArrayOfArrayOfNumberOnly { + this := ArrayOfArrayOfNumberOnly{} + return &this +} + +// GetArrayArrayNumber returns the ArrayArrayNumber field value if set, zero value otherwise. +func (o *ArrayOfArrayOfNumberOnly) GetArrayArrayNumber() [][]float32 { + if o == nil || o.ArrayArrayNumber == nil { + var ret [][]float32 + return ret + } + return *o.ArrayArrayNumber +} + +// GetArrayArrayNumberOk returns a tuple with the ArrayArrayNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArrayOfArrayOfNumberOnly) GetArrayArrayNumberOk() (*[][]float32, bool) { + if o == nil || o.ArrayArrayNumber == nil { + return nil, false + } + return o.ArrayArrayNumber, true +} + +// HasArrayArrayNumber returns a boolean if a field has been set. +func (o *ArrayOfArrayOfNumberOnly) HasArrayArrayNumber() bool { + if o != nil && o.ArrayArrayNumber != nil { + return true + } + + return false +} + +// SetArrayArrayNumber gets a reference to the given [][]float32 and assigns it to the ArrayArrayNumber field. +func (o *ArrayOfArrayOfNumberOnly) SetArrayArrayNumber(v [][]float32) { + o.ArrayArrayNumber = &v +} + +func (o ArrayOfArrayOfNumberOnly) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ArrayArrayNumber != nil { + toSerialize["ArrayArrayNumber"] = o.ArrayArrayNumber + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *ArrayOfArrayOfNumberOnly) UnmarshalJSON(bytes []byte) (err error) { + varArrayOfArrayOfNumberOnly := _ArrayOfArrayOfNumberOnly{} + + if err = json.Unmarshal(bytes, &varArrayOfArrayOfNumberOnly); err == nil { + *o = ArrayOfArrayOfNumberOnly(varArrayOfArrayOfNumberOnly) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "ArrayArrayNumber") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableArrayOfArrayOfNumberOnly struct { + value *ArrayOfArrayOfNumberOnly + isSet bool +} + +func (v NullableArrayOfArrayOfNumberOnly) Get() *ArrayOfArrayOfNumberOnly { + return v.value +} + +func (v *NullableArrayOfArrayOfNumberOnly) Set(val *ArrayOfArrayOfNumberOnly) { + v.value = val + v.isSet = true +} + +func (v NullableArrayOfArrayOfNumberOnly) IsSet() bool { + return v.isSet +} + +func (v *NullableArrayOfArrayOfNumberOnly) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableArrayOfArrayOfNumberOnly(val *ArrayOfArrayOfNumberOnly) *NullableArrayOfArrayOfNumberOnly { + return &NullableArrayOfArrayOfNumberOnly{value: val, isSet: true} +} + +func (v NullableArrayOfArrayOfNumberOnly) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableArrayOfArrayOfNumberOnly) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_array_of_number_only.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_array_of_number_only.go new file mode 100644 index 00000000000..7dcd1f46d30 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_array_of_number_only.go @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ArrayOfNumberOnly struct for ArrayOfNumberOnly +type ArrayOfNumberOnly struct { + ArrayNumber *[]float32 `json:"ArrayNumber,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ArrayOfNumberOnly ArrayOfNumberOnly + +// NewArrayOfNumberOnly instantiates a new ArrayOfNumberOnly 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 NewArrayOfNumberOnly() *ArrayOfNumberOnly { + this := ArrayOfNumberOnly{} + return &this +} + +// NewArrayOfNumberOnlyWithDefaults instantiates a new ArrayOfNumberOnly 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 NewArrayOfNumberOnlyWithDefaults() *ArrayOfNumberOnly { + this := ArrayOfNumberOnly{} + return &this +} + +// GetArrayNumber returns the ArrayNumber field value if set, zero value otherwise. +func (o *ArrayOfNumberOnly) GetArrayNumber() []float32 { + if o == nil || o.ArrayNumber == nil { + var ret []float32 + return ret + } + return *o.ArrayNumber +} + +// GetArrayNumberOk returns a tuple with the ArrayNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArrayOfNumberOnly) GetArrayNumberOk() (*[]float32, bool) { + if o == nil || o.ArrayNumber == nil { + return nil, false + } + return o.ArrayNumber, true +} + +// HasArrayNumber returns a boolean if a field has been set. +func (o *ArrayOfNumberOnly) HasArrayNumber() bool { + if o != nil && o.ArrayNumber != nil { + return true + } + + return false +} + +// SetArrayNumber gets a reference to the given []float32 and assigns it to the ArrayNumber field. +func (o *ArrayOfNumberOnly) SetArrayNumber(v []float32) { + o.ArrayNumber = &v +} + +func (o ArrayOfNumberOnly) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ArrayNumber != nil { + toSerialize["ArrayNumber"] = o.ArrayNumber + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *ArrayOfNumberOnly) UnmarshalJSON(bytes []byte) (err error) { + varArrayOfNumberOnly := _ArrayOfNumberOnly{} + + if err = json.Unmarshal(bytes, &varArrayOfNumberOnly); err == nil { + *o = ArrayOfNumberOnly(varArrayOfNumberOnly) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "ArrayNumber") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableArrayOfNumberOnly struct { + value *ArrayOfNumberOnly + isSet bool +} + +func (v NullableArrayOfNumberOnly) Get() *ArrayOfNumberOnly { + return v.value +} + +func (v *NullableArrayOfNumberOnly) Set(val *ArrayOfNumberOnly) { + v.value = val + v.isSet = true +} + +func (v NullableArrayOfNumberOnly) IsSet() bool { + return v.isSet +} + +func (v *NullableArrayOfNumberOnly) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableArrayOfNumberOnly(val *ArrayOfNumberOnly) *NullableArrayOfNumberOnly { + return &NullableArrayOfNumberOnly{value: val, isSet: true} +} + +func (v NullableArrayOfNumberOnly) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableArrayOfNumberOnly) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_array_test_.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_array_test_.go new file mode 100644 index 00000000000..40428c66d45 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_array_test_.go @@ -0,0 +1,213 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ArrayTest struct for ArrayTest +type ArrayTest struct { + ArrayOfString *[]string `json:"array_of_string,omitempty"` + ArrayArrayOfInteger *[][]int64 `json:"array_array_of_integer,omitempty"` + ArrayArrayOfModel *[][]ReadOnlyFirst `json:"array_array_of_model,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ArrayTest ArrayTest + +// NewArrayTest instantiates a new ArrayTest 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 NewArrayTest() *ArrayTest { + this := ArrayTest{} + return &this +} + +// NewArrayTestWithDefaults instantiates a new ArrayTest 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 NewArrayTestWithDefaults() *ArrayTest { + this := ArrayTest{} + return &this +} + +// GetArrayOfString returns the ArrayOfString field value if set, zero value otherwise. +func (o *ArrayTest) GetArrayOfString() []string { + if o == nil || o.ArrayOfString == nil { + var ret []string + return ret + } + return *o.ArrayOfString +} + +// GetArrayOfStringOk returns a tuple with the ArrayOfString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArrayTest) GetArrayOfStringOk() (*[]string, bool) { + if o == nil || o.ArrayOfString == nil { + return nil, false + } + return o.ArrayOfString, true +} + +// HasArrayOfString returns a boolean if a field has been set. +func (o *ArrayTest) HasArrayOfString() bool { + if o != nil && o.ArrayOfString != nil { + return true + } + + return false +} + +// SetArrayOfString gets a reference to the given []string and assigns it to the ArrayOfString field. +func (o *ArrayTest) SetArrayOfString(v []string) { + o.ArrayOfString = &v +} + +// GetArrayArrayOfInteger returns the ArrayArrayOfInteger field value if set, zero value otherwise. +func (o *ArrayTest) GetArrayArrayOfInteger() [][]int64 { + if o == nil || o.ArrayArrayOfInteger == nil { + var ret [][]int64 + return ret + } + return *o.ArrayArrayOfInteger +} + +// GetArrayArrayOfIntegerOk returns a tuple with the ArrayArrayOfInteger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArrayTest) GetArrayArrayOfIntegerOk() (*[][]int64, bool) { + if o == nil || o.ArrayArrayOfInteger == nil { + return nil, false + } + return o.ArrayArrayOfInteger, true +} + +// HasArrayArrayOfInteger returns a boolean if a field has been set. +func (o *ArrayTest) HasArrayArrayOfInteger() bool { + if o != nil && o.ArrayArrayOfInteger != nil { + return true + } + + return false +} + +// SetArrayArrayOfInteger gets a reference to the given [][]int64 and assigns it to the ArrayArrayOfInteger field. +func (o *ArrayTest) SetArrayArrayOfInteger(v [][]int64) { + o.ArrayArrayOfInteger = &v +} + +// GetArrayArrayOfModel returns the ArrayArrayOfModel field value if set, zero value otherwise. +func (o *ArrayTest) GetArrayArrayOfModel() [][]ReadOnlyFirst { + if o == nil || o.ArrayArrayOfModel == nil { + var ret [][]ReadOnlyFirst + return ret + } + return *o.ArrayArrayOfModel +} + +// GetArrayArrayOfModelOk returns a tuple with the ArrayArrayOfModel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArrayTest) GetArrayArrayOfModelOk() (*[][]ReadOnlyFirst, bool) { + if o == nil || o.ArrayArrayOfModel == nil { + return nil, false + } + return o.ArrayArrayOfModel, true +} + +// HasArrayArrayOfModel returns a boolean if a field has been set. +func (o *ArrayTest) HasArrayArrayOfModel() bool { + if o != nil && o.ArrayArrayOfModel != nil { + return true + } + + return false +} + +// SetArrayArrayOfModel gets a reference to the given [][]ReadOnlyFirst and assigns it to the ArrayArrayOfModel field. +func (o *ArrayTest) SetArrayArrayOfModel(v [][]ReadOnlyFirst) { + o.ArrayArrayOfModel = &v +} + +func (o ArrayTest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ArrayOfString != nil { + toSerialize["array_of_string"] = o.ArrayOfString + } + if o.ArrayArrayOfInteger != nil { + toSerialize["array_array_of_integer"] = o.ArrayArrayOfInteger + } + if o.ArrayArrayOfModel != nil { + toSerialize["array_array_of_model"] = o.ArrayArrayOfModel + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *ArrayTest) UnmarshalJSON(bytes []byte) (err error) { + varArrayTest := _ArrayTest{} + + if err = json.Unmarshal(bytes, &varArrayTest); err == nil { + *o = ArrayTest(varArrayTest) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "array_of_string") + delete(additionalProperties, "array_array_of_integer") + delete(additionalProperties, "array_array_of_model") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableArrayTest struct { + value *ArrayTest + isSet bool +} + +func (v NullableArrayTest) Get() *ArrayTest { + return v.value +} + +func (v *NullableArrayTest) Set(val *ArrayTest) { + v.value = val + v.isSet = true +} + +func (v NullableArrayTest) IsSet() bool { + return v.isSet +} + +func (v *NullableArrayTest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableArrayTest(val *ArrayTest) *NullableArrayTest { + return &NullableArrayTest{value: val, isSet: true} +} + +func (v NullableArrayTest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableArrayTest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_banana.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_banana.go new file mode 100644 index 00000000000..f375a8b8f9c --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_banana.go @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Banana struct for Banana +type Banana struct { + LengthCm *float32 `json:"lengthCm,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Banana Banana + +// NewBanana instantiates a new Banana 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 NewBanana() *Banana { + this := Banana{} + return &this +} + +// NewBananaWithDefaults instantiates a new Banana 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 NewBananaWithDefaults() *Banana { + this := Banana{} + return &this +} + +// GetLengthCm returns the LengthCm field value if set, zero value otherwise. +func (o *Banana) GetLengthCm() float32 { + if o == nil || o.LengthCm == nil { + var ret float32 + return ret + } + return *o.LengthCm +} + +// GetLengthCmOk returns a tuple with the LengthCm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Banana) GetLengthCmOk() (*float32, bool) { + if o == nil || o.LengthCm == nil { + return nil, false + } + return o.LengthCm, true +} + +// HasLengthCm returns a boolean if a field has been set. +func (o *Banana) HasLengthCm() bool { + if o != nil && o.LengthCm != nil { + return true + } + + return false +} + +// SetLengthCm gets a reference to the given float32 and assigns it to the LengthCm field. +func (o *Banana) SetLengthCm(v float32) { + o.LengthCm = &v +} + +func (o Banana) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.LengthCm != nil { + toSerialize["lengthCm"] = o.LengthCm + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Banana) UnmarshalJSON(bytes []byte) (err error) { + varBanana := _Banana{} + + if err = json.Unmarshal(bytes, &varBanana); err == nil { + *o = Banana(varBanana) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "lengthCm") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBanana struct { + value *Banana + isSet bool +} + +func (v NullableBanana) Get() *Banana { + return v.value +} + +func (v *NullableBanana) Set(val *Banana) { + v.value = val + v.isSet = true +} + +func (v NullableBanana) IsSet() bool { + return v.isSet +} + +func (v *NullableBanana) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBanana(val *Banana) *NullableBanana { + return &NullableBanana{value: val, isSet: true} +} + +func (v NullableBanana) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBanana) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_banana_req.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_banana_req.go new file mode 100644 index 00000000000..e6a80927437 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_banana_req.go @@ -0,0 +1,169 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// BananaReq struct for BananaReq +type BananaReq struct { + LengthCm float32 `json:"lengthCm"` + Sweet *bool `json:"sweet,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BananaReq BananaReq + +// NewBananaReq instantiates a new BananaReq 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 NewBananaReq(lengthCm float32, ) *BananaReq { + this := BananaReq{} + this.LengthCm = lengthCm + return &this +} + +// NewBananaReqWithDefaults instantiates a new BananaReq 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 NewBananaReqWithDefaults() *BananaReq { + this := BananaReq{} + return &this +} + +// GetLengthCm returns the LengthCm field value +func (o *BananaReq) GetLengthCm() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.LengthCm +} + +// GetLengthCmOk returns a tuple with the LengthCm field value +// and a boolean to check if the value has been set. +func (o *BananaReq) GetLengthCmOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.LengthCm, true +} + +// SetLengthCm sets field value +func (o *BananaReq) SetLengthCm(v float32) { + o.LengthCm = v +} + +// GetSweet returns the Sweet field value if set, zero value otherwise. +func (o *BananaReq) GetSweet() bool { + if o == nil || o.Sweet == nil { + var ret bool + return ret + } + return *o.Sweet +} + +// GetSweetOk returns a tuple with the Sweet field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BananaReq) GetSweetOk() (*bool, bool) { + if o == nil || o.Sweet == nil { + return nil, false + } + return o.Sweet, true +} + +// HasSweet returns a boolean if a field has been set. +func (o *BananaReq) HasSweet() bool { + if o != nil && o.Sweet != nil { + return true + } + + return false +} + +// SetSweet gets a reference to the given bool and assigns it to the Sweet field. +func (o *BananaReq) SetSweet(v bool) { + o.Sweet = &v +} + +func (o BananaReq) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["lengthCm"] = o.LengthCm + } + if o.Sweet != nil { + toSerialize["sweet"] = o.Sweet + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *BananaReq) UnmarshalJSON(bytes []byte) (err error) { + varBananaReq := _BananaReq{} + + if err = json.Unmarshal(bytes, &varBananaReq); err == nil { + *o = BananaReq(varBananaReq) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "lengthCm") + delete(additionalProperties, "sweet") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBananaReq struct { + value *BananaReq + isSet bool +} + +func (v NullableBananaReq) Get() *BananaReq { + return v.value +} + +func (v *NullableBananaReq) Set(val *BananaReq) { + v.value = val + v.isSet = true +} + +func (v NullableBananaReq) IsSet() bool { + return v.isSet +} + +func (v *NullableBananaReq) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBananaReq(val *BananaReq) *NullableBananaReq { + return &NullableBananaReq{value: val, isSet: true} +} + +func (v NullableBananaReq) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBananaReq) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_capitalization.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_capitalization.go new file mode 100644 index 00000000000..8cf8aa20b0d --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_capitalization.go @@ -0,0 +1,325 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Capitalization struct for Capitalization +type Capitalization struct { + SmallCamel *string `json:"smallCamel,omitempty"` + CapitalCamel *string `json:"CapitalCamel,omitempty"` + SmallSnake *string `json:"small_Snake,omitempty"` + CapitalSnake *string `json:"Capital_Snake,omitempty"` + SCAETHFlowPoints *string `json:"SCA_ETH_Flow_Points,omitempty"` + // Name of the pet + ATT_NAME *string `json:"ATT_NAME,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Capitalization Capitalization + +// NewCapitalization instantiates a new Capitalization 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 NewCapitalization() *Capitalization { + this := Capitalization{} + return &this +} + +// NewCapitalizationWithDefaults instantiates a new Capitalization 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 NewCapitalizationWithDefaults() *Capitalization { + this := Capitalization{} + return &this +} + +// GetSmallCamel returns the SmallCamel field value if set, zero value otherwise. +func (o *Capitalization) GetSmallCamel() string { + if o == nil || o.SmallCamel == nil { + var ret string + return ret + } + return *o.SmallCamel +} + +// GetSmallCamelOk returns a tuple with the SmallCamel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Capitalization) GetSmallCamelOk() (*string, bool) { + if o == nil || o.SmallCamel == nil { + return nil, false + } + return o.SmallCamel, true +} + +// HasSmallCamel returns a boolean if a field has been set. +func (o *Capitalization) HasSmallCamel() bool { + if o != nil && o.SmallCamel != nil { + return true + } + + return false +} + +// SetSmallCamel gets a reference to the given string and assigns it to the SmallCamel field. +func (o *Capitalization) SetSmallCamel(v string) { + o.SmallCamel = &v +} + +// GetCapitalCamel returns the CapitalCamel field value if set, zero value otherwise. +func (o *Capitalization) GetCapitalCamel() string { + if o == nil || o.CapitalCamel == nil { + var ret string + return ret + } + return *o.CapitalCamel +} + +// GetCapitalCamelOk returns a tuple with the CapitalCamel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Capitalization) GetCapitalCamelOk() (*string, bool) { + if o == nil || o.CapitalCamel == nil { + return nil, false + } + return o.CapitalCamel, true +} + +// HasCapitalCamel returns a boolean if a field has been set. +func (o *Capitalization) HasCapitalCamel() bool { + if o != nil && o.CapitalCamel != nil { + return true + } + + return false +} + +// SetCapitalCamel gets a reference to the given string and assigns it to the CapitalCamel field. +func (o *Capitalization) SetCapitalCamel(v string) { + o.CapitalCamel = &v +} + +// GetSmallSnake returns the SmallSnake field value if set, zero value otherwise. +func (o *Capitalization) GetSmallSnake() string { + if o == nil || o.SmallSnake == nil { + var ret string + return ret + } + return *o.SmallSnake +} + +// GetSmallSnakeOk returns a tuple with the SmallSnake field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Capitalization) GetSmallSnakeOk() (*string, bool) { + if o == nil || o.SmallSnake == nil { + return nil, false + } + return o.SmallSnake, true +} + +// HasSmallSnake returns a boolean if a field has been set. +func (o *Capitalization) HasSmallSnake() bool { + if o != nil && o.SmallSnake != nil { + return true + } + + return false +} + +// SetSmallSnake gets a reference to the given string and assigns it to the SmallSnake field. +func (o *Capitalization) SetSmallSnake(v string) { + o.SmallSnake = &v +} + +// GetCapitalSnake returns the CapitalSnake field value if set, zero value otherwise. +func (o *Capitalization) GetCapitalSnake() string { + if o == nil || o.CapitalSnake == nil { + var ret string + return ret + } + return *o.CapitalSnake +} + +// GetCapitalSnakeOk returns a tuple with the CapitalSnake field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Capitalization) GetCapitalSnakeOk() (*string, bool) { + if o == nil || o.CapitalSnake == nil { + return nil, false + } + return o.CapitalSnake, true +} + +// HasCapitalSnake returns a boolean if a field has been set. +func (o *Capitalization) HasCapitalSnake() bool { + if o != nil && o.CapitalSnake != nil { + return true + } + + return false +} + +// SetCapitalSnake gets a reference to the given string and assigns it to the CapitalSnake field. +func (o *Capitalization) SetCapitalSnake(v string) { + o.CapitalSnake = &v +} + +// GetSCAETHFlowPoints returns the SCAETHFlowPoints field value if set, zero value otherwise. +func (o *Capitalization) GetSCAETHFlowPoints() string { + if o == nil || o.SCAETHFlowPoints == nil { + var ret string + return ret + } + return *o.SCAETHFlowPoints +} + +// GetSCAETHFlowPointsOk returns a tuple with the SCAETHFlowPoints field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Capitalization) GetSCAETHFlowPointsOk() (*string, bool) { + if o == nil || o.SCAETHFlowPoints == nil { + return nil, false + } + return o.SCAETHFlowPoints, true +} + +// HasSCAETHFlowPoints returns a boolean if a field has been set. +func (o *Capitalization) HasSCAETHFlowPoints() bool { + if o != nil && o.SCAETHFlowPoints != nil { + return true + } + + return false +} + +// SetSCAETHFlowPoints gets a reference to the given string and assigns it to the SCAETHFlowPoints field. +func (o *Capitalization) SetSCAETHFlowPoints(v string) { + o.SCAETHFlowPoints = &v +} + +// GetATT_NAME returns the ATT_NAME field value if set, zero value otherwise. +func (o *Capitalization) GetATT_NAME() string { + if o == nil || o.ATT_NAME == nil { + var ret string + return ret + } + return *o.ATT_NAME +} + +// GetATT_NAMEOk returns a tuple with the ATT_NAME field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Capitalization) GetATT_NAMEOk() (*string, bool) { + if o == nil || o.ATT_NAME == nil { + return nil, false + } + return o.ATT_NAME, true +} + +// HasATT_NAME returns a boolean if a field has been set. +func (o *Capitalization) HasATT_NAME() bool { + if o != nil && o.ATT_NAME != nil { + return true + } + + return false +} + +// SetATT_NAME gets a reference to the given string and assigns it to the ATT_NAME field. +func (o *Capitalization) SetATT_NAME(v string) { + o.ATT_NAME = &v +} + +func (o Capitalization) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.SmallCamel != nil { + toSerialize["smallCamel"] = o.SmallCamel + } + if o.CapitalCamel != nil { + toSerialize["CapitalCamel"] = o.CapitalCamel + } + if o.SmallSnake != nil { + toSerialize["small_Snake"] = o.SmallSnake + } + if o.CapitalSnake != nil { + toSerialize["Capital_Snake"] = o.CapitalSnake + } + if o.SCAETHFlowPoints != nil { + toSerialize["SCA_ETH_Flow_Points"] = o.SCAETHFlowPoints + } + if o.ATT_NAME != nil { + toSerialize["ATT_NAME"] = o.ATT_NAME + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Capitalization) UnmarshalJSON(bytes []byte) (err error) { + varCapitalization := _Capitalization{} + + if err = json.Unmarshal(bytes, &varCapitalization); err == nil { + *o = Capitalization(varCapitalization) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "smallCamel") + delete(additionalProperties, "CapitalCamel") + delete(additionalProperties, "small_Snake") + delete(additionalProperties, "Capital_Snake") + delete(additionalProperties, "SCA_ETH_Flow_Points") + delete(additionalProperties, "ATT_NAME") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCapitalization struct { + value *Capitalization + isSet bool +} + +func (v NullableCapitalization) Get() *Capitalization { + return v.value +} + +func (v *NullableCapitalization) Set(val *Capitalization) { + v.value = val + v.isSet = true +} + +func (v NullableCapitalization) IsSet() bool { + return v.isSet +} + +func (v *NullableCapitalization) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCapitalization(val *Capitalization) *NullableCapitalization { + return &NullableCapitalization{value: val, isSet: true} +} + +func (v NullableCapitalization) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCapitalization) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_cat.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_cat.go new file mode 100644 index 00000000000..5bd129f1f76 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_cat.go @@ -0,0 +1,187 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "reflect" + "strings" +) + +// Cat struct for Cat +type Cat struct { + Animal + Declawed *bool `json:"declawed,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Cat Cat + +// NewCat instantiates a new Cat 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 NewCat() *Cat { + this := Cat{} + return &this +} + +// NewCatWithDefaults instantiates a new Cat 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 NewCatWithDefaults() *Cat { + this := Cat{} + return &this +} + +// GetDeclawed returns the Declawed field value if set, zero value otherwise. +func (o *Cat) GetDeclawed() bool { + if o == nil || o.Declawed == nil { + var ret bool + return ret + } + return *o.Declawed +} + +// GetDeclawedOk returns a tuple with the Declawed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Cat) GetDeclawedOk() (*bool, bool) { + if o == nil || o.Declawed == nil { + return nil, false + } + return o.Declawed, true +} + +// HasDeclawed returns a boolean if a field has been set. +func (o *Cat) HasDeclawed() bool { + if o != nil && o.Declawed != nil { + return true + } + + return false +} + +// SetDeclawed gets a reference to the given bool and assigns it to the Declawed field. +func (o *Cat) SetDeclawed(v bool) { + o.Declawed = &v +} + +func (o Cat) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + serializedAnimal, errAnimal := json.Marshal(o.Animal) + if errAnimal != nil { + return []byte{}, errAnimal + } + errAnimal = json.Unmarshal([]byte(serializedAnimal), &toSerialize) + if errAnimal != nil { + return []byte{}, errAnimal + } + if o.Declawed != nil { + toSerialize["declawed"] = o.Declawed + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Cat) UnmarshalJSON(bytes []byte) (err error) { + type CatWithoutEmbeddedStruct struct { + Declawed *bool `json:"declawed,omitempty"` + } + + varCatWithoutEmbeddedStruct := CatWithoutEmbeddedStruct{} + + err = json.Unmarshal(bytes, &varCatWithoutEmbeddedStruct) + if err == nil { + varCat := _Cat{} + varCat.Declawed = varCatWithoutEmbeddedStruct.Declawed + *o = Cat(varCat) + } else { + return err + } + + varCat := _Cat{} + + err = json.Unmarshal(bytes, &varCat) + if err == nil { + o.Animal = varCat.Animal + } else { + return err + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "declawed") + + // remove fields from embedded structs + reflectAnimal := reflect.ValueOf(o.Animal) + for i := 0; i < reflectAnimal.Type().NumField(); i++ { + t := reflectAnimal.Type().Field(i) + + if jsonTag := t.Tag.Get("json"); jsonTag != "" { + fieldName := "" + if commaIdx := strings.Index(jsonTag, ","); commaIdx > 0 { + fieldName = jsonTag[:commaIdx] + } else { + fieldName = jsonTag + } + if fieldName != "AdditionalProperties" { + delete(additionalProperties, fieldName) + } + } + } + + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCat struct { + value *Cat + isSet bool +} + +func (v NullableCat) Get() *Cat { + return v.value +} + +func (v *NullableCat) Set(val *Cat) { + v.value = val + v.isSet = true +} + +func (v NullableCat) IsSet() bool { + return v.isSet +} + +func (v *NullableCat) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCat(val *Cat) *NullableCat { + return &NullableCat{value: val, isSet: true} +} + +func (v NullableCat) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCat) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_cat_all_of.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_cat_all_of.go new file mode 100644 index 00000000000..ba8ba01e4eb --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_cat_all_of.go @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// CatAllOf struct for CatAllOf +type CatAllOf struct { + Declawed *bool `json:"declawed,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CatAllOf CatAllOf + +// NewCatAllOf instantiates a new CatAllOf 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 NewCatAllOf() *CatAllOf { + this := CatAllOf{} + return &this +} + +// NewCatAllOfWithDefaults instantiates a new CatAllOf 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 NewCatAllOfWithDefaults() *CatAllOf { + this := CatAllOf{} + return &this +} + +// GetDeclawed returns the Declawed field value if set, zero value otherwise. +func (o *CatAllOf) GetDeclawed() bool { + if o == nil || o.Declawed == nil { + var ret bool + return ret + } + return *o.Declawed +} + +// GetDeclawedOk returns a tuple with the Declawed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatAllOf) GetDeclawedOk() (*bool, bool) { + if o == nil || o.Declawed == nil { + return nil, false + } + return o.Declawed, true +} + +// HasDeclawed returns a boolean if a field has been set. +func (o *CatAllOf) HasDeclawed() bool { + if o != nil && o.Declawed != nil { + return true + } + + return false +} + +// SetDeclawed gets a reference to the given bool and assigns it to the Declawed field. +func (o *CatAllOf) SetDeclawed(v bool) { + o.Declawed = &v +} + +func (o CatAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Declawed != nil { + toSerialize["declawed"] = o.Declawed + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *CatAllOf) UnmarshalJSON(bytes []byte) (err error) { + varCatAllOf := _CatAllOf{} + + if err = json.Unmarshal(bytes, &varCatAllOf); err == nil { + *o = CatAllOf(varCatAllOf) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "declawed") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCatAllOf struct { + value *CatAllOf + isSet bool +} + +func (v NullableCatAllOf) Get() *CatAllOf { + return v.value +} + +func (v *NullableCatAllOf) Set(val *CatAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableCatAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableCatAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCatAllOf(val *CatAllOf) *NullableCatAllOf { + return &NullableCatAllOf{value: val, isSet: true} +} + +func (v NullableCatAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCatAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_category.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_category.go new file mode 100644 index 00000000000..6844fcaa2a6 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_category.go @@ -0,0 +1,171 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Category struct for Category +type Category struct { + Id *int64 `json:"id,omitempty"` + Name string `json:"name"` + AdditionalProperties map[string]interface{} +} + +type _Category 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 +func NewCategory(name string, ) *Category { + this := Category{} + this.Name = name + 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{} + var name string = "default-name" + this.Name = name + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Category) GetId() int64 { + if o == nil || o.Id == nil { + 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 || o.Id == nil { + 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 && o.Id != nil { + 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 +func (o *Category) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Category) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Category) SetName(v string) { + o.Name = v +} + +func (o Category) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if true { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Category) UnmarshalJSON(bytes []byte) (err error) { + varCategory := _Category{} + + if err = json.Unmarshal(bytes, &varCategory); err == nil { + *o = Category(varCategory) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +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) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_class_model.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_class_model.go new file mode 100644 index 00000000000..dd0e8da5128 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_class_model.go @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ClassModel Model for testing model with \"_class\" property +type ClassModel struct { + Class *string `json:"_class,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ClassModel ClassModel + +// NewClassModel instantiates a new ClassModel 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 NewClassModel() *ClassModel { + this := ClassModel{} + return &this +} + +// NewClassModelWithDefaults instantiates a new ClassModel 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 NewClassModelWithDefaults() *ClassModel { + this := ClassModel{} + return &this +} + +// GetClass returns the Class field value if set, zero value otherwise. +func (o *ClassModel) GetClass() string { + if o == nil || o.Class == nil { + var ret string + return ret + } + return *o.Class +} + +// GetClassOk returns a tuple with the Class field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ClassModel) GetClassOk() (*string, bool) { + if o == nil || o.Class == nil { + return nil, false + } + return o.Class, true +} + +// HasClass returns a boolean if a field has been set. +func (o *ClassModel) HasClass() bool { + if o != nil && o.Class != nil { + return true + } + + return false +} + +// SetClass gets a reference to the given string and assigns it to the Class field. +func (o *ClassModel) SetClass(v string) { + o.Class = &v +} + +func (o ClassModel) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Class != nil { + toSerialize["_class"] = o.Class + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *ClassModel) UnmarshalJSON(bytes []byte) (err error) { + varClassModel := _ClassModel{} + + if err = json.Unmarshal(bytes, &varClassModel); err == nil { + *o = ClassModel(varClassModel) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "_class") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableClassModel struct { + value *ClassModel + isSet bool +} + +func (v NullableClassModel) Get() *ClassModel { + return v.value +} + +func (v *NullableClassModel) Set(val *ClassModel) { + v.value = val + v.isSet = true +} + +func (v NullableClassModel) IsSet() bool { + return v.isSet +} + +func (v *NullableClassModel) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClassModel(val *ClassModel) *NullableClassModel { + return &NullableClassModel{value: val, isSet: true} +} + +func (v NullableClassModel) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClassModel) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_client.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_client.go new file mode 100644 index 00000000000..4fa9c5c9613 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_client.go @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Client struct for Client +type Client struct { + Client *string `json:"client,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Client Client + +// NewClient instantiates a new Client 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 NewClient() *Client { + this := Client{} + return &this +} + +// NewClientWithDefaults instantiates a new Client 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 NewClientWithDefaults() *Client { + this := Client{} + return &this +} + +// GetClient returns the Client field value if set, zero value otherwise. +func (o *Client) GetClient() string { + if o == nil || o.Client == nil { + var ret string + return ret + } + return *o.Client +} + +// GetClientOk returns a tuple with the Client field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Client) GetClientOk() (*string, bool) { + if o == nil || o.Client == nil { + return nil, false + } + return o.Client, true +} + +// HasClient returns a boolean if a field has been set. +func (o *Client) HasClient() bool { + if o != nil && o.Client != nil { + return true + } + + return false +} + +// SetClient gets a reference to the given string and assigns it to the Client field. +func (o *Client) SetClient(v string) { + o.Client = &v +} + +func (o Client) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Client != nil { + toSerialize["client"] = o.Client + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Client) UnmarshalJSON(bytes []byte) (err error) { + varClient := _Client{} + + if err = json.Unmarshal(bytes, &varClient); err == nil { + *o = Client(varClient) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "client") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableClient struct { + value *Client + isSet bool +} + +func (v NullableClient) Get() *Client { + return v.value +} + +func (v *NullableClient) Set(val *Client) { + v.value = val + v.isSet = true +} + +func (v NullableClient) IsSet() bool { + return v.isSet +} + +func (v *NullableClient) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClient(val *Client) *NullableClient { + return &NullableClient{value: val, isSet: true} +} + +func (v NullableClient) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClient) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_dog.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_dog.go new file mode 100644 index 00000000000..b3a1dcf1a6b --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_dog.go @@ -0,0 +1,187 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "reflect" + "strings" +) + +// Dog struct for Dog +type Dog struct { + Animal + Breed *string `json:"breed,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Dog Dog + +// NewDog instantiates a new Dog 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 NewDog() *Dog { + this := Dog{} + return &this +} + +// NewDogWithDefaults instantiates a new Dog 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 NewDogWithDefaults() *Dog { + this := Dog{} + return &this +} + +// GetBreed returns the Breed field value if set, zero value otherwise. +func (o *Dog) GetBreed() string { + if o == nil || o.Breed == nil { + var ret string + return ret + } + return *o.Breed +} + +// GetBreedOk returns a tuple with the Breed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dog) GetBreedOk() (*string, bool) { + if o == nil || o.Breed == nil { + return nil, false + } + return o.Breed, true +} + +// HasBreed returns a boolean if a field has been set. +func (o *Dog) HasBreed() bool { + if o != nil && o.Breed != nil { + return true + } + + return false +} + +// SetBreed gets a reference to the given string and assigns it to the Breed field. +func (o *Dog) SetBreed(v string) { + o.Breed = &v +} + +func (o Dog) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + serializedAnimal, errAnimal := json.Marshal(o.Animal) + if errAnimal != nil { + return []byte{}, errAnimal + } + errAnimal = json.Unmarshal([]byte(serializedAnimal), &toSerialize) + if errAnimal != nil { + return []byte{}, errAnimal + } + if o.Breed != nil { + toSerialize["breed"] = o.Breed + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Dog) UnmarshalJSON(bytes []byte) (err error) { + type DogWithoutEmbeddedStruct struct { + Breed *string `json:"breed,omitempty"` + } + + varDogWithoutEmbeddedStruct := DogWithoutEmbeddedStruct{} + + err = json.Unmarshal(bytes, &varDogWithoutEmbeddedStruct) + if err == nil { + varDog := _Dog{} + varDog.Breed = varDogWithoutEmbeddedStruct.Breed + *o = Dog(varDog) + } else { + return err + } + + varDog := _Dog{} + + err = json.Unmarshal(bytes, &varDog) + if err == nil { + o.Animal = varDog.Animal + } else { + return err + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "breed") + + // remove fields from embedded structs + reflectAnimal := reflect.ValueOf(o.Animal) + for i := 0; i < reflectAnimal.Type().NumField(); i++ { + t := reflectAnimal.Type().Field(i) + + if jsonTag := t.Tag.Get("json"); jsonTag != "" { + fieldName := "" + if commaIdx := strings.Index(jsonTag, ","); commaIdx > 0 { + fieldName = jsonTag[:commaIdx] + } else { + fieldName = jsonTag + } + if fieldName != "AdditionalProperties" { + delete(additionalProperties, fieldName) + } + } + } + + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDog struct { + value *Dog + isSet bool +} + +func (v NullableDog) Get() *Dog { + return v.value +} + +func (v *NullableDog) Set(val *Dog) { + v.value = val + v.isSet = true +} + +func (v NullableDog) IsSet() bool { + return v.isSet +} + +func (v *NullableDog) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDog(val *Dog) *NullableDog { + return &NullableDog{value: val, isSet: true} +} + +func (v NullableDog) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDog) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_dog_all_of.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_dog_all_of.go new file mode 100644 index 00000000000..5a63ff7ab1f --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_dog_all_of.go @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// DogAllOf struct for DogAllOf +type DogAllOf struct { + Breed *string `json:"breed,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DogAllOf DogAllOf + +// NewDogAllOf instantiates a new DogAllOf 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 NewDogAllOf() *DogAllOf { + this := DogAllOf{} + return &this +} + +// NewDogAllOfWithDefaults instantiates a new DogAllOf 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 NewDogAllOfWithDefaults() *DogAllOf { + this := DogAllOf{} + return &this +} + +// GetBreed returns the Breed field value if set, zero value otherwise. +func (o *DogAllOf) GetBreed() string { + if o == nil || o.Breed == nil { + var ret string + return ret + } + return *o.Breed +} + +// GetBreedOk returns a tuple with the Breed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DogAllOf) GetBreedOk() (*string, bool) { + if o == nil || o.Breed == nil { + return nil, false + } + return o.Breed, true +} + +// HasBreed returns a boolean if a field has been set. +func (o *DogAllOf) HasBreed() bool { + if o != nil && o.Breed != nil { + return true + } + + return false +} + +// SetBreed gets a reference to the given string and assigns it to the Breed field. +func (o *DogAllOf) SetBreed(v string) { + o.Breed = &v +} + +func (o DogAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Breed != nil { + toSerialize["breed"] = o.Breed + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *DogAllOf) UnmarshalJSON(bytes []byte) (err error) { + varDogAllOf := _DogAllOf{} + + if err = json.Unmarshal(bytes, &varDogAllOf); err == nil { + *o = DogAllOf(varDogAllOf) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "breed") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDogAllOf struct { + value *DogAllOf + isSet bool +} + +func (v NullableDogAllOf) Get() *DogAllOf { + return v.value +} + +func (v *NullableDogAllOf) Set(val *DogAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableDogAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableDogAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDogAllOf(val *DogAllOf) *NullableDogAllOf { + return &NullableDogAllOf{value: val, isSet: true} +} + +func (v NullableDogAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDogAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_enum_arrays.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_enum_arrays.go new file mode 100644 index 00000000000..5db0ec9b52b --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_enum_arrays.go @@ -0,0 +1,176 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// EnumArrays struct for EnumArrays +type EnumArrays struct { + JustSymbol *string `json:"just_symbol,omitempty"` + ArrayEnum *[]string `json:"array_enum,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _EnumArrays EnumArrays + +// NewEnumArrays instantiates a new EnumArrays 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 NewEnumArrays() *EnumArrays { + this := EnumArrays{} + return &this +} + +// NewEnumArraysWithDefaults instantiates a new EnumArrays 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 NewEnumArraysWithDefaults() *EnumArrays { + this := EnumArrays{} + return &this +} + +// GetJustSymbol returns the JustSymbol field value if set, zero value otherwise. +func (o *EnumArrays) GetJustSymbol() string { + if o == nil || o.JustSymbol == nil { + var ret string + return ret + } + return *o.JustSymbol +} + +// GetJustSymbolOk returns a tuple with the JustSymbol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnumArrays) GetJustSymbolOk() (*string, bool) { + if o == nil || o.JustSymbol == nil { + return nil, false + } + return o.JustSymbol, true +} + +// HasJustSymbol returns a boolean if a field has been set. +func (o *EnumArrays) HasJustSymbol() bool { + if o != nil && o.JustSymbol != nil { + return true + } + + return false +} + +// SetJustSymbol gets a reference to the given string and assigns it to the JustSymbol field. +func (o *EnumArrays) SetJustSymbol(v string) { + o.JustSymbol = &v +} + +// GetArrayEnum returns the ArrayEnum field value if set, zero value otherwise. +func (o *EnumArrays) GetArrayEnum() []string { + if o == nil || o.ArrayEnum == nil { + var ret []string + return ret + } + return *o.ArrayEnum +} + +// GetArrayEnumOk returns a tuple with the ArrayEnum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnumArrays) GetArrayEnumOk() (*[]string, bool) { + if o == nil || o.ArrayEnum == nil { + return nil, false + } + return o.ArrayEnum, true +} + +// HasArrayEnum returns a boolean if a field has been set. +func (o *EnumArrays) HasArrayEnum() bool { + if o != nil && o.ArrayEnum != nil { + return true + } + + return false +} + +// SetArrayEnum gets a reference to the given []string and assigns it to the ArrayEnum field. +func (o *EnumArrays) SetArrayEnum(v []string) { + o.ArrayEnum = &v +} + +func (o EnumArrays) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.JustSymbol != nil { + toSerialize["just_symbol"] = o.JustSymbol + } + if o.ArrayEnum != nil { + toSerialize["array_enum"] = o.ArrayEnum + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *EnumArrays) UnmarshalJSON(bytes []byte) (err error) { + varEnumArrays := _EnumArrays{} + + if err = json.Unmarshal(bytes, &varEnumArrays); err == nil { + *o = EnumArrays(varEnumArrays) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "just_symbol") + delete(additionalProperties, "array_enum") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEnumArrays struct { + value *EnumArrays + isSet bool +} + +func (v NullableEnumArrays) Get() *EnumArrays { + return v.value +} + +func (v *NullableEnumArrays) Set(val *EnumArrays) { + v.value = val + v.isSet = true +} + +func (v NullableEnumArrays) IsSet() bool { + return v.isSet +} + +func (v *NullableEnumArrays) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnumArrays(val *EnumArrays) *NullableEnumArrays { + return &NullableEnumArrays{value: val, isSet: true} +} + +func (v NullableEnumArrays) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnumArrays) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_enum_class.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_enum_class.go new file mode 100644 index 00000000000..9c03714608c --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_enum_class.go @@ -0,0 +1,84 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "fmt" +) + +// EnumClass the model 'EnumClass' +type EnumClass string + +// List of EnumClass +const ( + ENUMCLASS_ABC EnumClass = "_abc" + ENUMCLASS_EFG EnumClass = "-efg" + ENUMCLASS_XYZ EnumClass = "(xyz)" +) + +func (v *EnumClass) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := EnumClass(value) + for _, existing := range []EnumClass{ "_abc", "-efg", "(xyz)", } { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid EnumClass", value) +} + +// Ptr returns reference to EnumClass value +func (v EnumClass) Ptr() *EnumClass { + return &v +} + +type NullableEnumClass struct { + value *EnumClass + isSet bool +} + +func (v NullableEnumClass) Get() *EnumClass { + return v.value +} + +func (v *NullableEnumClass) Set(val *EnumClass) { + v.value = val + v.isSet = true +} + +func (v NullableEnumClass) IsSet() bool { + return v.isSet +} + +func (v *NullableEnumClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnumClass(val *EnumClass) *NullableEnumClass { + return &NullableEnumClass{value: val, isSet: true} +} + +func (v NullableEnumClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnumClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_enum_test_.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_enum_test_.go new file mode 100644 index 00000000000..bc208327afa --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_enum_test_.go @@ -0,0 +1,409 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// EnumTest struct for EnumTest +type EnumTest struct { + EnumString *string `json:"enum_string,omitempty"` + EnumStringRequired string `json:"enum_string_required"` + EnumInteger *int32 `json:"enum_integer,omitempty"` + EnumNumber *float64 `json:"enum_number,omitempty"` + OuterEnum NullableOuterEnum `json:"outerEnum,omitempty"` + OuterEnumInteger *OuterEnumInteger `json:"outerEnumInteger,omitempty"` + OuterEnumDefaultValue *OuterEnumDefaultValue `json:"outerEnumDefaultValue,omitempty"` + OuterEnumIntegerDefaultValue *OuterEnumIntegerDefaultValue `json:"outerEnumIntegerDefaultValue,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _EnumTest EnumTest + +// NewEnumTest instantiates a new EnumTest 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 NewEnumTest(enumStringRequired string, ) *EnumTest { + this := EnumTest{} + this.EnumStringRequired = enumStringRequired + var outerEnumDefaultValue OuterEnumDefaultValue = "placed" + this.OuterEnumDefaultValue = &outerEnumDefaultValue + var outerEnumIntegerDefaultValue OuterEnumIntegerDefaultValue = OUTERENUMINTEGERDEFAULTVALUE__0 + this.OuterEnumIntegerDefaultValue = &outerEnumIntegerDefaultValue + return &this +} + +// NewEnumTestWithDefaults instantiates a new EnumTest 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 NewEnumTestWithDefaults() *EnumTest { + this := EnumTest{} + var outerEnumDefaultValue OuterEnumDefaultValue = "placed" + this.OuterEnumDefaultValue = &outerEnumDefaultValue + var outerEnumIntegerDefaultValue OuterEnumIntegerDefaultValue = OUTERENUMINTEGERDEFAULTVALUE__0 + this.OuterEnumIntegerDefaultValue = &outerEnumIntegerDefaultValue + return &this +} + +// GetEnumString returns the EnumString field value if set, zero value otherwise. +func (o *EnumTest) GetEnumString() string { + if o == nil || o.EnumString == nil { + var ret string + return ret + } + return *o.EnumString +} + +// GetEnumStringOk returns a tuple with the EnumString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnumTest) GetEnumStringOk() (*string, bool) { + if o == nil || o.EnumString == nil { + return nil, false + } + return o.EnumString, true +} + +// HasEnumString returns a boolean if a field has been set. +func (o *EnumTest) HasEnumString() bool { + if o != nil && o.EnumString != nil { + return true + } + + return false +} + +// SetEnumString gets a reference to the given string and assigns it to the EnumString field. +func (o *EnumTest) SetEnumString(v string) { + o.EnumString = &v +} + +// GetEnumStringRequired returns the EnumStringRequired field value +func (o *EnumTest) GetEnumStringRequired() string { + if o == nil { + var ret string + return ret + } + + return o.EnumStringRequired +} + +// GetEnumStringRequiredOk returns a tuple with the EnumStringRequired field value +// and a boolean to check if the value has been set. +func (o *EnumTest) GetEnumStringRequiredOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EnumStringRequired, true +} + +// SetEnumStringRequired sets field value +func (o *EnumTest) SetEnumStringRequired(v string) { + o.EnumStringRequired = v +} + +// GetEnumInteger returns the EnumInteger field value if set, zero value otherwise. +func (o *EnumTest) GetEnumInteger() int32 { + if o == nil || o.EnumInteger == nil { + var ret int32 + return ret + } + return *o.EnumInteger +} + +// GetEnumIntegerOk returns a tuple with the EnumInteger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnumTest) GetEnumIntegerOk() (*int32, bool) { + if o == nil || o.EnumInteger == nil { + return nil, false + } + return o.EnumInteger, true +} + +// HasEnumInteger returns a boolean if a field has been set. +func (o *EnumTest) HasEnumInteger() bool { + if o != nil && o.EnumInteger != nil { + return true + } + + return false +} + +// SetEnumInteger gets a reference to the given int32 and assigns it to the EnumInteger field. +func (o *EnumTest) SetEnumInteger(v int32) { + o.EnumInteger = &v +} + +// GetEnumNumber returns the EnumNumber field value if set, zero value otherwise. +func (o *EnumTest) GetEnumNumber() float64 { + if o == nil || o.EnumNumber == nil { + var ret float64 + return ret + } + return *o.EnumNumber +} + +// GetEnumNumberOk returns a tuple with the EnumNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnumTest) GetEnumNumberOk() (*float64, bool) { + if o == nil || o.EnumNumber == nil { + return nil, false + } + return o.EnumNumber, true +} + +// HasEnumNumber returns a boolean if a field has been set. +func (o *EnumTest) HasEnumNumber() bool { + if o != nil && o.EnumNumber != nil { + return true + } + + return false +} + +// SetEnumNumber gets a reference to the given float64 and assigns it to the EnumNumber field. +func (o *EnumTest) SetEnumNumber(v float64) { + o.EnumNumber = &v +} + +// GetOuterEnum returns the OuterEnum field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *EnumTest) GetOuterEnum() OuterEnum { + if o == nil || o.OuterEnum.Get() == nil { + var ret OuterEnum + return ret + } + return *o.OuterEnum.Get() +} + +// GetOuterEnumOk returns a tuple with the OuterEnum field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *EnumTest) GetOuterEnumOk() (*OuterEnum, bool) { + if o == nil { + return nil, false + } + return o.OuterEnum.Get(), o.OuterEnum.IsSet() +} + +// HasOuterEnum returns a boolean if a field has been set. +func (o *EnumTest) HasOuterEnum() bool { + if o != nil && o.OuterEnum.IsSet() { + return true + } + + return false +} + +// SetOuterEnum gets a reference to the given NullableOuterEnum and assigns it to the OuterEnum field. +func (o *EnumTest) SetOuterEnum(v OuterEnum) { + o.OuterEnum.Set(&v) +} +// SetOuterEnumNil sets the value for OuterEnum to be an explicit nil +func (o *EnumTest) SetOuterEnumNil() { + o.OuterEnum.Set(nil) +} + +// UnsetOuterEnum ensures that no value is present for OuterEnum, not even an explicit nil +func (o *EnumTest) UnsetOuterEnum() { + o.OuterEnum.Unset() +} + +// GetOuterEnumInteger returns the OuterEnumInteger field value if set, zero value otherwise. +func (o *EnumTest) GetOuterEnumInteger() OuterEnumInteger { + if o == nil || o.OuterEnumInteger == nil { + var ret OuterEnumInteger + return ret + } + return *o.OuterEnumInteger +} + +// GetOuterEnumIntegerOk returns a tuple with the OuterEnumInteger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnumTest) GetOuterEnumIntegerOk() (*OuterEnumInteger, bool) { + if o == nil || o.OuterEnumInteger == nil { + return nil, false + } + return o.OuterEnumInteger, true +} + +// HasOuterEnumInteger returns a boolean if a field has been set. +func (o *EnumTest) HasOuterEnumInteger() bool { + if o != nil && o.OuterEnumInteger != nil { + return true + } + + return false +} + +// SetOuterEnumInteger gets a reference to the given OuterEnumInteger and assigns it to the OuterEnumInteger field. +func (o *EnumTest) SetOuterEnumInteger(v OuterEnumInteger) { + o.OuterEnumInteger = &v +} + +// GetOuterEnumDefaultValue returns the OuterEnumDefaultValue field value if set, zero value otherwise. +func (o *EnumTest) GetOuterEnumDefaultValue() OuterEnumDefaultValue { + if o == nil || o.OuterEnumDefaultValue == nil { + var ret OuterEnumDefaultValue + return ret + } + return *o.OuterEnumDefaultValue +} + +// GetOuterEnumDefaultValueOk returns a tuple with the OuterEnumDefaultValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnumTest) GetOuterEnumDefaultValueOk() (*OuterEnumDefaultValue, bool) { + if o == nil || o.OuterEnumDefaultValue == nil { + return nil, false + } + return o.OuterEnumDefaultValue, true +} + +// HasOuterEnumDefaultValue returns a boolean if a field has been set. +func (o *EnumTest) HasOuterEnumDefaultValue() bool { + if o != nil && o.OuterEnumDefaultValue != nil { + return true + } + + return false +} + +// SetOuterEnumDefaultValue gets a reference to the given OuterEnumDefaultValue and assigns it to the OuterEnumDefaultValue field. +func (o *EnumTest) SetOuterEnumDefaultValue(v OuterEnumDefaultValue) { + o.OuterEnumDefaultValue = &v +} + +// GetOuterEnumIntegerDefaultValue returns the OuterEnumIntegerDefaultValue field value if set, zero value otherwise. +func (o *EnumTest) GetOuterEnumIntegerDefaultValue() OuterEnumIntegerDefaultValue { + if o == nil || o.OuterEnumIntegerDefaultValue == nil { + var ret OuterEnumIntegerDefaultValue + return ret + } + return *o.OuterEnumIntegerDefaultValue +} + +// GetOuterEnumIntegerDefaultValueOk returns a tuple with the OuterEnumIntegerDefaultValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnumTest) GetOuterEnumIntegerDefaultValueOk() (*OuterEnumIntegerDefaultValue, bool) { + if o == nil || o.OuterEnumIntegerDefaultValue == nil { + return nil, false + } + return o.OuterEnumIntegerDefaultValue, true +} + +// HasOuterEnumIntegerDefaultValue returns a boolean if a field has been set. +func (o *EnumTest) HasOuterEnumIntegerDefaultValue() bool { + if o != nil && o.OuterEnumIntegerDefaultValue != nil { + return true + } + + return false +} + +// SetOuterEnumIntegerDefaultValue gets a reference to the given OuterEnumIntegerDefaultValue and assigns it to the OuterEnumIntegerDefaultValue field. +func (o *EnumTest) SetOuterEnumIntegerDefaultValue(v OuterEnumIntegerDefaultValue) { + o.OuterEnumIntegerDefaultValue = &v +} + +func (o EnumTest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.EnumString != nil { + toSerialize["enum_string"] = o.EnumString + } + if true { + toSerialize["enum_string_required"] = o.EnumStringRequired + } + if o.EnumInteger != nil { + toSerialize["enum_integer"] = o.EnumInteger + } + if o.EnumNumber != nil { + toSerialize["enum_number"] = o.EnumNumber + } + if o.OuterEnum.IsSet() { + toSerialize["outerEnum"] = o.OuterEnum.Get() + } + if o.OuterEnumInteger != nil { + toSerialize["outerEnumInteger"] = o.OuterEnumInteger + } + if o.OuterEnumDefaultValue != nil { + toSerialize["outerEnumDefaultValue"] = o.OuterEnumDefaultValue + } + if o.OuterEnumIntegerDefaultValue != nil { + toSerialize["outerEnumIntegerDefaultValue"] = o.OuterEnumIntegerDefaultValue + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *EnumTest) UnmarshalJSON(bytes []byte) (err error) { + varEnumTest := _EnumTest{} + + if err = json.Unmarshal(bytes, &varEnumTest); err == nil { + *o = EnumTest(varEnumTest) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "enum_string") + delete(additionalProperties, "enum_string_required") + delete(additionalProperties, "enum_integer") + delete(additionalProperties, "enum_number") + delete(additionalProperties, "outerEnum") + delete(additionalProperties, "outerEnumInteger") + delete(additionalProperties, "outerEnumDefaultValue") + delete(additionalProperties, "outerEnumIntegerDefaultValue") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEnumTest struct { + value *EnumTest + isSet bool +} + +func (v NullableEnumTest) Get() *EnumTest { + return v.value +} + +func (v *NullableEnumTest) Set(val *EnumTest) { + v.value = val + v.isSet = true +} + +func (v NullableEnumTest) IsSet() bool { + return v.isSet +} + +func (v *NullableEnumTest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnumTest(val *EnumTest) *NullableEnumTest { + return &NullableEnumTest{value: val, isSet: true} +} + +func (v NullableEnumTest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnumTest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_file.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_file.go new file mode 100644 index 00000000000..edb530ef383 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_file.go @@ -0,0 +1,140 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// File Must be named `File` for test. +type File struct { + // Test capitalization + SourceURI *string `json:"sourceURI,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _File File + +// NewFile instantiates a new File 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 NewFile() *File { + this := File{} + return &this +} + +// NewFileWithDefaults instantiates a new File 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 NewFileWithDefaults() *File { + this := File{} + return &this +} + +// GetSourceURI returns the SourceURI field value if set, zero value otherwise. +func (o *File) GetSourceURI() string { + if o == nil || o.SourceURI == nil { + var ret string + return ret + } + return *o.SourceURI +} + +// GetSourceURIOk returns a tuple with the SourceURI field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *File) GetSourceURIOk() (*string, bool) { + if o == nil || o.SourceURI == nil { + return nil, false + } + return o.SourceURI, true +} + +// HasSourceURI returns a boolean if a field has been set. +func (o *File) HasSourceURI() bool { + if o != nil && o.SourceURI != nil { + return true + } + + return false +} + +// SetSourceURI gets a reference to the given string and assigns it to the SourceURI field. +func (o *File) SetSourceURI(v string) { + o.SourceURI = &v +} + +func (o File) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.SourceURI != nil { + toSerialize["sourceURI"] = o.SourceURI + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *File) UnmarshalJSON(bytes []byte) (err error) { + varFile := _File{} + + if err = json.Unmarshal(bytes, &varFile); err == nil { + *o = File(varFile) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "sourceURI") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFile struct { + value *File + isSet bool +} + +func (v NullableFile) Get() *File { + return v.value +} + +func (v *NullableFile) Set(val *File) { + v.value = val + v.isSet = true +} + +func (v NullableFile) IsSet() bool { + return v.isSet +} + +func (v *NullableFile) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFile(val *File) *NullableFile { + return &NullableFile{value: val, isSet: true} +} + +func (v NullableFile) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFile) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_file_schema_test_class.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_file_schema_test_class.go new file mode 100644 index 00000000000..389de1c9252 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_file_schema_test_class.go @@ -0,0 +1,176 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// FileSchemaTestClass struct for FileSchemaTestClass +type FileSchemaTestClass struct { + File *File `json:"file,omitempty"` + Files *[]File `json:"files,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _FileSchemaTestClass FileSchemaTestClass + +// NewFileSchemaTestClass instantiates a new FileSchemaTestClass 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 NewFileSchemaTestClass() *FileSchemaTestClass { + this := FileSchemaTestClass{} + return &this +} + +// NewFileSchemaTestClassWithDefaults instantiates a new FileSchemaTestClass 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 NewFileSchemaTestClassWithDefaults() *FileSchemaTestClass { + this := FileSchemaTestClass{} + return &this +} + +// GetFile returns the File field value if set, zero value otherwise. +func (o *FileSchemaTestClass) GetFile() File { + if o == nil || o.File == nil { + var ret File + return ret + } + return *o.File +} + +// GetFileOk returns a tuple with the File field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FileSchemaTestClass) GetFileOk() (*File, bool) { + if o == nil || o.File == nil { + return nil, false + } + return o.File, true +} + +// HasFile returns a boolean if a field has been set. +func (o *FileSchemaTestClass) HasFile() bool { + if o != nil && o.File != nil { + return true + } + + return false +} + +// SetFile gets a reference to the given File and assigns it to the File field. +func (o *FileSchemaTestClass) SetFile(v File) { + o.File = &v +} + +// GetFiles returns the Files field value if set, zero value otherwise. +func (o *FileSchemaTestClass) GetFiles() []File { + if o == nil || o.Files == nil { + var ret []File + return ret + } + return *o.Files +} + +// GetFilesOk returns a tuple with the Files field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FileSchemaTestClass) GetFilesOk() (*[]File, bool) { + if o == nil || o.Files == nil { + return nil, false + } + return o.Files, true +} + +// HasFiles returns a boolean if a field has been set. +func (o *FileSchemaTestClass) HasFiles() bool { + if o != nil && o.Files != nil { + return true + } + + return false +} + +// SetFiles gets a reference to the given []File and assigns it to the Files field. +func (o *FileSchemaTestClass) SetFiles(v []File) { + o.Files = &v +} + +func (o FileSchemaTestClass) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.File != nil { + toSerialize["file"] = o.File + } + if o.Files != nil { + toSerialize["files"] = o.Files + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *FileSchemaTestClass) UnmarshalJSON(bytes []byte) (err error) { + varFileSchemaTestClass := _FileSchemaTestClass{} + + if err = json.Unmarshal(bytes, &varFileSchemaTestClass); err == nil { + *o = FileSchemaTestClass(varFileSchemaTestClass) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "file") + delete(additionalProperties, "files") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFileSchemaTestClass struct { + value *FileSchemaTestClass + isSet bool +} + +func (v NullableFileSchemaTestClass) Get() *FileSchemaTestClass { + return v.value +} + +func (v *NullableFileSchemaTestClass) Set(val *FileSchemaTestClass) { + v.value = val + v.isSet = true +} + +func (v NullableFileSchemaTestClass) IsSet() bool { + return v.isSet +} + +func (v *NullableFileSchemaTestClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFileSchemaTestClass(val *FileSchemaTestClass) *NullableFileSchemaTestClass { + return &NullableFileSchemaTestClass{value: val, isSet: true} +} + +func (v NullableFileSchemaTestClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFileSchemaTestClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_foo.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_foo.go new file mode 100644 index 00000000000..d60c4a1c017 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_foo.go @@ -0,0 +1,143 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Foo struct for Foo +type Foo struct { + Bar *string `json:"bar,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Foo Foo + +// NewFoo instantiates a new Foo 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 NewFoo() *Foo { + this := Foo{} + var bar string = "bar" + this.Bar = &bar + return &this +} + +// NewFooWithDefaults instantiates a new Foo 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 NewFooWithDefaults() *Foo { + this := Foo{} + var bar string = "bar" + this.Bar = &bar + return &this +} + +// GetBar returns the Bar field value if set, zero value otherwise. +func (o *Foo) GetBar() string { + if o == nil || o.Bar == nil { + var ret string + return ret + } + return *o.Bar +} + +// GetBarOk returns a tuple with the Bar field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Foo) GetBarOk() (*string, bool) { + if o == nil || o.Bar == nil { + return nil, false + } + return o.Bar, true +} + +// HasBar returns a boolean if a field has been set. +func (o *Foo) HasBar() bool { + if o != nil && o.Bar != nil { + return true + } + + return false +} + +// SetBar gets a reference to the given string and assigns it to the Bar field. +func (o *Foo) SetBar(v string) { + o.Bar = &v +} + +func (o Foo) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Bar != nil { + toSerialize["bar"] = o.Bar + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Foo) UnmarshalJSON(bytes []byte) (err error) { + varFoo := _Foo{} + + if err = json.Unmarshal(bytes, &varFoo); err == nil { + *o = Foo(varFoo) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "bar") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFoo struct { + value *Foo + isSet bool +} + +func (v NullableFoo) Get() *Foo { + return v.value +} + +func (v *NullableFoo) Set(val *Foo) { + v.value = val + v.isSet = true +} + +func (v NullableFoo) IsSet() bool { + return v.isSet +} + +func (v *NullableFoo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFoo(val *Foo) *NullableFoo { + return &NullableFoo{value: val, isSet: true} +} + +func (v NullableFoo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFoo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_format_test_.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_format_test_.go new file mode 100644 index 00000000000..bbc76b1285c --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_format_test_.go @@ -0,0 +1,633 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "os" + "time" +) + +// FormatTest struct for FormatTest +type FormatTest struct { + Integer *int32 `json:"integer,omitempty"` + Int32 *int32 `json:"int32,omitempty"` + Int64 *int64 `json:"int64,omitempty"` + Number float32 `json:"number"` + Float *float32 `json:"float,omitempty"` + Double *float64 `json:"double,omitempty"` + String *string `json:"string,omitempty"` + Byte string `json:"byte"` + Binary **os.File `json:"binary,omitempty"` + Date string `json:"date"` + DateTime *time.Time `json:"dateTime,omitempty"` + Uuid *string `json:"uuid,omitempty"` + Password string `json:"password"` + // A string that is a 10 digit number. Can have leading zeros. + PatternWithDigits *string `json:"pattern_with_digits,omitempty"` + // A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + PatternWithDigitsAndDelimiter *string `json:"pattern_with_digits_and_delimiter,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _FormatTest FormatTest + +// NewFormatTest instantiates a new FormatTest 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 NewFormatTest(number float32, byte_ string, date string, password string, ) *FormatTest { + this := FormatTest{} + this.Number = number + this.Byte = byte_ + this.Date = date + this.Password = password + return &this +} + +// NewFormatTestWithDefaults instantiates a new FormatTest 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 NewFormatTestWithDefaults() *FormatTest { + this := FormatTest{} + return &this +} + +// GetInteger returns the Integer field value if set, zero value otherwise. +func (o *FormatTest) GetInteger() int32 { + if o == nil || o.Integer == nil { + var ret int32 + return ret + } + return *o.Integer +} + +// GetIntegerOk returns a tuple with the Integer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetIntegerOk() (*int32, bool) { + if o == nil || o.Integer == nil { + return nil, false + } + return o.Integer, true +} + +// HasInteger returns a boolean if a field has been set. +func (o *FormatTest) HasInteger() bool { + if o != nil && o.Integer != nil { + return true + } + + return false +} + +// SetInteger gets a reference to the given int32 and assigns it to the Integer field. +func (o *FormatTest) SetInteger(v int32) { + o.Integer = &v +} + +// GetInt32 returns the Int32 field value if set, zero value otherwise. +func (o *FormatTest) GetInt32() int32 { + if o == nil || o.Int32 == nil { + var ret int32 + return ret + } + return *o.Int32 +} + +// GetInt32Ok returns a tuple with the Int32 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetInt32Ok() (*int32, bool) { + if o == nil || o.Int32 == nil { + return nil, false + } + return o.Int32, true +} + +// HasInt32 returns a boolean if a field has been set. +func (o *FormatTest) HasInt32() bool { + if o != nil && o.Int32 != nil { + return true + } + + return false +} + +// SetInt32 gets a reference to the given int32 and assigns it to the Int32 field. +func (o *FormatTest) SetInt32(v int32) { + o.Int32 = &v +} + +// GetInt64 returns the Int64 field value if set, zero value otherwise. +func (o *FormatTest) GetInt64() int64 { + if o == nil || o.Int64 == nil { + var ret int64 + return ret + } + return *o.Int64 +} + +// GetInt64Ok returns a tuple with the Int64 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetInt64Ok() (*int64, bool) { + if o == nil || o.Int64 == nil { + return nil, false + } + return o.Int64, true +} + +// HasInt64 returns a boolean if a field has been set. +func (o *FormatTest) HasInt64() bool { + if o != nil && o.Int64 != nil { + return true + } + + return false +} + +// SetInt64 gets a reference to the given int64 and assigns it to the Int64 field. +func (o *FormatTest) SetInt64(v int64) { + o.Int64 = &v +} + +// GetNumber returns the Number field value +func (o *FormatTest) GetNumber() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.Number +} + +// GetNumberOk returns a tuple with the Number field value +// and a boolean to check if the value has been set. +func (o *FormatTest) GetNumberOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.Number, true +} + +// SetNumber sets field value +func (o *FormatTest) SetNumber(v float32) { + o.Number = v +} + +// GetFloat returns the Float field value if set, zero value otherwise. +func (o *FormatTest) GetFloat() float32 { + if o == nil || o.Float == nil { + var ret float32 + return ret + } + return *o.Float +} + +// GetFloatOk returns a tuple with the Float field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetFloatOk() (*float32, bool) { + if o == nil || o.Float == nil { + return nil, false + } + return o.Float, true +} + +// HasFloat returns a boolean if a field has been set. +func (o *FormatTest) HasFloat() bool { + if o != nil && o.Float != nil { + return true + } + + return false +} + +// SetFloat gets a reference to the given float32 and assigns it to the Float field. +func (o *FormatTest) SetFloat(v float32) { + o.Float = &v +} + +// GetDouble returns the Double field value if set, zero value otherwise. +func (o *FormatTest) GetDouble() float64 { + if o == nil || o.Double == nil { + var ret float64 + return ret + } + return *o.Double +} + +// GetDoubleOk returns a tuple with the Double field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetDoubleOk() (*float64, bool) { + if o == nil || o.Double == nil { + return nil, false + } + return o.Double, true +} + +// HasDouble returns a boolean if a field has been set. +func (o *FormatTest) HasDouble() bool { + if o != nil && o.Double != nil { + return true + } + + return false +} + +// SetDouble gets a reference to the given float64 and assigns it to the Double field. +func (o *FormatTest) SetDouble(v float64) { + o.Double = &v +} + +// GetString returns the String field value if set, zero value otherwise. +func (o *FormatTest) GetString() string { + if o == nil || o.String == nil { + var ret string + return ret + } + return *o.String +} + +// GetStringOk returns a tuple with the String field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetStringOk() (*string, bool) { + if o == nil || o.String == nil { + return nil, false + } + return o.String, true +} + +// HasString returns a boolean if a field has been set. +func (o *FormatTest) HasString() bool { + if o != nil && o.String != nil { + return true + } + + return false +} + +// SetString gets a reference to the given string and assigns it to the String field. +func (o *FormatTest) SetString(v string) { + o.String = &v +} + +// GetByte returns the Byte field value +func (o *FormatTest) GetByte() string { + if o == nil { + var ret string + return ret + } + + return o.Byte +} + +// GetByteOk returns a tuple with the Byte field value +// and a boolean to check if the value has been set. +func (o *FormatTest) GetByteOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Byte, true +} + +// SetByte sets field value +func (o *FormatTest) SetByte(v string) { + o.Byte = v +} + +// GetBinary returns the Binary field value if set, zero value otherwise. +func (o *FormatTest) GetBinary() *os.File { + if o == nil || o.Binary == nil { + var ret *os.File + return ret + } + return *o.Binary +} + +// GetBinaryOk returns a tuple with the Binary field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetBinaryOk() (**os.File, bool) { + if o == nil || o.Binary == nil { + return nil, false + } + return o.Binary, true +} + +// HasBinary returns a boolean if a field has been set. +func (o *FormatTest) HasBinary() bool { + if o != nil && o.Binary != nil { + return true + } + + return false +} + +// SetBinary gets a reference to the given *os.File and assigns it to the Binary field. +func (o *FormatTest) SetBinary(v *os.File) { + o.Binary = &v +} + +// GetDate returns the Date field value +func (o *FormatTest) GetDate() string { + if o == nil { + var ret string + return ret + } + + return o.Date +} + +// GetDateOk returns a tuple with the Date field value +// and a boolean to check if the value has been set. +func (o *FormatTest) GetDateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Date, true +} + +// SetDate sets field value +func (o *FormatTest) SetDate(v string) { + o.Date = v +} + +// GetDateTime returns the DateTime field value if set, zero value otherwise. +func (o *FormatTest) GetDateTime() time.Time { + if o == nil || o.DateTime == nil { + var ret time.Time + return ret + } + return *o.DateTime +} + +// GetDateTimeOk returns a tuple with the DateTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetDateTimeOk() (*time.Time, bool) { + if o == nil || o.DateTime == nil { + return nil, false + } + return o.DateTime, true +} + +// HasDateTime returns a boolean if a field has been set. +func (o *FormatTest) HasDateTime() bool { + if o != nil && o.DateTime != nil { + return true + } + + return false +} + +// SetDateTime gets a reference to the given time.Time and assigns it to the DateTime field. +func (o *FormatTest) SetDateTime(v time.Time) { + o.DateTime = &v +} + +// GetUuid returns the Uuid field value if set, zero value otherwise. +func (o *FormatTest) GetUuid() string { + if o == nil || o.Uuid == nil { + var ret string + return ret + } + return *o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetUuidOk() (*string, bool) { + if o == nil || o.Uuid == nil { + return nil, false + } + return o.Uuid, true +} + +// HasUuid returns a boolean if a field has been set. +func (o *FormatTest) HasUuid() bool { + if o != nil && o.Uuid != nil { + return true + } + + return false +} + +// SetUuid gets a reference to the given string and assigns it to the Uuid field. +func (o *FormatTest) SetUuid(v string) { + o.Uuid = &v +} + +// GetPassword returns the Password field value +func (o *FormatTest) GetPassword() string { + if o == nil { + var ret string + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *FormatTest) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *FormatTest) SetPassword(v string) { + o.Password = v +} + +// GetPatternWithDigits returns the PatternWithDigits field value if set, zero value otherwise. +func (o *FormatTest) GetPatternWithDigits() string { + if o == nil || o.PatternWithDigits == nil { + var ret string + return ret + } + return *o.PatternWithDigits +} + +// GetPatternWithDigitsOk returns a tuple with the PatternWithDigits field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetPatternWithDigitsOk() (*string, bool) { + if o == nil || o.PatternWithDigits == nil { + return nil, false + } + return o.PatternWithDigits, true +} + +// HasPatternWithDigits returns a boolean if a field has been set. +func (o *FormatTest) HasPatternWithDigits() bool { + if o != nil && o.PatternWithDigits != nil { + return true + } + + return false +} + +// SetPatternWithDigits gets a reference to the given string and assigns it to the PatternWithDigits field. +func (o *FormatTest) SetPatternWithDigits(v string) { + o.PatternWithDigits = &v +} + +// GetPatternWithDigitsAndDelimiter returns the PatternWithDigitsAndDelimiter field value if set, zero value otherwise. +func (o *FormatTest) GetPatternWithDigitsAndDelimiter() string { + if o == nil || o.PatternWithDigitsAndDelimiter == nil { + var ret string + return ret + } + return *o.PatternWithDigitsAndDelimiter +} + +// GetPatternWithDigitsAndDelimiterOk returns a tuple with the PatternWithDigitsAndDelimiter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormatTest) GetPatternWithDigitsAndDelimiterOk() (*string, bool) { + if o == nil || o.PatternWithDigitsAndDelimiter == nil { + return nil, false + } + return o.PatternWithDigitsAndDelimiter, true +} + +// HasPatternWithDigitsAndDelimiter returns a boolean if a field has been set. +func (o *FormatTest) HasPatternWithDigitsAndDelimiter() bool { + if o != nil && o.PatternWithDigitsAndDelimiter != nil { + return true + } + + return false +} + +// SetPatternWithDigitsAndDelimiter gets a reference to the given string and assigns it to the PatternWithDigitsAndDelimiter field. +func (o *FormatTest) SetPatternWithDigitsAndDelimiter(v string) { + o.PatternWithDigitsAndDelimiter = &v +} + +func (o FormatTest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Integer != nil { + toSerialize["integer"] = o.Integer + } + if o.Int32 != nil { + toSerialize["int32"] = o.Int32 + } + if o.Int64 != nil { + toSerialize["int64"] = o.Int64 + } + if true { + toSerialize["number"] = o.Number + } + if o.Float != nil { + toSerialize["float"] = o.Float + } + if o.Double != nil { + toSerialize["double"] = o.Double + } + if o.String != nil { + toSerialize["string"] = o.String + } + if true { + toSerialize["byte"] = o.Byte + } + if o.Binary != nil { + toSerialize["binary"] = o.Binary + } + if true { + toSerialize["date"] = o.Date + } + if o.DateTime != nil { + toSerialize["dateTime"] = o.DateTime + } + if o.Uuid != nil { + toSerialize["uuid"] = o.Uuid + } + if true { + toSerialize["password"] = o.Password + } + if o.PatternWithDigits != nil { + toSerialize["pattern_with_digits"] = o.PatternWithDigits + } + if o.PatternWithDigitsAndDelimiter != nil { + toSerialize["pattern_with_digits_and_delimiter"] = o.PatternWithDigitsAndDelimiter + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *FormatTest) UnmarshalJSON(bytes []byte) (err error) { + varFormatTest := _FormatTest{} + + if err = json.Unmarshal(bytes, &varFormatTest); err == nil { + *o = FormatTest(varFormatTest) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "integer") + delete(additionalProperties, "int32") + delete(additionalProperties, "int64") + delete(additionalProperties, "number") + delete(additionalProperties, "float") + delete(additionalProperties, "double") + delete(additionalProperties, "string") + delete(additionalProperties, "byte") + delete(additionalProperties, "binary") + delete(additionalProperties, "date") + delete(additionalProperties, "dateTime") + delete(additionalProperties, "uuid") + delete(additionalProperties, "password") + delete(additionalProperties, "pattern_with_digits") + delete(additionalProperties, "pattern_with_digits_and_delimiter") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFormatTest struct { + value *FormatTest + isSet bool +} + +func (v NullableFormatTest) Get() *FormatTest { + return v.value +} + +func (v *NullableFormatTest) Set(val *FormatTest) { + v.value = val + v.isSet = true +} + +func (v NullableFormatTest) IsSet() bool { + return v.isSet +} + +func (v *NullableFormatTest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFormatTest(val *FormatTest) *NullableFormatTest { + return &NullableFormatTest{value: val, isSet: true} +} + +func (v NullableFormatTest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFormatTest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_fruit.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_fruit.go new file mode 100644 index 00000000000..d9c7a0b3b41 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_fruit.go @@ -0,0 +1,140 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "fmt" +) + +// Fruit - struct for Fruit +type Fruit struct { + Apple *Apple + Banana *Banana +} + +// AppleAsFruit is a convenience function that returns Apple wrapped in Fruit +func AppleAsFruit(v *Apple) Fruit { + return Fruit{ Apple: v} +} + +// BananaAsFruit is a convenience function that returns Banana wrapped in Fruit +func BananaAsFruit(v *Banana) Fruit { + return Fruit{ Banana: v} +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *Fruit) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into Apple + err = json.Unmarshal(data, &dst.Apple) + if err == nil { + jsonApple, _ := json.Marshal(dst.Apple) + if string(jsonApple) == "{}" { // empty struct + dst.Apple = nil + } else { + match++ + } + } else { + dst.Apple = nil + } + + // try to unmarshal data into Banana + err = json.Unmarshal(data, &dst.Banana) + if err == nil { + jsonBanana, _ := json.Marshal(dst.Banana) + if string(jsonBanana) == "{}" { // empty struct + dst.Banana = nil + } else { + match++ + } + } else { + dst.Banana = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.Apple = nil + dst.Banana = nil + + return fmt.Errorf("Data matches more than one schema in oneOf(Fruit)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("Data failed to match schemas in oneOf(Fruit)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src Fruit) MarshalJSON() ([]byte, error) { + if src.Apple != nil { + return json.Marshal(&src.Apple) + } + + if src.Banana != nil { + return json.Marshal(&src.Banana) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *Fruit) GetActualInstance() (interface{}) { + if obj.Apple != nil { + return obj.Apple + } + + if obj.Banana != nil { + return obj.Banana + } + + // all schemas are nil + return nil +} + +type NullableFruit struct { + value *Fruit + isSet bool +} + +func (v NullableFruit) Get() *Fruit { + return v.value +} + +func (v *NullableFruit) Set(val *Fruit) { + v.value = val + v.isSet = true +} + +func (v NullableFruit) IsSet() bool { + return v.isSet +} + +func (v *NullableFruit) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFruit(val *Fruit) *NullableFruit { + return &NullableFruit{value: val, isSet: true} +} + +func (v NullableFruit) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFruit) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_fruit_req.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_fruit_req.go new file mode 100644 index 00000000000..d20957648c6 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_fruit_req.go @@ -0,0 +1,140 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "fmt" +) + +// FruitReq - struct for FruitReq +type FruitReq struct { + AppleReq *AppleReq + BananaReq *BananaReq +} + +// AppleReqAsFruitReq is a convenience function that returns AppleReq wrapped in FruitReq +func AppleReqAsFruitReq(v *AppleReq) FruitReq { + return FruitReq{ AppleReq: v} +} + +// BananaReqAsFruitReq is a convenience function that returns BananaReq wrapped in FruitReq +func BananaReqAsFruitReq(v *BananaReq) FruitReq { + return FruitReq{ BananaReq: v} +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *FruitReq) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into AppleReq + err = json.Unmarshal(data, &dst.AppleReq) + if err == nil { + jsonAppleReq, _ := json.Marshal(dst.AppleReq) + if string(jsonAppleReq) == "{}" { // empty struct + dst.AppleReq = nil + } else { + match++ + } + } else { + dst.AppleReq = nil + } + + // try to unmarshal data into BananaReq + err = json.Unmarshal(data, &dst.BananaReq) + if err == nil { + jsonBananaReq, _ := json.Marshal(dst.BananaReq) + if string(jsonBananaReq) == "{}" { // empty struct + dst.BananaReq = nil + } else { + match++ + } + } else { + dst.BananaReq = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.AppleReq = nil + dst.BananaReq = nil + + return fmt.Errorf("Data matches more than one schema in oneOf(FruitReq)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("Data failed to match schemas in oneOf(FruitReq)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src FruitReq) MarshalJSON() ([]byte, error) { + if src.AppleReq != nil { + return json.Marshal(&src.AppleReq) + } + + if src.BananaReq != nil { + return json.Marshal(&src.BananaReq) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *FruitReq) GetActualInstance() (interface{}) { + if obj.AppleReq != nil { + return obj.AppleReq + } + + if obj.BananaReq != nil { + return obj.BananaReq + } + + // all schemas are nil + return nil +} + +type NullableFruitReq struct { + value *FruitReq + isSet bool +} + +func (v NullableFruitReq) Get() *FruitReq { + return v.value +} + +func (v *NullableFruitReq) Set(val *FruitReq) { + v.value = val + v.isSet = true +} + +func (v NullableFruitReq) IsSet() bool { + return v.isSet +} + +func (v *NullableFruitReq) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFruitReq(val *FruitReq) *NullableFruitReq { + return &NullableFruitReq{value: val, isSet: true} +} + +func (v NullableFruitReq) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFruitReq) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_gm_fruit.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_gm_fruit.go new file mode 100644 index 00000000000..6f2960cc319 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_gm_fruit.go @@ -0,0 +1,104 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "fmt" +) + +// GmFruit struct for GmFruit +type GmFruit struct { + Apple *Apple + Banana *Banana +} + +// Unmarshal JSON data into any of the pointers in the struct +func (dst *GmFruit) UnmarshalJSON(data []byte) error { + var err error + // try to unmarshal JSON data into Apple + err = json.Unmarshal(data, &dst.Apple); + if err == nil { + jsonApple, _ := json.Marshal(dst.Apple) + if string(jsonApple) == "{}" { // empty struct + dst.Apple = nil + } else { + return nil // data stored in dst.Apple, return on the first match + } + } else { + dst.Apple = nil + } + + // try to unmarshal JSON data into Banana + err = json.Unmarshal(data, &dst.Banana); + if err == nil { + jsonBanana, _ := json.Marshal(dst.Banana) + if string(jsonBanana) == "{}" { // empty struct + dst.Banana = nil + } else { + return nil // data stored in dst.Banana, return on the first match + } + } else { + dst.Banana = nil + } + + return fmt.Errorf("Data failed to match schemas in anyOf(GmFruit)") +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src *GmFruit) MarshalJSON() ([]byte, error) { + if src.Apple != nil { + return json.Marshal(&src.Apple) + } + + if src.Banana != nil { + return json.Marshal(&src.Banana) + } + + return nil, nil // no data in anyOf schemas +} + +type NullableGmFruit struct { + value *GmFruit + isSet bool +} + +func (v NullableGmFruit) Get() *GmFruit { + return v.value +} + +func (v *NullableGmFruit) Set(val *GmFruit) { + v.value = val + v.isSet = true +} + +func (v NullableGmFruit) IsSet() bool { + return v.isSet +} + +func (v *NullableGmFruit) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGmFruit(val *GmFruit) *NullableGmFruit { + return &NullableGmFruit{value: val, isSet: true} +} + +func (v NullableGmFruit) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGmFruit) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_has_only_read_only.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_has_only_read_only.go new file mode 100644 index 00000000000..4eb331e77eb --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_has_only_read_only.go @@ -0,0 +1,176 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// HasOnlyReadOnly struct for HasOnlyReadOnly +type HasOnlyReadOnly struct { + Bar *string `json:"bar,omitempty"` + Foo *string `json:"foo,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _HasOnlyReadOnly HasOnlyReadOnly + +// NewHasOnlyReadOnly instantiates a new HasOnlyReadOnly 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 NewHasOnlyReadOnly() *HasOnlyReadOnly { + this := HasOnlyReadOnly{} + return &this +} + +// NewHasOnlyReadOnlyWithDefaults instantiates a new HasOnlyReadOnly 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 NewHasOnlyReadOnlyWithDefaults() *HasOnlyReadOnly { + this := HasOnlyReadOnly{} + return &this +} + +// GetBar returns the Bar field value if set, zero value otherwise. +func (o *HasOnlyReadOnly) GetBar() string { + if o == nil || o.Bar == nil { + var ret string + return ret + } + return *o.Bar +} + +// GetBarOk returns a tuple with the Bar field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HasOnlyReadOnly) GetBarOk() (*string, bool) { + if o == nil || o.Bar == nil { + return nil, false + } + return o.Bar, true +} + +// HasBar returns a boolean if a field has been set. +func (o *HasOnlyReadOnly) HasBar() bool { + if o != nil && o.Bar != nil { + return true + } + + return false +} + +// SetBar gets a reference to the given string and assigns it to the Bar field. +func (o *HasOnlyReadOnly) SetBar(v string) { + o.Bar = &v +} + +// GetFoo returns the Foo field value if set, zero value otherwise. +func (o *HasOnlyReadOnly) GetFoo() string { + if o == nil || o.Foo == nil { + var ret string + return ret + } + return *o.Foo +} + +// GetFooOk returns a tuple with the Foo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HasOnlyReadOnly) GetFooOk() (*string, bool) { + if o == nil || o.Foo == nil { + return nil, false + } + return o.Foo, true +} + +// HasFoo returns a boolean if a field has been set. +func (o *HasOnlyReadOnly) HasFoo() bool { + if o != nil && o.Foo != nil { + return true + } + + return false +} + +// SetFoo gets a reference to the given string and assigns it to the Foo field. +func (o *HasOnlyReadOnly) SetFoo(v string) { + o.Foo = &v +} + +func (o HasOnlyReadOnly) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Bar != nil { + toSerialize["bar"] = o.Bar + } + if o.Foo != nil { + toSerialize["foo"] = o.Foo + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *HasOnlyReadOnly) UnmarshalJSON(bytes []byte) (err error) { + varHasOnlyReadOnly := _HasOnlyReadOnly{} + + if err = json.Unmarshal(bytes, &varHasOnlyReadOnly); err == nil { + *o = HasOnlyReadOnly(varHasOnlyReadOnly) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "bar") + delete(additionalProperties, "foo") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableHasOnlyReadOnly struct { + value *HasOnlyReadOnly + isSet bool +} + +func (v NullableHasOnlyReadOnly) Get() *HasOnlyReadOnly { + return v.value +} + +func (v *NullableHasOnlyReadOnly) Set(val *HasOnlyReadOnly) { + v.value = val + v.isSet = true +} + +func (v NullableHasOnlyReadOnly) IsSet() bool { + return v.isSet +} + +func (v *NullableHasOnlyReadOnly) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHasOnlyReadOnly(val *HasOnlyReadOnly) *NullableHasOnlyReadOnly { + return &NullableHasOnlyReadOnly{value: val, isSet: true} +} + +func (v NullableHasOnlyReadOnly) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHasOnlyReadOnly) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_health_check_result.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_health_check_result.go new file mode 100644 index 00000000000..db44ec77384 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_health_check_result.go @@ -0,0 +1,149 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// HealthCheckResult Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. +type HealthCheckResult struct { + NullableMessage NullableString `json:"NullableMessage,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _HealthCheckResult HealthCheckResult + +// NewHealthCheckResult instantiates a new HealthCheckResult 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 NewHealthCheckResult() *HealthCheckResult { + this := HealthCheckResult{} + return &this +} + +// NewHealthCheckResultWithDefaults instantiates a new HealthCheckResult 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 NewHealthCheckResultWithDefaults() *HealthCheckResult { + this := HealthCheckResult{} + return &this +} + +// GetNullableMessage returns the NullableMessage field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *HealthCheckResult) GetNullableMessage() string { + if o == nil || o.NullableMessage.Get() == nil { + var ret string + return ret + } + return *o.NullableMessage.Get() +} + +// GetNullableMessageOk returns a tuple with the NullableMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *HealthCheckResult) GetNullableMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NullableMessage.Get(), o.NullableMessage.IsSet() +} + +// HasNullableMessage returns a boolean if a field has been set. +func (o *HealthCheckResult) HasNullableMessage() bool { + if o != nil && o.NullableMessage.IsSet() { + return true + } + + return false +} + +// SetNullableMessage gets a reference to the given NullableString and assigns it to the NullableMessage field. +func (o *HealthCheckResult) SetNullableMessage(v string) { + o.NullableMessage.Set(&v) +} +// SetNullableMessageNil sets the value for NullableMessage to be an explicit nil +func (o *HealthCheckResult) SetNullableMessageNil() { + o.NullableMessage.Set(nil) +} + +// UnsetNullableMessage ensures that no value is present for NullableMessage, not even an explicit nil +func (o *HealthCheckResult) UnsetNullableMessage() { + o.NullableMessage.Unset() +} + +func (o HealthCheckResult) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.NullableMessage.IsSet() { + toSerialize["NullableMessage"] = o.NullableMessage.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *HealthCheckResult) UnmarshalJSON(bytes []byte) (err error) { + varHealthCheckResult := _HealthCheckResult{} + + if err = json.Unmarshal(bytes, &varHealthCheckResult); err == nil { + *o = HealthCheckResult(varHealthCheckResult) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "NullableMessage") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableHealthCheckResult struct { + value *HealthCheckResult + isSet bool +} + +func (v NullableHealthCheckResult) Get() *HealthCheckResult { + return v.value +} + +func (v *NullableHealthCheckResult) Set(val *HealthCheckResult) { + v.value = val + v.isSet = true +} + +func (v NullableHealthCheckResult) IsSet() bool { + return v.isSet +} + +func (v *NullableHealthCheckResult) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHealthCheckResult(val *HealthCheckResult) *NullableHealthCheckResult { + return &NullableHealthCheckResult{value: val, isSet: true} +} + +func (v NullableHealthCheckResult) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHealthCheckResult) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object.go new file mode 100644 index 00000000000..758deb9dc15 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object.go @@ -0,0 +1,178 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// InlineObject struct for InlineObject +type InlineObject struct { + // Updated name of the pet + Name *string `json:"name,omitempty"` + // Updated status of the pet + Status *string `json:"status,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InlineObject InlineObject + +// NewInlineObject instantiates a new InlineObject 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 NewInlineObject() *InlineObject { + this := InlineObject{} + return &this +} + +// NewInlineObjectWithDefaults instantiates a new InlineObject 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 NewInlineObjectWithDefaults() *InlineObject { + this := InlineObject{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *InlineObject) GetName() string { + if o == nil || o.Name == nil { + 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 *InlineObject) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *InlineObject) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *InlineObject) SetName(v string) { + o.Name = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *InlineObject) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *InlineObject) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *InlineObject) SetStatus(v string) { + o.Status = &v +} + +func (o InlineObject) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *InlineObject) UnmarshalJSON(bytes []byte) (err error) { + varInlineObject := _InlineObject{} + + if err = json.Unmarshal(bytes, &varInlineObject); err == nil { + *o = InlineObject(varInlineObject) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "status") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInlineObject struct { + value *InlineObject + isSet bool +} + +func (v NullableInlineObject) Get() *InlineObject { + return v.value +} + +func (v *NullableInlineObject) Set(val *InlineObject) { + v.value = val + v.isSet = true +} + +func (v NullableInlineObject) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineObject) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineObject(val *InlineObject) *NullableInlineObject { + return &NullableInlineObject{value: val, isSet: true} +} + +func (v NullableInlineObject) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineObject) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_1.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_1.go new file mode 100644 index 00000000000..90c0f63645d --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_1.go @@ -0,0 +1,179 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "os" +) + +// InlineObject1 struct for InlineObject1 +type InlineObject1 struct { + // Additional data to pass to server + AdditionalMetadata *string `json:"additionalMetadata,omitempty"` + // file to upload + File **os.File `json:"file,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InlineObject1 InlineObject1 + +// NewInlineObject1 instantiates a new InlineObject1 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 NewInlineObject1() *InlineObject1 { + this := InlineObject1{} + return &this +} + +// NewInlineObject1WithDefaults instantiates a new InlineObject1 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 NewInlineObject1WithDefaults() *InlineObject1 { + this := InlineObject1{} + return &this +} + +// GetAdditionalMetadata returns the AdditionalMetadata field value if set, zero value otherwise. +func (o *InlineObject1) GetAdditionalMetadata() string { + if o == nil || o.AdditionalMetadata == nil { + var ret string + return ret + } + return *o.AdditionalMetadata +} + +// GetAdditionalMetadataOk returns a tuple with the AdditionalMetadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject1) GetAdditionalMetadataOk() (*string, bool) { + if o == nil || o.AdditionalMetadata == nil { + return nil, false + } + return o.AdditionalMetadata, true +} + +// HasAdditionalMetadata returns a boolean if a field has been set. +func (o *InlineObject1) HasAdditionalMetadata() bool { + if o != nil && o.AdditionalMetadata != nil { + return true + } + + return false +} + +// SetAdditionalMetadata gets a reference to the given string and assigns it to the AdditionalMetadata field. +func (o *InlineObject1) SetAdditionalMetadata(v string) { + o.AdditionalMetadata = &v +} + +// GetFile returns the File field value if set, zero value otherwise. +func (o *InlineObject1) GetFile() *os.File { + if o == nil || o.File == nil { + var ret *os.File + return ret + } + return *o.File +} + +// GetFileOk returns a tuple with the File field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject1) GetFileOk() (**os.File, bool) { + if o == nil || o.File == nil { + return nil, false + } + return o.File, true +} + +// HasFile returns a boolean if a field has been set. +func (o *InlineObject1) HasFile() bool { + if o != nil && o.File != nil { + return true + } + + return false +} + +// SetFile gets a reference to the given *os.File and assigns it to the File field. +func (o *InlineObject1) SetFile(v *os.File) { + o.File = &v +} + +func (o InlineObject1) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.AdditionalMetadata != nil { + toSerialize["additionalMetadata"] = o.AdditionalMetadata + } + if o.File != nil { + toSerialize["file"] = o.File + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *InlineObject1) UnmarshalJSON(bytes []byte) (err error) { + varInlineObject1 := _InlineObject1{} + + if err = json.Unmarshal(bytes, &varInlineObject1); err == nil { + *o = InlineObject1(varInlineObject1) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "additionalMetadata") + delete(additionalProperties, "file") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInlineObject1 struct { + value *InlineObject1 + isSet bool +} + +func (v NullableInlineObject1) Get() *InlineObject1 { + return v.value +} + +func (v *NullableInlineObject1) Set(val *InlineObject1) { + v.value = val + v.isSet = true +} + +func (v NullableInlineObject1) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineObject1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineObject1(val *InlineObject1) *NullableInlineObject1 { + return &NullableInlineObject1{value: val, isSet: true} +} + +func (v NullableInlineObject1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineObject1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_2.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_2.go new file mode 100644 index 00000000000..3217b39c869 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_2.go @@ -0,0 +1,182 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// InlineObject2 struct for InlineObject2 +type InlineObject2 struct { + // Form parameter enum test (string array) + EnumFormStringArray *[]string `json:"enum_form_string_array,omitempty"` + // Form parameter enum test (string) + EnumFormString *string `json:"enum_form_string,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InlineObject2 InlineObject2 + +// NewInlineObject2 instantiates a new InlineObject2 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 NewInlineObject2() *InlineObject2 { + this := InlineObject2{} + var enumFormString string = "-efg" + this.EnumFormString = &enumFormString + return &this +} + +// NewInlineObject2WithDefaults instantiates a new InlineObject2 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 NewInlineObject2WithDefaults() *InlineObject2 { + this := InlineObject2{} + var enumFormString string = "-efg" + this.EnumFormString = &enumFormString + return &this +} + +// GetEnumFormStringArray returns the EnumFormStringArray field value if set, zero value otherwise. +func (o *InlineObject2) GetEnumFormStringArray() []string { + if o == nil || o.EnumFormStringArray == nil { + var ret []string + return ret + } + return *o.EnumFormStringArray +} + +// GetEnumFormStringArrayOk returns a tuple with the EnumFormStringArray field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject2) GetEnumFormStringArrayOk() (*[]string, bool) { + if o == nil || o.EnumFormStringArray == nil { + return nil, false + } + return o.EnumFormStringArray, true +} + +// HasEnumFormStringArray returns a boolean if a field has been set. +func (o *InlineObject2) HasEnumFormStringArray() bool { + if o != nil && o.EnumFormStringArray != nil { + return true + } + + return false +} + +// SetEnumFormStringArray gets a reference to the given []string and assigns it to the EnumFormStringArray field. +func (o *InlineObject2) SetEnumFormStringArray(v []string) { + o.EnumFormStringArray = &v +} + +// GetEnumFormString returns the EnumFormString field value if set, zero value otherwise. +func (o *InlineObject2) GetEnumFormString() string { + if o == nil || o.EnumFormString == nil { + var ret string + return ret + } + return *o.EnumFormString +} + +// GetEnumFormStringOk returns a tuple with the EnumFormString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject2) GetEnumFormStringOk() (*string, bool) { + if o == nil || o.EnumFormString == nil { + return nil, false + } + return o.EnumFormString, true +} + +// HasEnumFormString returns a boolean if a field has been set. +func (o *InlineObject2) HasEnumFormString() bool { + if o != nil && o.EnumFormString != nil { + return true + } + + return false +} + +// SetEnumFormString gets a reference to the given string and assigns it to the EnumFormString field. +func (o *InlineObject2) SetEnumFormString(v string) { + o.EnumFormString = &v +} + +func (o InlineObject2) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.EnumFormStringArray != nil { + toSerialize["enum_form_string_array"] = o.EnumFormStringArray + } + if o.EnumFormString != nil { + toSerialize["enum_form_string"] = o.EnumFormString + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *InlineObject2) UnmarshalJSON(bytes []byte) (err error) { + varInlineObject2 := _InlineObject2{} + + if err = json.Unmarshal(bytes, &varInlineObject2); err == nil { + *o = InlineObject2(varInlineObject2) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "enum_form_string_array") + delete(additionalProperties, "enum_form_string") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInlineObject2 struct { + value *InlineObject2 + isSet bool +} + +func (v NullableInlineObject2) Get() *InlineObject2 { + return v.value +} + +func (v *NullableInlineObject2) Set(val *InlineObject2) { + v.value = val + v.isSet = true +} + +func (v NullableInlineObject2) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineObject2) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineObject2(val *InlineObject2) *NullableInlineObject2 { + return &NullableInlineObject2{value: val, isSet: true} +} + +func (v NullableInlineObject2) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineObject2) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_3.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_3.go new file mode 100644 index 00000000000..8050df353aa --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_3.go @@ -0,0 +1,608 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "os" + "time" +) + +// InlineObject3 struct for InlineObject3 +type InlineObject3 struct { + // None + Integer *int32 `json:"integer,omitempty"` + // None + Int32 *int32 `json:"int32,omitempty"` + // None + Int64 *int64 `json:"int64,omitempty"` + // None + Number float32 `json:"number"` + // None + Float *float32 `json:"float,omitempty"` + // None + Double float64 `json:"double"` + // None + String *string `json:"string,omitempty"` + // None + PatternWithoutDelimiter string `json:"pattern_without_delimiter"` + // None + Byte string `json:"byte"` + // None + Binary **os.File `json:"binary,omitempty"` + // None + Date *string `json:"date,omitempty"` + // None + DateTime *time.Time `json:"dateTime,omitempty"` + // None + Password *string `json:"password,omitempty"` + // None + Callback *string `json:"callback,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InlineObject3 InlineObject3 + +// NewInlineObject3 instantiates a new InlineObject3 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 NewInlineObject3(number float32, double float64, patternWithoutDelimiter string, byte_ string, ) *InlineObject3 { + this := InlineObject3{} + this.Number = number + this.Double = double + this.PatternWithoutDelimiter = patternWithoutDelimiter + this.Byte = byte_ + return &this +} + +// NewInlineObject3WithDefaults instantiates a new InlineObject3 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 NewInlineObject3WithDefaults() *InlineObject3 { + this := InlineObject3{} + return &this +} + +// GetInteger returns the Integer field value if set, zero value otherwise. +func (o *InlineObject3) GetInteger() int32 { + if o == nil || o.Integer == nil { + var ret int32 + return ret + } + return *o.Integer +} + +// GetIntegerOk returns a tuple with the Integer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetIntegerOk() (*int32, bool) { + if o == nil || o.Integer == nil { + return nil, false + } + return o.Integer, true +} + +// HasInteger returns a boolean if a field has been set. +func (o *InlineObject3) HasInteger() bool { + if o != nil && o.Integer != nil { + return true + } + + return false +} + +// SetInteger gets a reference to the given int32 and assigns it to the Integer field. +func (o *InlineObject3) SetInteger(v int32) { + o.Integer = &v +} + +// GetInt32 returns the Int32 field value if set, zero value otherwise. +func (o *InlineObject3) GetInt32() int32 { + if o == nil || o.Int32 == nil { + var ret int32 + return ret + } + return *o.Int32 +} + +// GetInt32Ok returns a tuple with the Int32 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetInt32Ok() (*int32, bool) { + if o == nil || o.Int32 == nil { + return nil, false + } + return o.Int32, true +} + +// HasInt32 returns a boolean if a field has been set. +func (o *InlineObject3) HasInt32() bool { + if o != nil && o.Int32 != nil { + return true + } + + return false +} + +// SetInt32 gets a reference to the given int32 and assigns it to the Int32 field. +func (o *InlineObject3) SetInt32(v int32) { + o.Int32 = &v +} + +// GetInt64 returns the Int64 field value if set, zero value otherwise. +func (o *InlineObject3) GetInt64() int64 { + if o == nil || o.Int64 == nil { + var ret int64 + return ret + } + return *o.Int64 +} + +// GetInt64Ok returns a tuple with the Int64 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetInt64Ok() (*int64, bool) { + if o == nil || o.Int64 == nil { + return nil, false + } + return o.Int64, true +} + +// HasInt64 returns a boolean if a field has been set. +func (o *InlineObject3) HasInt64() bool { + if o != nil && o.Int64 != nil { + return true + } + + return false +} + +// SetInt64 gets a reference to the given int64 and assigns it to the Int64 field. +func (o *InlineObject3) SetInt64(v int64) { + o.Int64 = &v +} + +// GetNumber returns the Number field value +func (o *InlineObject3) GetNumber() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.Number +} + +// GetNumberOk returns a tuple with the Number field value +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetNumberOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.Number, true +} + +// SetNumber sets field value +func (o *InlineObject3) SetNumber(v float32) { + o.Number = v +} + +// GetFloat returns the Float field value if set, zero value otherwise. +func (o *InlineObject3) GetFloat() float32 { + if o == nil || o.Float == nil { + var ret float32 + return ret + } + return *o.Float +} + +// GetFloatOk returns a tuple with the Float field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetFloatOk() (*float32, bool) { + if o == nil || o.Float == nil { + return nil, false + } + return o.Float, true +} + +// HasFloat returns a boolean if a field has been set. +func (o *InlineObject3) HasFloat() bool { + if o != nil && o.Float != nil { + return true + } + + return false +} + +// SetFloat gets a reference to the given float32 and assigns it to the Float field. +func (o *InlineObject3) SetFloat(v float32) { + o.Float = &v +} + +// GetDouble returns the Double field value +func (o *InlineObject3) GetDouble() float64 { + if o == nil { + var ret float64 + return ret + } + + return o.Double +} + +// GetDoubleOk returns a tuple with the Double field value +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetDoubleOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Double, true +} + +// SetDouble sets field value +func (o *InlineObject3) SetDouble(v float64) { + o.Double = v +} + +// GetString returns the String field value if set, zero value otherwise. +func (o *InlineObject3) GetString() string { + if o == nil || o.String == nil { + var ret string + return ret + } + return *o.String +} + +// GetStringOk returns a tuple with the String field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetStringOk() (*string, bool) { + if o == nil || o.String == nil { + return nil, false + } + return o.String, true +} + +// HasString returns a boolean if a field has been set. +func (o *InlineObject3) HasString() bool { + if o != nil && o.String != nil { + return true + } + + return false +} + +// SetString gets a reference to the given string and assigns it to the String field. +func (o *InlineObject3) SetString(v string) { + o.String = &v +} + +// GetPatternWithoutDelimiter returns the PatternWithoutDelimiter field value +func (o *InlineObject3) GetPatternWithoutDelimiter() string { + if o == nil { + var ret string + return ret + } + + return o.PatternWithoutDelimiter +} + +// GetPatternWithoutDelimiterOk returns a tuple with the PatternWithoutDelimiter field value +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetPatternWithoutDelimiterOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PatternWithoutDelimiter, true +} + +// SetPatternWithoutDelimiter sets field value +func (o *InlineObject3) SetPatternWithoutDelimiter(v string) { + o.PatternWithoutDelimiter = v +} + +// GetByte returns the Byte field value +func (o *InlineObject3) GetByte() string { + if o == nil { + var ret string + return ret + } + + return o.Byte +} + +// GetByteOk returns a tuple with the Byte field value +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetByteOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Byte, true +} + +// SetByte sets field value +func (o *InlineObject3) SetByte(v string) { + o.Byte = v +} + +// GetBinary returns the Binary field value if set, zero value otherwise. +func (o *InlineObject3) GetBinary() *os.File { + if o == nil || o.Binary == nil { + var ret *os.File + return ret + } + return *o.Binary +} + +// GetBinaryOk returns a tuple with the Binary field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetBinaryOk() (**os.File, bool) { + if o == nil || o.Binary == nil { + return nil, false + } + return o.Binary, true +} + +// HasBinary returns a boolean if a field has been set. +func (o *InlineObject3) HasBinary() bool { + if o != nil && o.Binary != nil { + return true + } + + return false +} + +// SetBinary gets a reference to the given *os.File and assigns it to the Binary field. +func (o *InlineObject3) SetBinary(v *os.File) { + o.Binary = &v +} + +// GetDate returns the Date field value if set, zero value otherwise. +func (o *InlineObject3) GetDate() string { + if o == nil || o.Date == nil { + var ret string + return ret + } + return *o.Date +} + +// GetDateOk returns a tuple with the Date field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetDateOk() (*string, bool) { + if o == nil || o.Date == nil { + return nil, false + } + return o.Date, true +} + +// HasDate returns a boolean if a field has been set. +func (o *InlineObject3) HasDate() bool { + if o != nil && o.Date != nil { + return true + } + + return false +} + +// SetDate gets a reference to the given string and assigns it to the Date field. +func (o *InlineObject3) SetDate(v string) { + o.Date = &v +} + +// GetDateTime returns the DateTime field value if set, zero value otherwise. +func (o *InlineObject3) GetDateTime() time.Time { + if o == nil || o.DateTime == nil { + var ret time.Time + return ret + } + return *o.DateTime +} + +// GetDateTimeOk returns a tuple with the DateTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetDateTimeOk() (*time.Time, bool) { + if o == nil || o.DateTime == nil { + return nil, false + } + return o.DateTime, true +} + +// HasDateTime returns a boolean if a field has been set. +func (o *InlineObject3) HasDateTime() bool { + if o != nil && o.DateTime != nil { + return true + } + + return false +} + +// SetDateTime gets a reference to the given time.Time and assigns it to the DateTime field. +func (o *InlineObject3) SetDateTime(v time.Time) { + o.DateTime = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *InlineObject3) GetPassword() string { + if o == nil || o.Password == nil { + var ret string + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetPasswordOk() (*string, bool) { + if o == nil || o.Password == nil { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *InlineObject3) HasPassword() bool { + if o != nil && o.Password != nil { + return true + } + + return false +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *InlineObject3) SetPassword(v string) { + o.Password = &v +} + +// GetCallback returns the Callback field value if set, zero value otherwise. +func (o *InlineObject3) GetCallback() string { + if o == nil || o.Callback == nil { + var ret string + return ret + } + return *o.Callback +} + +// GetCallbackOk returns a tuple with the Callback field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject3) GetCallbackOk() (*string, bool) { + if o == nil || o.Callback == nil { + return nil, false + } + return o.Callback, true +} + +// HasCallback returns a boolean if a field has been set. +func (o *InlineObject3) HasCallback() bool { + if o != nil && o.Callback != nil { + return true + } + + return false +} + +// SetCallback gets a reference to the given string and assigns it to the Callback field. +func (o *InlineObject3) SetCallback(v string) { + o.Callback = &v +} + +func (o InlineObject3) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Integer != nil { + toSerialize["integer"] = o.Integer + } + if o.Int32 != nil { + toSerialize["int32"] = o.Int32 + } + if o.Int64 != nil { + toSerialize["int64"] = o.Int64 + } + if true { + toSerialize["number"] = o.Number + } + if o.Float != nil { + toSerialize["float"] = o.Float + } + if true { + toSerialize["double"] = o.Double + } + if o.String != nil { + toSerialize["string"] = o.String + } + if true { + toSerialize["pattern_without_delimiter"] = o.PatternWithoutDelimiter + } + if true { + toSerialize["byte"] = o.Byte + } + if o.Binary != nil { + toSerialize["binary"] = o.Binary + } + if o.Date != nil { + toSerialize["date"] = o.Date + } + if o.DateTime != nil { + toSerialize["dateTime"] = o.DateTime + } + if o.Password != nil { + toSerialize["password"] = o.Password + } + if o.Callback != nil { + toSerialize["callback"] = o.Callback + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *InlineObject3) UnmarshalJSON(bytes []byte) (err error) { + varInlineObject3 := _InlineObject3{} + + if err = json.Unmarshal(bytes, &varInlineObject3); err == nil { + *o = InlineObject3(varInlineObject3) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "integer") + delete(additionalProperties, "int32") + delete(additionalProperties, "int64") + delete(additionalProperties, "number") + delete(additionalProperties, "float") + delete(additionalProperties, "double") + delete(additionalProperties, "string") + delete(additionalProperties, "pattern_without_delimiter") + delete(additionalProperties, "byte") + delete(additionalProperties, "binary") + delete(additionalProperties, "date") + delete(additionalProperties, "dateTime") + delete(additionalProperties, "password") + delete(additionalProperties, "callback") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInlineObject3 struct { + value *InlineObject3 + isSet bool +} + +func (v NullableInlineObject3) Get() *InlineObject3 { + return v.value +} + +func (v *NullableInlineObject3) Set(val *InlineObject3) { + v.value = val + v.isSet = true +} + +func (v NullableInlineObject3) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineObject3) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineObject3(val *InlineObject3) *NullableInlineObject3 { + return &NullableInlineObject3{value: val, isSet: true} +} + +func (v NullableInlineObject3) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineObject3) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_4.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_4.go new file mode 100644 index 00000000000..bd624f9c4b5 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_4.go @@ -0,0 +1,164 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// InlineObject4 struct for InlineObject4 +type InlineObject4 struct { + // field1 + Param string `json:"param"` + // field2 + Param2 string `json:"param2"` + AdditionalProperties map[string]interface{} +} + +type _InlineObject4 InlineObject4 + +// NewInlineObject4 instantiates a new InlineObject4 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 NewInlineObject4(param string, param2 string, ) *InlineObject4 { + this := InlineObject4{} + this.Param = param + this.Param2 = param2 + return &this +} + +// NewInlineObject4WithDefaults instantiates a new InlineObject4 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 NewInlineObject4WithDefaults() *InlineObject4 { + this := InlineObject4{} + return &this +} + +// GetParam returns the Param field value +func (o *InlineObject4) GetParam() string { + if o == nil { + var ret string + return ret + } + + return o.Param +} + +// GetParamOk returns a tuple with the Param field value +// and a boolean to check if the value has been set. +func (o *InlineObject4) GetParamOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Param, true +} + +// SetParam sets field value +func (o *InlineObject4) SetParam(v string) { + o.Param = v +} + +// GetParam2 returns the Param2 field value +func (o *InlineObject4) GetParam2() string { + if o == nil { + var ret string + return ret + } + + return o.Param2 +} + +// GetParam2Ok returns a tuple with the Param2 field value +// and a boolean to check if the value has been set. +func (o *InlineObject4) GetParam2Ok() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Param2, true +} + +// SetParam2 sets field value +func (o *InlineObject4) SetParam2(v string) { + o.Param2 = v +} + +func (o InlineObject4) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["param"] = o.Param + } + if true { + toSerialize["param2"] = o.Param2 + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *InlineObject4) UnmarshalJSON(bytes []byte) (err error) { + varInlineObject4 := _InlineObject4{} + + if err = json.Unmarshal(bytes, &varInlineObject4); err == nil { + *o = InlineObject4(varInlineObject4) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "param") + delete(additionalProperties, "param2") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInlineObject4 struct { + value *InlineObject4 + isSet bool +} + +func (v NullableInlineObject4) Get() *InlineObject4 { + return v.value +} + +func (v *NullableInlineObject4) Set(val *InlineObject4) { + v.value = val + v.isSet = true +} + +func (v NullableInlineObject4) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineObject4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineObject4(val *InlineObject4) *NullableInlineObject4 { + return &NullableInlineObject4{value: val, isSet: true} +} + +func (v NullableInlineObject4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineObject4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_5.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_5.go new file mode 100644 index 00000000000..47fcc6e2e29 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_object_5.go @@ -0,0 +1,172 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "os" +) + +// InlineObject5 struct for InlineObject5 +type InlineObject5 struct { + // Additional data to pass to server + AdditionalMetadata *string `json:"additionalMetadata,omitempty"` + // file to upload + RequiredFile *os.File `json:"requiredFile"` + AdditionalProperties map[string]interface{} +} + +type _InlineObject5 InlineObject5 + +// NewInlineObject5 instantiates a new InlineObject5 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 NewInlineObject5(requiredFile *os.File, ) *InlineObject5 { + this := InlineObject5{} + this.RequiredFile = requiredFile + return &this +} + +// NewInlineObject5WithDefaults instantiates a new InlineObject5 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 NewInlineObject5WithDefaults() *InlineObject5 { + this := InlineObject5{} + return &this +} + +// GetAdditionalMetadata returns the AdditionalMetadata field value if set, zero value otherwise. +func (o *InlineObject5) GetAdditionalMetadata() string { + if o == nil || o.AdditionalMetadata == nil { + var ret string + return ret + } + return *o.AdditionalMetadata +} + +// GetAdditionalMetadataOk returns a tuple with the AdditionalMetadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineObject5) GetAdditionalMetadataOk() (*string, bool) { + if o == nil || o.AdditionalMetadata == nil { + return nil, false + } + return o.AdditionalMetadata, true +} + +// HasAdditionalMetadata returns a boolean if a field has been set. +func (o *InlineObject5) HasAdditionalMetadata() bool { + if o != nil && o.AdditionalMetadata != nil { + return true + } + + return false +} + +// SetAdditionalMetadata gets a reference to the given string and assigns it to the AdditionalMetadata field. +func (o *InlineObject5) SetAdditionalMetadata(v string) { + o.AdditionalMetadata = &v +} + +// GetRequiredFile returns the RequiredFile field value +func (o *InlineObject5) GetRequiredFile() *os.File { + if o == nil { + var ret *os.File + return ret + } + + return o.RequiredFile +} + +// GetRequiredFileOk returns a tuple with the RequiredFile field value +// and a boolean to check if the value has been set. +func (o *InlineObject5) GetRequiredFileOk() (**os.File, bool) { + if o == nil { + return nil, false + } + return &o.RequiredFile, true +} + +// SetRequiredFile sets field value +func (o *InlineObject5) SetRequiredFile(v *os.File) { + o.RequiredFile = v +} + +func (o InlineObject5) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.AdditionalMetadata != nil { + toSerialize["additionalMetadata"] = o.AdditionalMetadata + } + if true { + toSerialize["requiredFile"] = o.RequiredFile + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *InlineObject5) UnmarshalJSON(bytes []byte) (err error) { + varInlineObject5 := _InlineObject5{} + + if err = json.Unmarshal(bytes, &varInlineObject5); err == nil { + *o = InlineObject5(varInlineObject5) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "additionalMetadata") + delete(additionalProperties, "requiredFile") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInlineObject5 struct { + value *InlineObject5 + isSet bool +} + +func (v NullableInlineObject5) Get() *InlineObject5 { + return v.value +} + +func (v *NullableInlineObject5) Set(val *InlineObject5) { + v.value = val + v.isSet = true +} + +func (v NullableInlineObject5) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineObject5) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineObject5(val *InlineObject5) *NullableInlineObject5 { + return &NullableInlineObject5{value: val, isSet: true} +} + +func (v NullableInlineObject5) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineObject5) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_response_default.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_response_default.go new file mode 100644 index 00000000000..70e9023e731 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_inline_response_default.go @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// InlineResponseDefault struct for InlineResponseDefault +type InlineResponseDefault struct { + String *Foo `json:"string,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InlineResponseDefault InlineResponseDefault + +// NewInlineResponseDefault instantiates a new InlineResponseDefault 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 NewInlineResponseDefault() *InlineResponseDefault { + this := InlineResponseDefault{} + return &this +} + +// NewInlineResponseDefaultWithDefaults instantiates a new InlineResponseDefault 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 NewInlineResponseDefaultWithDefaults() *InlineResponseDefault { + this := InlineResponseDefault{} + return &this +} + +// GetString returns the String field value if set, zero value otherwise. +func (o *InlineResponseDefault) GetString() Foo { + if o == nil || o.String == nil { + var ret Foo + return ret + } + return *o.String +} + +// GetStringOk returns a tuple with the String field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InlineResponseDefault) GetStringOk() (*Foo, bool) { + if o == nil || o.String == nil { + return nil, false + } + return o.String, true +} + +// HasString returns a boolean if a field has been set. +func (o *InlineResponseDefault) HasString() bool { + if o != nil && o.String != nil { + return true + } + + return false +} + +// SetString gets a reference to the given Foo and assigns it to the String field. +func (o *InlineResponseDefault) SetString(v Foo) { + o.String = &v +} + +func (o InlineResponseDefault) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.String != nil { + toSerialize["string"] = o.String + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *InlineResponseDefault) UnmarshalJSON(bytes []byte) (err error) { + varInlineResponseDefault := _InlineResponseDefault{} + + if err = json.Unmarshal(bytes, &varInlineResponseDefault); err == nil { + *o = InlineResponseDefault(varInlineResponseDefault) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "string") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInlineResponseDefault struct { + value *InlineResponseDefault + isSet bool +} + +func (v NullableInlineResponseDefault) Get() *InlineResponseDefault { + return v.value +} + +func (v *NullableInlineResponseDefault) Set(val *InlineResponseDefault) { + v.value = val + v.isSet = true +} + +func (v NullableInlineResponseDefault) IsSet() bool { + return v.isSet +} + +func (v *NullableInlineResponseDefault) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInlineResponseDefault(val *InlineResponseDefault) *NullableInlineResponseDefault { + return &NullableInlineResponseDefault{value: val, isSet: true} +} + +func (v NullableInlineResponseDefault) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInlineResponseDefault) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_list.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_list.go new file mode 100644 index 00000000000..565452b2067 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_list.go @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// List struct for List +type List struct { + Var123List *string `json:"123-list,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _List List + +// NewList instantiates a new List 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 NewList() *List { + this := List{} + return &this +} + +// NewListWithDefaults instantiates a new List 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 NewListWithDefaults() *List { + this := List{} + return &this +} + +// GetVar123List returns the Var123List field value if set, zero value otherwise. +func (o *List) GetVar123List() string { + if o == nil || o.Var123List == nil { + var ret string + return ret + } + return *o.Var123List +} + +// GetVar123ListOk returns a tuple with the Var123List field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *List) GetVar123ListOk() (*string, bool) { + if o == nil || o.Var123List == nil { + return nil, false + } + return o.Var123List, true +} + +// HasVar123List returns a boolean if a field has been set. +func (o *List) HasVar123List() bool { + if o != nil && o.Var123List != nil { + return true + } + + return false +} + +// SetVar123List gets a reference to the given string and assigns it to the Var123List field. +func (o *List) SetVar123List(v string) { + o.Var123List = &v +} + +func (o List) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Var123List != nil { + toSerialize["123-list"] = o.Var123List + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *List) UnmarshalJSON(bytes []byte) (err error) { + varList := _List{} + + if err = json.Unmarshal(bytes, &varList); err == nil { + *o = List(varList) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "123-list") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableList struct { + value *List + isSet bool +} + +func (v NullableList) Get() *List { + return v.value +} + +func (v *NullableList) Set(val *List) { + v.value = val + v.isSet = true +} + +func (v NullableList) IsSet() bool { + return v.isSet +} + +func (v *NullableList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableList(val *List) *NullableList { + return &NullableList{value: val, isSet: true} +} + +func (v NullableList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_mammal.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_mammal.go new file mode 100644 index 00000000000..49d5dfdfe2a --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_mammal.go @@ -0,0 +1,140 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "fmt" +) + +// Mammal - struct for Mammal +type Mammal struct { + Whale *Whale + Zebra *Zebra +} + +// WhaleAsMammal is a convenience function that returns Whale wrapped in Mammal +func WhaleAsMammal(v *Whale) Mammal { + return Mammal{ Whale: v} +} + +// ZebraAsMammal is a convenience function that returns Zebra wrapped in Mammal +func ZebraAsMammal(v *Zebra) Mammal { + return Mammal{ Zebra: v} +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *Mammal) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into Whale + err = json.Unmarshal(data, &dst.Whale) + if err == nil { + jsonWhale, _ := json.Marshal(dst.Whale) + if string(jsonWhale) == "{}" { // empty struct + dst.Whale = nil + } else { + match++ + } + } else { + dst.Whale = nil + } + + // try to unmarshal data into Zebra + err = json.Unmarshal(data, &dst.Zebra) + if err == nil { + jsonZebra, _ := json.Marshal(dst.Zebra) + if string(jsonZebra) == "{}" { // empty struct + dst.Zebra = nil + } else { + match++ + } + } else { + dst.Zebra = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.Whale = nil + dst.Zebra = nil + + return fmt.Errorf("Data matches more than one schema in oneOf(Mammal)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("Data failed to match schemas in oneOf(Mammal)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src Mammal) MarshalJSON() ([]byte, error) { + if src.Whale != nil { + return json.Marshal(&src.Whale) + } + + if src.Zebra != nil { + return json.Marshal(&src.Zebra) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *Mammal) GetActualInstance() (interface{}) { + if obj.Whale != nil { + return obj.Whale + } + + if obj.Zebra != nil { + return obj.Zebra + } + + // all schemas are nil + return nil +} + +type NullableMammal struct { + value *Mammal + isSet bool +} + +func (v NullableMammal) Get() *Mammal { + return v.value +} + +func (v *NullableMammal) Set(val *Mammal) { + v.value = val + v.isSet = true +} + +func (v NullableMammal) IsSet() bool { + return v.isSet +} + +func (v *NullableMammal) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMammal(val *Mammal) *NullableMammal { + return &NullableMammal{value: val, isSet: true} +} + +func (v NullableMammal) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMammal) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_map_test_.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_map_test_.go new file mode 100644 index 00000000000..7bd5860170b --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_map_test_.go @@ -0,0 +1,250 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// MapTest struct for MapTest +type MapTest struct { + MapMapOfString *map[string]map[string]string `json:"map_map_of_string,omitempty"` + MapOfEnumString *map[string]string `json:"map_of_enum_string,omitempty"` + DirectMap *map[string]bool `json:"direct_map,omitempty"` + IndirectMap *map[string]bool `json:"indirect_map,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MapTest MapTest + +// NewMapTest instantiates a new MapTest 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 NewMapTest() *MapTest { + this := MapTest{} + return &this +} + +// NewMapTestWithDefaults instantiates a new MapTest 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 NewMapTestWithDefaults() *MapTest { + this := MapTest{} + return &this +} + +// GetMapMapOfString returns the MapMapOfString field value if set, zero value otherwise. +func (o *MapTest) GetMapMapOfString() map[string]map[string]string { + if o == nil || o.MapMapOfString == nil { + var ret map[string]map[string]string + return ret + } + return *o.MapMapOfString +} + +// GetMapMapOfStringOk returns a tuple with the MapMapOfString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MapTest) GetMapMapOfStringOk() (*map[string]map[string]string, bool) { + if o == nil || o.MapMapOfString == nil { + return nil, false + } + return o.MapMapOfString, true +} + +// HasMapMapOfString returns a boolean if a field has been set. +func (o *MapTest) HasMapMapOfString() bool { + if o != nil && o.MapMapOfString != nil { + return true + } + + return false +} + +// SetMapMapOfString gets a reference to the given map[string]map[string]string and assigns it to the MapMapOfString field. +func (o *MapTest) SetMapMapOfString(v map[string]map[string]string) { + o.MapMapOfString = &v +} + +// GetMapOfEnumString returns the MapOfEnumString field value if set, zero value otherwise. +func (o *MapTest) GetMapOfEnumString() map[string]string { + if o == nil || o.MapOfEnumString == nil { + var ret map[string]string + return ret + } + return *o.MapOfEnumString +} + +// GetMapOfEnumStringOk returns a tuple with the MapOfEnumString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MapTest) GetMapOfEnumStringOk() (*map[string]string, bool) { + if o == nil || o.MapOfEnumString == nil { + return nil, false + } + return o.MapOfEnumString, true +} + +// HasMapOfEnumString returns a boolean if a field has been set. +func (o *MapTest) HasMapOfEnumString() bool { + if o != nil && o.MapOfEnumString != nil { + return true + } + + return false +} + +// SetMapOfEnumString gets a reference to the given map[string]string and assigns it to the MapOfEnumString field. +func (o *MapTest) SetMapOfEnumString(v map[string]string) { + o.MapOfEnumString = &v +} + +// GetDirectMap returns the DirectMap field value if set, zero value otherwise. +func (o *MapTest) GetDirectMap() map[string]bool { + if o == nil || o.DirectMap == nil { + var ret map[string]bool + return ret + } + return *o.DirectMap +} + +// GetDirectMapOk returns a tuple with the DirectMap field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MapTest) GetDirectMapOk() (*map[string]bool, bool) { + if o == nil || o.DirectMap == nil { + return nil, false + } + return o.DirectMap, true +} + +// HasDirectMap returns a boolean if a field has been set. +func (o *MapTest) HasDirectMap() bool { + if o != nil && o.DirectMap != nil { + return true + } + + return false +} + +// SetDirectMap gets a reference to the given map[string]bool and assigns it to the DirectMap field. +func (o *MapTest) SetDirectMap(v map[string]bool) { + o.DirectMap = &v +} + +// GetIndirectMap returns the IndirectMap field value if set, zero value otherwise. +func (o *MapTest) GetIndirectMap() map[string]bool { + if o == nil || o.IndirectMap == nil { + var ret map[string]bool + return ret + } + return *o.IndirectMap +} + +// GetIndirectMapOk returns a tuple with the IndirectMap field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MapTest) GetIndirectMapOk() (*map[string]bool, bool) { + if o == nil || o.IndirectMap == nil { + return nil, false + } + return o.IndirectMap, true +} + +// HasIndirectMap returns a boolean if a field has been set. +func (o *MapTest) HasIndirectMap() bool { + if o != nil && o.IndirectMap != nil { + return true + } + + return false +} + +// SetIndirectMap gets a reference to the given map[string]bool and assigns it to the IndirectMap field. +func (o *MapTest) SetIndirectMap(v map[string]bool) { + o.IndirectMap = &v +} + +func (o MapTest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.MapMapOfString != nil { + toSerialize["map_map_of_string"] = o.MapMapOfString + } + if o.MapOfEnumString != nil { + toSerialize["map_of_enum_string"] = o.MapOfEnumString + } + if o.DirectMap != nil { + toSerialize["direct_map"] = o.DirectMap + } + if o.IndirectMap != nil { + toSerialize["indirect_map"] = o.IndirectMap + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *MapTest) UnmarshalJSON(bytes []byte) (err error) { + varMapTest := _MapTest{} + + if err = json.Unmarshal(bytes, &varMapTest); err == nil { + *o = MapTest(varMapTest) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "map_map_of_string") + delete(additionalProperties, "map_of_enum_string") + delete(additionalProperties, "direct_map") + delete(additionalProperties, "indirect_map") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMapTest struct { + value *MapTest + isSet bool +} + +func (v NullableMapTest) Get() *MapTest { + return v.value +} + +func (v *NullableMapTest) Set(val *MapTest) { + v.value = val + v.isSet = true +} + +func (v NullableMapTest) IsSet() bool { + return v.isSet +} + +func (v *NullableMapTest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMapTest(val *MapTest) *NullableMapTest { + return &NullableMapTest{value: val, isSet: true} +} + +func (v NullableMapTest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMapTest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_mixed_properties_and_additional_properties_class.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_mixed_properties_and_additional_properties_class.go new file mode 100644 index 00000000000..752ccff41ea --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_mixed_properties_and_additional_properties_class.go @@ -0,0 +1,214 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "time" +) + +// MixedPropertiesAndAdditionalPropertiesClass struct for MixedPropertiesAndAdditionalPropertiesClass +type MixedPropertiesAndAdditionalPropertiesClass struct { + Uuid *string `json:"uuid,omitempty"` + DateTime *time.Time `json:"dateTime,omitempty"` + Map *map[string]Animal `json:"map,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MixedPropertiesAndAdditionalPropertiesClass MixedPropertiesAndAdditionalPropertiesClass + +// NewMixedPropertiesAndAdditionalPropertiesClass instantiates a new MixedPropertiesAndAdditionalPropertiesClass 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 NewMixedPropertiesAndAdditionalPropertiesClass() *MixedPropertiesAndAdditionalPropertiesClass { + this := MixedPropertiesAndAdditionalPropertiesClass{} + return &this +} + +// NewMixedPropertiesAndAdditionalPropertiesClassWithDefaults instantiates a new MixedPropertiesAndAdditionalPropertiesClass 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 NewMixedPropertiesAndAdditionalPropertiesClassWithDefaults() *MixedPropertiesAndAdditionalPropertiesClass { + this := MixedPropertiesAndAdditionalPropertiesClass{} + return &this +} + +// GetUuid returns the Uuid field value if set, zero value otherwise. +func (o *MixedPropertiesAndAdditionalPropertiesClass) GetUuid() string { + if o == nil || o.Uuid == nil { + var ret string + return ret + } + return *o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MixedPropertiesAndAdditionalPropertiesClass) GetUuidOk() (*string, bool) { + if o == nil || o.Uuid == nil { + return nil, false + } + return o.Uuid, true +} + +// HasUuid returns a boolean if a field has been set. +func (o *MixedPropertiesAndAdditionalPropertiesClass) HasUuid() bool { + if o != nil && o.Uuid != nil { + return true + } + + return false +} + +// SetUuid gets a reference to the given string and assigns it to the Uuid field. +func (o *MixedPropertiesAndAdditionalPropertiesClass) SetUuid(v string) { + o.Uuid = &v +} + +// GetDateTime returns the DateTime field value if set, zero value otherwise. +func (o *MixedPropertiesAndAdditionalPropertiesClass) GetDateTime() time.Time { + if o == nil || o.DateTime == nil { + var ret time.Time + return ret + } + return *o.DateTime +} + +// GetDateTimeOk returns a tuple with the DateTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MixedPropertiesAndAdditionalPropertiesClass) GetDateTimeOk() (*time.Time, bool) { + if o == nil || o.DateTime == nil { + return nil, false + } + return o.DateTime, true +} + +// HasDateTime returns a boolean if a field has been set. +func (o *MixedPropertiesAndAdditionalPropertiesClass) HasDateTime() bool { + if o != nil && o.DateTime != nil { + return true + } + + return false +} + +// SetDateTime gets a reference to the given time.Time and assigns it to the DateTime field. +func (o *MixedPropertiesAndAdditionalPropertiesClass) SetDateTime(v time.Time) { + o.DateTime = &v +} + +// GetMap returns the Map field value if set, zero value otherwise. +func (o *MixedPropertiesAndAdditionalPropertiesClass) GetMap() map[string]Animal { + if o == nil || o.Map == nil { + var ret map[string]Animal + return ret + } + return *o.Map +} + +// GetMapOk returns a tuple with the Map field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MixedPropertiesAndAdditionalPropertiesClass) GetMapOk() (*map[string]Animal, bool) { + if o == nil || o.Map == nil { + return nil, false + } + return o.Map, true +} + +// HasMap returns a boolean if a field has been set. +func (o *MixedPropertiesAndAdditionalPropertiesClass) HasMap() bool { + if o != nil && o.Map != nil { + return true + } + + return false +} + +// SetMap gets a reference to the given map[string]Animal and assigns it to the Map field. +func (o *MixedPropertiesAndAdditionalPropertiesClass) SetMap(v map[string]Animal) { + o.Map = &v +} + +func (o MixedPropertiesAndAdditionalPropertiesClass) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Uuid != nil { + toSerialize["uuid"] = o.Uuid + } + if o.DateTime != nil { + toSerialize["dateTime"] = o.DateTime + } + if o.Map != nil { + toSerialize["map"] = o.Map + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *MixedPropertiesAndAdditionalPropertiesClass) UnmarshalJSON(bytes []byte) (err error) { + varMixedPropertiesAndAdditionalPropertiesClass := _MixedPropertiesAndAdditionalPropertiesClass{} + + if err = json.Unmarshal(bytes, &varMixedPropertiesAndAdditionalPropertiesClass); err == nil { + *o = MixedPropertiesAndAdditionalPropertiesClass(varMixedPropertiesAndAdditionalPropertiesClass) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "uuid") + delete(additionalProperties, "dateTime") + delete(additionalProperties, "map") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMixedPropertiesAndAdditionalPropertiesClass struct { + value *MixedPropertiesAndAdditionalPropertiesClass + isSet bool +} + +func (v NullableMixedPropertiesAndAdditionalPropertiesClass) Get() *MixedPropertiesAndAdditionalPropertiesClass { + return v.value +} + +func (v *NullableMixedPropertiesAndAdditionalPropertiesClass) Set(val *MixedPropertiesAndAdditionalPropertiesClass) { + v.value = val + v.isSet = true +} + +func (v NullableMixedPropertiesAndAdditionalPropertiesClass) IsSet() bool { + return v.isSet +} + +func (v *NullableMixedPropertiesAndAdditionalPropertiesClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMixedPropertiesAndAdditionalPropertiesClass(val *MixedPropertiesAndAdditionalPropertiesClass) *NullableMixedPropertiesAndAdditionalPropertiesClass { + return &NullableMixedPropertiesAndAdditionalPropertiesClass{value: val, isSet: true} +} + +func (v NullableMixedPropertiesAndAdditionalPropertiesClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMixedPropertiesAndAdditionalPropertiesClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_name.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_name.go new file mode 100644 index 00000000000..c66130c5bf3 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_name.go @@ -0,0 +1,243 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Name Model for testing model name same as property name +type Name struct { + Name int32 `json:"name"` + SnakeCase *int32 `json:"snake_case,omitempty"` + Property *string `json:"property,omitempty"` + Var123Number *int32 `json:"123Number,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Name Name + +// NewName instantiates a new Name 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 NewName(name int32, ) *Name { + this := Name{} + this.Name = name + return &this +} + +// NewNameWithDefaults instantiates a new Name 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 NewNameWithDefaults() *Name { + this := Name{} + return &this +} + +// GetName returns the Name field value +func (o *Name) GetName() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Name) GetNameOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Name) SetName(v int32) { + o.Name = v +} + +// GetSnakeCase returns the SnakeCase field value if set, zero value otherwise. +func (o *Name) GetSnakeCase() int32 { + if o == nil || o.SnakeCase == nil { + var ret int32 + return ret + } + return *o.SnakeCase +} + +// GetSnakeCaseOk returns a tuple with the SnakeCase field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Name) GetSnakeCaseOk() (*int32, bool) { + if o == nil || o.SnakeCase == nil { + return nil, false + } + return o.SnakeCase, true +} + +// HasSnakeCase returns a boolean if a field has been set. +func (o *Name) HasSnakeCase() bool { + if o != nil && o.SnakeCase != nil { + return true + } + + return false +} + +// SetSnakeCase gets a reference to the given int32 and assigns it to the SnakeCase field. +func (o *Name) SetSnakeCase(v int32) { + o.SnakeCase = &v +} + +// GetProperty returns the Property field value if set, zero value otherwise. +func (o *Name) GetProperty() string { + if o == nil || o.Property == nil { + var ret string + return ret + } + return *o.Property +} + +// GetPropertyOk returns a tuple with the Property field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Name) GetPropertyOk() (*string, bool) { + if o == nil || o.Property == nil { + return nil, false + } + return o.Property, true +} + +// HasProperty returns a boolean if a field has been set. +func (o *Name) HasProperty() bool { + if o != nil && o.Property != nil { + return true + } + + return false +} + +// SetProperty gets a reference to the given string and assigns it to the Property field. +func (o *Name) SetProperty(v string) { + o.Property = &v +} + +// GetVar123Number returns the Var123Number field value if set, zero value otherwise. +func (o *Name) GetVar123Number() int32 { + if o == nil || o.Var123Number == nil { + var ret int32 + return ret + } + return *o.Var123Number +} + +// GetVar123NumberOk returns a tuple with the Var123Number field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Name) GetVar123NumberOk() (*int32, bool) { + if o == nil || o.Var123Number == nil { + return nil, false + } + return o.Var123Number, true +} + +// HasVar123Number returns a boolean if a field has been set. +func (o *Name) HasVar123Number() bool { + if o != nil && o.Var123Number != nil { + return true + } + + return false +} + +// SetVar123Number gets a reference to the given int32 and assigns it to the Var123Number field. +func (o *Name) SetVar123Number(v int32) { + o.Var123Number = &v +} + +func (o Name) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["name"] = o.Name + } + if o.SnakeCase != nil { + toSerialize["snake_case"] = o.SnakeCase + } + if o.Property != nil { + toSerialize["property"] = o.Property + } + if o.Var123Number != nil { + toSerialize["123Number"] = o.Var123Number + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Name) UnmarshalJSON(bytes []byte) (err error) { + varName := _Name{} + + if err = json.Unmarshal(bytes, &varName); err == nil { + *o = Name(varName) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "snake_case") + delete(additionalProperties, "property") + delete(additionalProperties, "123Number") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableName struct { + value *Name + isSet bool +} + +func (v NullableName) Get() *Name { + return v.value +} + +func (v *NullableName) Set(val *Name) { + v.value = val + v.isSet = true +} + +func (v NullableName) IsSet() bool { + return v.isSet +} + +func (v *NullableName) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableName(val *Name) *NullableName { + return &NullableName{value: val, isSet: true} +} + +func (v NullableName) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableName) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_nullable_class.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_nullable_class.go new file mode 100644 index 00000000000..72deb6ecf44 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_nullable_class.go @@ -0,0 +1,575 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "time" +) + +// NullableClass struct for NullableClass +type NullableClass struct { + IntegerProp NullableInt32 `json:"integer_prop,omitempty"` + NumberProp NullableFloat32 `json:"number_prop,omitempty"` + BooleanProp NullableBool `json:"boolean_prop,omitempty"` + StringProp NullableString `json:"string_prop,omitempty"` + DateProp NullableString `json:"date_prop,omitempty"` + DatetimeProp NullableTime `json:"datetime_prop,omitempty"` + ArrayNullableProp []map[string]interface{} `json:"array_nullable_prop,omitempty"` + ArrayAndItemsNullableProp []map[string]interface{} `json:"array_and_items_nullable_prop,omitempty"` + ArrayItemsNullable *[]map[string]interface{} `json:"array_items_nullable,omitempty"` + ObjectNullableProp map[string]map[string]interface{} `json:"object_nullable_prop,omitempty"` + ObjectAndItemsNullableProp map[string]map[string]interface{} `json:"object_and_items_nullable_prop,omitempty"` + ObjectItemsNullable *map[string]map[string]interface{} `json:"object_items_nullable,omitempty"` +} + +// NewNullableClass instantiates a new NullableClass 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 NewNullableClass() *NullableClass { + this := NullableClass{} + return &this +} + +// NewNullableClassWithDefaults instantiates a new NullableClass 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 NewNullableClassWithDefaults() *NullableClass { + this := NullableClass{} + return &this +} + +// GetIntegerProp returns the IntegerProp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NullableClass) GetIntegerProp() int32 { + if o == nil || o.IntegerProp.Get() == nil { + var ret int32 + return ret + } + return *o.IntegerProp.Get() +} + +// GetIntegerPropOk returns a tuple with the IntegerProp field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullableClass) GetIntegerPropOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.IntegerProp.Get(), o.IntegerProp.IsSet() +} + +// HasIntegerProp returns a boolean if a field has been set. +func (o *NullableClass) HasIntegerProp() bool { + if o != nil && o.IntegerProp.IsSet() { + return true + } + + return false +} + +// SetIntegerProp gets a reference to the given NullableInt32 and assigns it to the IntegerProp field. +func (o *NullableClass) SetIntegerProp(v int32) { + o.IntegerProp.Set(&v) +} +// SetIntegerPropNil sets the value for IntegerProp to be an explicit nil +func (o *NullableClass) SetIntegerPropNil() { + o.IntegerProp.Set(nil) +} + +// UnsetIntegerProp ensures that no value is present for IntegerProp, not even an explicit nil +func (o *NullableClass) UnsetIntegerProp() { + o.IntegerProp.Unset() +} + +// GetNumberProp returns the NumberProp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NullableClass) GetNumberProp() float32 { + if o == nil || o.NumberProp.Get() == nil { + var ret float32 + return ret + } + return *o.NumberProp.Get() +} + +// GetNumberPropOk returns a tuple with the NumberProp field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullableClass) GetNumberPropOk() (*float32, bool) { + if o == nil { + return nil, false + } + return o.NumberProp.Get(), o.NumberProp.IsSet() +} + +// HasNumberProp returns a boolean if a field has been set. +func (o *NullableClass) HasNumberProp() bool { + if o != nil && o.NumberProp.IsSet() { + return true + } + + return false +} + +// SetNumberProp gets a reference to the given NullableFloat32 and assigns it to the NumberProp field. +func (o *NullableClass) SetNumberProp(v float32) { + o.NumberProp.Set(&v) +} +// SetNumberPropNil sets the value for NumberProp to be an explicit nil +func (o *NullableClass) SetNumberPropNil() { + o.NumberProp.Set(nil) +} + +// UnsetNumberProp ensures that no value is present for NumberProp, not even an explicit nil +func (o *NullableClass) UnsetNumberProp() { + o.NumberProp.Unset() +} + +// GetBooleanProp returns the BooleanProp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NullableClass) GetBooleanProp() bool { + if o == nil || o.BooleanProp.Get() == nil { + var ret bool + return ret + } + return *o.BooleanProp.Get() +} + +// GetBooleanPropOk returns a tuple with the BooleanProp field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullableClass) GetBooleanPropOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.BooleanProp.Get(), o.BooleanProp.IsSet() +} + +// HasBooleanProp returns a boolean if a field has been set. +func (o *NullableClass) HasBooleanProp() bool { + if o != nil && o.BooleanProp.IsSet() { + return true + } + + return false +} + +// SetBooleanProp gets a reference to the given NullableBool and assigns it to the BooleanProp field. +func (o *NullableClass) SetBooleanProp(v bool) { + o.BooleanProp.Set(&v) +} +// SetBooleanPropNil sets the value for BooleanProp to be an explicit nil +func (o *NullableClass) SetBooleanPropNil() { + o.BooleanProp.Set(nil) +} + +// UnsetBooleanProp ensures that no value is present for BooleanProp, not even an explicit nil +func (o *NullableClass) UnsetBooleanProp() { + o.BooleanProp.Unset() +} + +// GetStringProp returns the StringProp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NullableClass) GetStringProp() string { + if o == nil || o.StringProp.Get() == nil { + var ret string + return ret + } + return *o.StringProp.Get() +} + +// GetStringPropOk returns a tuple with the StringProp field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullableClass) GetStringPropOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.StringProp.Get(), o.StringProp.IsSet() +} + +// HasStringProp returns a boolean if a field has been set. +func (o *NullableClass) HasStringProp() bool { + if o != nil && o.StringProp.IsSet() { + return true + } + + return false +} + +// SetStringProp gets a reference to the given NullableString and assigns it to the StringProp field. +func (o *NullableClass) SetStringProp(v string) { + o.StringProp.Set(&v) +} +// SetStringPropNil sets the value for StringProp to be an explicit nil +func (o *NullableClass) SetStringPropNil() { + o.StringProp.Set(nil) +} + +// UnsetStringProp ensures that no value is present for StringProp, not even an explicit nil +func (o *NullableClass) UnsetStringProp() { + o.StringProp.Unset() +} + +// GetDateProp returns the DateProp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NullableClass) GetDateProp() string { + if o == nil || o.DateProp.Get() == nil { + var ret string + return ret + } + return *o.DateProp.Get() +} + +// GetDatePropOk returns a tuple with the DateProp field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullableClass) GetDatePropOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DateProp.Get(), o.DateProp.IsSet() +} + +// HasDateProp returns a boolean if a field has been set. +func (o *NullableClass) HasDateProp() bool { + if o != nil && o.DateProp.IsSet() { + return true + } + + return false +} + +// SetDateProp gets a reference to the given NullableString and assigns it to the DateProp field. +func (o *NullableClass) SetDateProp(v string) { + o.DateProp.Set(&v) +} +// SetDatePropNil sets the value for DateProp to be an explicit nil +func (o *NullableClass) SetDatePropNil() { + o.DateProp.Set(nil) +} + +// UnsetDateProp ensures that no value is present for DateProp, not even an explicit nil +func (o *NullableClass) UnsetDateProp() { + o.DateProp.Unset() +} + +// GetDatetimeProp returns the DatetimeProp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NullableClass) GetDatetimeProp() time.Time { + if o == nil || o.DatetimeProp.Get() == nil { + var ret time.Time + return ret + } + return *o.DatetimeProp.Get() +} + +// GetDatetimePropOk returns a tuple with the DatetimeProp field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullableClass) GetDatetimePropOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.DatetimeProp.Get(), o.DatetimeProp.IsSet() +} + +// HasDatetimeProp returns a boolean if a field has been set. +func (o *NullableClass) HasDatetimeProp() bool { + if o != nil && o.DatetimeProp.IsSet() { + return true + } + + return false +} + +// SetDatetimeProp gets a reference to the given NullableTime and assigns it to the DatetimeProp field. +func (o *NullableClass) SetDatetimeProp(v time.Time) { + o.DatetimeProp.Set(&v) +} +// SetDatetimePropNil sets the value for DatetimeProp to be an explicit nil +func (o *NullableClass) SetDatetimePropNil() { + o.DatetimeProp.Set(nil) +} + +// UnsetDatetimeProp ensures that no value is present for DatetimeProp, not even an explicit nil +func (o *NullableClass) UnsetDatetimeProp() { + o.DatetimeProp.Unset() +} + +// GetArrayNullableProp returns the ArrayNullableProp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NullableClass) GetArrayNullableProp() []map[string]interface{} { + if o == nil { + var ret []map[string]interface{} + return ret + } + return o.ArrayNullableProp +} + +// GetArrayNullablePropOk returns a tuple with the ArrayNullableProp field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullableClass) GetArrayNullablePropOk() (*[]map[string]interface{}, bool) { + if o == nil || o.ArrayNullableProp == nil { + return nil, false + } + return &o.ArrayNullableProp, true +} + +// HasArrayNullableProp returns a boolean if a field has been set. +func (o *NullableClass) HasArrayNullableProp() bool { + if o != nil && o.ArrayNullableProp != nil { + return true + } + + return false +} + +// SetArrayNullableProp gets a reference to the given []map[string]interface{} and assigns it to the ArrayNullableProp field. +func (o *NullableClass) SetArrayNullableProp(v []map[string]interface{}) { + o.ArrayNullableProp = v +} + +// GetArrayAndItemsNullableProp returns the ArrayAndItemsNullableProp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NullableClass) GetArrayAndItemsNullableProp() []map[string]interface{} { + if o == nil { + var ret []map[string]interface{} + return ret + } + return o.ArrayAndItemsNullableProp +} + +// GetArrayAndItemsNullablePropOk returns a tuple with the ArrayAndItemsNullableProp field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullableClass) GetArrayAndItemsNullablePropOk() (*[]map[string]interface{}, bool) { + if o == nil || o.ArrayAndItemsNullableProp == nil { + return nil, false + } + return &o.ArrayAndItemsNullableProp, true +} + +// HasArrayAndItemsNullableProp returns a boolean if a field has been set. +func (o *NullableClass) HasArrayAndItemsNullableProp() bool { + if o != nil && o.ArrayAndItemsNullableProp != nil { + return true + } + + return false +} + +// SetArrayAndItemsNullableProp gets a reference to the given []map[string]interface{} and assigns it to the ArrayAndItemsNullableProp field. +func (o *NullableClass) SetArrayAndItemsNullableProp(v []map[string]interface{}) { + o.ArrayAndItemsNullableProp = v +} + +// GetArrayItemsNullable returns the ArrayItemsNullable field value if set, zero value otherwise. +func (o *NullableClass) GetArrayItemsNullable() []map[string]interface{} { + if o == nil || o.ArrayItemsNullable == nil { + var ret []map[string]interface{} + return ret + } + return *o.ArrayItemsNullable +} + +// GetArrayItemsNullableOk returns a tuple with the ArrayItemsNullable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NullableClass) GetArrayItemsNullableOk() (*[]map[string]interface{}, bool) { + if o == nil || o.ArrayItemsNullable == nil { + return nil, false + } + return o.ArrayItemsNullable, true +} + +// HasArrayItemsNullable returns a boolean if a field has been set. +func (o *NullableClass) HasArrayItemsNullable() bool { + if o != nil && o.ArrayItemsNullable != nil { + return true + } + + return false +} + +// SetArrayItemsNullable gets a reference to the given []map[string]interface{} and assigns it to the ArrayItemsNullable field. +func (o *NullableClass) SetArrayItemsNullable(v []map[string]interface{}) { + o.ArrayItemsNullable = &v +} + +// GetObjectNullableProp returns the ObjectNullableProp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NullableClass) GetObjectNullableProp() map[string]map[string]interface{} { + if o == nil { + var ret map[string]map[string]interface{} + return ret + } + return o.ObjectNullableProp +} + +// GetObjectNullablePropOk returns a tuple with the ObjectNullableProp field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullableClass) GetObjectNullablePropOk() (*map[string]map[string]interface{}, bool) { + if o == nil || o.ObjectNullableProp == nil { + return nil, false + } + return &o.ObjectNullableProp, true +} + +// HasObjectNullableProp returns a boolean if a field has been set. +func (o *NullableClass) HasObjectNullableProp() bool { + if o != nil && o.ObjectNullableProp != nil { + return true + } + + return false +} + +// SetObjectNullableProp gets a reference to the given map[string]map[string]interface{} and assigns it to the ObjectNullableProp field. +func (o *NullableClass) SetObjectNullableProp(v map[string]map[string]interface{}) { + o.ObjectNullableProp = v +} + +// GetObjectAndItemsNullableProp returns the ObjectAndItemsNullableProp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NullableClass) GetObjectAndItemsNullableProp() map[string]map[string]interface{} { + if o == nil { + var ret map[string]map[string]interface{} + return ret + } + return o.ObjectAndItemsNullableProp +} + +// GetObjectAndItemsNullablePropOk returns a tuple with the ObjectAndItemsNullableProp field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullableClass) GetObjectAndItemsNullablePropOk() (*map[string]map[string]interface{}, bool) { + if o == nil || o.ObjectAndItemsNullableProp == nil { + return nil, false + } + return &o.ObjectAndItemsNullableProp, true +} + +// HasObjectAndItemsNullableProp returns a boolean if a field has been set. +func (o *NullableClass) HasObjectAndItemsNullableProp() bool { + if o != nil && o.ObjectAndItemsNullableProp != nil { + return true + } + + return false +} + +// SetObjectAndItemsNullableProp gets a reference to the given map[string]map[string]interface{} and assigns it to the ObjectAndItemsNullableProp field. +func (o *NullableClass) SetObjectAndItemsNullableProp(v map[string]map[string]interface{}) { + o.ObjectAndItemsNullableProp = v +} + +// GetObjectItemsNullable returns the ObjectItemsNullable field value if set, zero value otherwise. +func (o *NullableClass) GetObjectItemsNullable() map[string]map[string]interface{} { + if o == nil || o.ObjectItemsNullable == nil { + var ret map[string]map[string]interface{} + return ret + } + return *o.ObjectItemsNullable +} + +// GetObjectItemsNullableOk returns a tuple with the ObjectItemsNullable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NullableClass) GetObjectItemsNullableOk() (*map[string]map[string]interface{}, bool) { + if o == nil || o.ObjectItemsNullable == nil { + return nil, false + } + return o.ObjectItemsNullable, true +} + +// HasObjectItemsNullable returns a boolean if a field has been set. +func (o *NullableClass) HasObjectItemsNullable() bool { + if o != nil && o.ObjectItemsNullable != nil { + return true + } + + return false +} + +// SetObjectItemsNullable gets a reference to the given map[string]map[string]interface{} and assigns it to the ObjectItemsNullable field. +func (o *NullableClass) SetObjectItemsNullable(v map[string]map[string]interface{}) { + o.ObjectItemsNullable = &v +} + +func (o NullableClass) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.IntegerProp.IsSet() { + toSerialize["integer_prop"] = o.IntegerProp.Get() + } + if o.NumberProp.IsSet() { + toSerialize["number_prop"] = o.NumberProp.Get() + } + if o.BooleanProp.IsSet() { + toSerialize["boolean_prop"] = o.BooleanProp.Get() + } + if o.StringProp.IsSet() { + toSerialize["string_prop"] = o.StringProp.Get() + } + if o.DateProp.IsSet() { + toSerialize["date_prop"] = o.DateProp.Get() + } + if o.DatetimeProp.IsSet() { + toSerialize["datetime_prop"] = o.DatetimeProp.Get() + } + if o.ArrayNullableProp != nil { + toSerialize["array_nullable_prop"] = o.ArrayNullableProp + } + if o.ArrayAndItemsNullableProp != nil { + toSerialize["array_and_items_nullable_prop"] = o.ArrayAndItemsNullableProp + } + if o.ArrayItemsNullable != nil { + toSerialize["array_items_nullable"] = o.ArrayItemsNullable + } + if o.ObjectNullableProp != nil { + toSerialize["object_nullable_prop"] = o.ObjectNullableProp + } + if o.ObjectAndItemsNullableProp != nil { + toSerialize["object_and_items_nullable_prop"] = o.ObjectAndItemsNullableProp + } + if o.ObjectItemsNullable != nil { + toSerialize["object_items_nullable"] = o.ObjectItemsNullable + } + return json.Marshal(toSerialize) +} + +type NullableNullableClass struct { + value *NullableClass + isSet bool +} + +func (v NullableNullableClass) Get() *NullableClass { + return v.value +} + +func (v *NullableNullableClass) Set(val *NullableClass) { + v.value = val + v.isSet = true +} + +func (v NullableNullableClass) IsSet() bool { + return v.isSet +} + +func (v *NullableNullableClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNullableClass(val *NullableClass) *NullableNullableClass { + return &NullableNullableClass{value: val, isSet: true} +} + +func (v NullableNullableClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNullableClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_number_only.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_number_only.go new file mode 100644 index 00000000000..a0a6f01be08 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_number_only.go @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// NumberOnly struct for NumberOnly +type NumberOnly struct { + JustNumber *float32 `json:"JustNumber,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _NumberOnly NumberOnly + +// NewNumberOnly instantiates a new NumberOnly 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 NewNumberOnly() *NumberOnly { + this := NumberOnly{} + return &this +} + +// NewNumberOnlyWithDefaults instantiates a new NumberOnly 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 NewNumberOnlyWithDefaults() *NumberOnly { + this := NumberOnly{} + return &this +} + +// GetJustNumber returns the JustNumber field value if set, zero value otherwise. +func (o *NumberOnly) GetJustNumber() float32 { + if o == nil || o.JustNumber == nil { + var ret float32 + return ret + } + return *o.JustNumber +} + +// GetJustNumberOk returns a tuple with the JustNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NumberOnly) GetJustNumberOk() (*float32, bool) { + if o == nil || o.JustNumber == nil { + return nil, false + } + return o.JustNumber, true +} + +// HasJustNumber returns a boolean if a field has been set. +func (o *NumberOnly) HasJustNumber() bool { + if o != nil && o.JustNumber != nil { + return true + } + + return false +} + +// SetJustNumber gets a reference to the given float32 and assigns it to the JustNumber field. +func (o *NumberOnly) SetJustNumber(v float32) { + o.JustNumber = &v +} + +func (o NumberOnly) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.JustNumber != nil { + toSerialize["JustNumber"] = o.JustNumber + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *NumberOnly) UnmarshalJSON(bytes []byte) (err error) { + varNumberOnly := _NumberOnly{} + + if err = json.Unmarshal(bytes, &varNumberOnly); err == nil { + *o = NumberOnly(varNumberOnly) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "JustNumber") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableNumberOnly struct { + value *NumberOnly + isSet bool +} + +func (v NullableNumberOnly) Get() *NumberOnly { + return v.value +} + +func (v *NullableNumberOnly) Set(val *NumberOnly) { + v.value = val + v.isSet = true +} + +func (v NullableNumberOnly) IsSet() bool { + return v.isSet +} + +func (v *NullableNumberOnly) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNumberOnly(val *NumberOnly) *NullableNumberOnly { + return &NullableNumberOnly{value: val, isSet: true} +} + +func (v NullableNumberOnly) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNumberOnly) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_order.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_order.go new file mode 100644 index 00000000000..83e6d9fdeb3 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_order.go @@ -0,0 +1,330 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "time" +) + +// Order struct for Order +type Order struct { + Id *int64 `json:"id,omitempty"` + PetId *int64 `json:"petId,omitempty"` + Quantity *int32 `json:"quantity,omitempty"` + ShipDate *time.Time `json:"shipDate,omitempty"` + // Order Status + Status *string `json:"status,omitempty"` + Complete *bool `json:"complete,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Order Order + +// NewOrder instantiates a new Order 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 NewOrder() *Order { + this := Order{} + var complete bool = false + this.Complete = &complete + return &this +} + +// NewOrderWithDefaults instantiates a new Order 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 NewOrderWithDefaults() *Order { + this := Order{} + var complete bool = false + this.Complete = &complete + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Order) GetId() int64 { + if o == nil || o.Id == nil { + 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 *Order) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Order) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Order) SetId(v int64) { + o.Id = &v +} + +// GetPetId returns the PetId field value if set, zero value otherwise. +func (o *Order) GetPetId() int64 { + if o == nil || o.PetId == nil { + var ret int64 + return ret + } + return *o.PetId +} + +// GetPetIdOk returns a tuple with the PetId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Order) GetPetIdOk() (*int64, bool) { + if o == nil || o.PetId == nil { + return nil, false + } + return o.PetId, true +} + +// HasPetId returns a boolean if a field has been set. +func (o *Order) HasPetId() bool { + if o != nil && o.PetId != nil { + return true + } + + return false +} + +// SetPetId gets a reference to the given int64 and assigns it to the PetId field. +func (o *Order) SetPetId(v int64) { + o.PetId = &v +} + +// GetQuantity returns the Quantity field value if set, zero value otherwise. +func (o *Order) GetQuantity() int32 { + if o == nil || o.Quantity == nil { + var ret int32 + return ret + } + return *o.Quantity +} + +// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Order) GetQuantityOk() (*int32, bool) { + if o == nil || o.Quantity == nil { + return nil, false + } + return o.Quantity, true +} + +// HasQuantity returns a boolean if a field has been set. +func (o *Order) HasQuantity() bool { + if o != nil && o.Quantity != nil { + return true + } + + return false +} + +// SetQuantity gets a reference to the given int32 and assigns it to the Quantity field. +func (o *Order) SetQuantity(v int32) { + o.Quantity = &v +} + +// GetShipDate returns the ShipDate field value if set, zero value otherwise. +func (o *Order) GetShipDate() time.Time { + if o == nil || o.ShipDate == nil { + var ret time.Time + return ret + } + return *o.ShipDate +} + +// GetShipDateOk returns a tuple with the ShipDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Order) GetShipDateOk() (*time.Time, bool) { + if o == nil || o.ShipDate == nil { + return nil, false + } + return o.ShipDate, true +} + +// HasShipDate returns a boolean if a field has been set. +func (o *Order) HasShipDate() bool { + if o != nil && o.ShipDate != nil { + return true + } + + return false +} + +// SetShipDate gets a reference to the given time.Time and assigns it to the ShipDate field. +func (o *Order) SetShipDate(v time.Time) { + o.ShipDate = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Order) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Order) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Order) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Order) SetStatus(v string) { + o.Status = &v +} + +// GetComplete returns the Complete field value if set, zero value otherwise. +func (o *Order) GetComplete() bool { + if o == nil || o.Complete == nil { + var ret bool + return ret + } + return *o.Complete +} + +// GetCompleteOk returns a tuple with the Complete field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Order) GetCompleteOk() (*bool, bool) { + if o == nil || o.Complete == nil { + return nil, false + } + return o.Complete, true +} + +// HasComplete returns a boolean if a field has been set. +func (o *Order) HasComplete() bool { + if o != nil && o.Complete != nil { + return true + } + + return false +} + +// SetComplete gets a reference to the given bool and assigns it to the Complete field. +func (o *Order) SetComplete(v bool) { + o.Complete = &v +} + +func (o Order) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.PetId != nil { + toSerialize["petId"] = o.PetId + } + if o.Quantity != nil { + toSerialize["quantity"] = o.Quantity + } + if o.ShipDate != nil { + toSerialize["shipDate"] = o.ShipDate + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Complete != nil { + toSerialize["complete"] = o.Complete + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Order) UnmarshalJSON(bytes []byte) (err error) { + varOrder := _Order{} + + if err = json.Unmarshal(bytes, &varOrder); err == nil { + *o = Order(varOrder) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "petId") + delete(additionalProperties, "quantity") + delete(additionalProperties, "shipDate") + delete(additionalProperties, "status") + delete(additionalProperties, "complete") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableOrder struct { + value *Order + isSet bool +} + +func (v NullableOrder) Get() *Order { + return v.value +} + +func (v *NullableOrder) Set(val *Order) { + v.value = val + v.isSet = true +} + +func (v NullableOrder) IsSet() bool { + return v.isSet +} + +func (v *NullableOrder) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOrder(val *Order) *NullableOrder { + return &NullableOrder{value: val, isSet: true} +} + +func (v NullableOrder) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOrder) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_composite.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_composite.go new file mode 100644 index 00000000000..2b399e1a97f --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_composite.go @@ -0,0 +1,213 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// OuterComposite struct for OuterComposite +type OuterComposite struct { + MyNumber *float32 `json:"my_number,omitempty"` + MyString *string `json:"my_string,omitempty"` + MyBoolean *bool `json:"my_boolean,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _OuterComposite OuterComposite + +// NewOuterComposite instantiates a new OuterComposite 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 NewOuterComposite() *OuterComposite { + this := OuterComposite{} + return &this +} + +// NewOuterCompositeWithDefaults instantiates a new OuterComposite 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 NewOuterCompositeWithDefaults() *OuterComposite { + this := OuterComposite{} + return &this +} + +// GetMyNumber returns the MyNumber field value if set, zero value otherwise. +func (o *OuterComposite) GetMyNumber() float32 { + if o == nil || o.MyNumber == nil { + var ret float32 + return ret + } + return *o.MyNumber +} + +// GetMyNumberOk returns a tuple with the MyNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OuterComposite) GetMyNumberOk() (*float32, bool) { + if o == nil || o.MyNumber == nil { + return nil, false + } + return o.MyNumber, true +} + +// HasMyNumber returns a boolean if a field has been set. +func (o *OuterComposite) HasMyNumber() bool { + if o != nil && o.MyNumber != nil { + return true + } + + return false +} + +// SetMyNumber gets a reference to the given float32 and assigns it to the MyNumber field. +func (o *OuterComposite) SetMyNumber(v float32) { + o.MyNumber = &v +} + +// GetMyString returns the MyString field value if set, zero value otherwise. +func (o *OuterComposite) GetMyString() string { + if o == nil || o.MyString == nil { + var ret string + return ret + } + return *o.MyString +} + +// GetMyStringOk returns a tuple with the MyString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OuterComposite) GetMyStringOk() (*string, bool) { + if o == nil || o.MyString == nil { + return nil, false + } + return o.MyString, true +} + +// HasMyString returns a boolean if a field has been set. +func (o *OuterComposite) HasMyString() bool { + if o != nil && o.MyString != nil { + return true + } + + return false +} + +// SetMyString gets a reference to the given string and assigns it to the MyString field. +func (o *OuterComposite) SetMyString(v string) { + o.MyString = &v +} + +// GetMyBoolean returns the MyBoolean field value if set, zero value otherwise. +func (o *OuterComposite) GetMyBoolean() bool { + if o == nil || o.MyBoolean == nil { + var ret bool + return ret + } + return *o.MyBoolean +} + +// GetMyBooleanOk returns a tuple with the MyBoolean field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OuterComposite) GetMyBooleanOk() (*bool, bool) { + if o == nil || o.MyBoolean == nil { + return nil, false + } + return o.MyBoolean, true +} + +// HasMyBoolean returns a boolean if a field has been set. +func (o *OuterComposite) HasMyBoolean() bool { + if o != nil && o.MyBoolean != nil { + return true + } + + return false +} + +// SetMyBoolean gets a reference to the given bool and assigns it to the MyBoolean field. +func (o *OuterComposite) SetMyBoolean(v bool) { + o.MyBoolean = &v +} + +func (o OuterComposite) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.MyNumber != nil { + toSerialize["my_number"] = o.MyNumber + } + if o.MyString != nil { + toSerialize["my_string"] = o.MyString + } + if o.MyBoolean != nil { + toSerialize["my_boolean"] = o.MyBoolean + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *OuterComposite) UnmarshalJSON(bytes []byte) (err error) { + varOuterComposite := _OuterComposite{} + + if err = json.Unmarshal(bytes, &varOuterComposite); err == nil { + *o = OuterComposite(varOuterComposite) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "my_number") + delete(additionalProperties, "my_string") + delete(additionalProperties, "my_boolean") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableOuterComposite struct { + value *OuterComposite + isSet bool +} + +func (v NullableOuterComposite) Get() *OuterComposite { + return v.value +} + +func (v *NullableOuterComposite) Set(val *OuterComposite) { + v.value = val + v.isSet = true +} + +func (v NullableOuterComposite) IsSet() bool { + return v.isSet +} + +func (v *NullableOuterComposite) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOuterComposite(val *OuterComposite) *NullableOuterComposite { + return &NullableOuterComposite{value: val, isSet: true} +} + +func (v NullableOuterComposite) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOuterComposite) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum.go new file mode 100644 index 00000000000..f0297f941dd --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum.go @@ -0,0 +1,84 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "fmt" +) + +// OuterEnum the model 'OuterEnum' +type OuterEnum string + +// List of OuterEnum +const ( + OUTERENUM_PLACED OuterEnum = "placed" + OUTERENUM_APPROVED OuterEnum = "approved" + OUTERENUM_DELIVERED OuterEnum = "delivered" +) + +func (v *OuterEnum) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := OuterEnum(value) + for _, existing := range []OuterEnum{ "placed", "approved", "delivered", } { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid OuterEnum", value) +} + +// Ptr returns reference to OuterEnum value +func (v OuterEnum) Ptr() *OuterEnum { + return &v +} + +type NullableOuterEnum struct { + value *OuterEnum + isSet bool +} + +func (v NullableOuterEnum) Get() *OuterEnum { + return v.value +} + +func (v *NullableOuterEnum) Set(val *OuterEnum) { + v.value = val + v.isSet = true +} + +func (v NullableOuterEnum) IsSet() bool { + return v.isSet +} + +func (v *NullableOuterEnum) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOuterEnum(val *OuterEnum) *NullableOuterEnum { + return &NullableOuterEnum{value: val, isSet: true} +} + +func (v NullableOuterEnum) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOuterEnum) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum_default_value.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum_default_value.go new file mode 100644 index 00000000000..334feef54a5 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum_default_value.go @@ -0,0 +1,84 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "fmt" +) + +// OuterEnumDefaultValue the model 'OuterEnumDefaultValue' +type OuterEnumDefaultValue string + +// List of OuterEnumDefaultValue +const ( + OUTERENUMDEFAULTVALUE_PLACED OuterEnumDefaultValue = "placed" + OUTERENUMDEFAULTVALUE_APPROVED OuterEnumDefaultValue = "approved" + OUTERENUMDEFAULTVALUE_DELIVERED OuterEnumDefaultValue = "delivered" +) + +func (v *OuterEnumDefaultValue) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := OuterEnumDefaultValue(value) + for _, existing := range []OuterEnumDefaultValue{ "placed", "approved", "delivered", } { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid OuterEnumDefaultValue", value) +} + +// Ptr returns reference to OuterEnumDefaultValue value +func (v OuterEnumDefaultValue) Ptr() *OuterEnumDefaultValue { + return &v +} + +type NullableOuterEnumDefaultValue struct { + value *OuterEnumDefaultValue + isSet bool +} + +func (v NullableOuterEnumDefaultValue) Get() *OuterEnumDefaultValue { + return v.value +} + +func (v *NullableOuterEnumDefaultValue) Set(val *OuterEnumDefaultValue) { + v.value = val + v.isSet = true +} + +func (v NullableOuterEnumDefaultValue) IsSet() bool { + return v.isSet +} + +func (v *NullableOuterEnumDefaultValue) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOuterEnumDefaultValue(val *OuterEnumDefaultValue) *NullableOuterEnumDefaultValue { + return &NullableOuterEnumDefaultValue{value: val, isSet: true} +} + +func (v NullableOuterEnumDefaultValue) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOuterEnumDefaultValue) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum_integer.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum_integer.go new file mode 100644 index 00000000000..025b8a7c70a --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum_integer.go @@ -0,0 +1,84 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "fmt" +) + +// OuterEnumInteger the model 'OuterEnumInteger' +type OuterEnumInteger int32 + +// List of OuterEnumInteger +const ( + OUTERENUMINTEGER__0 OuterEnumInteger = 0 + OUTERENUMINTEGER__1 OuterEnumInteger = 1 + OUTERENUMINTEGER__2 OuterEnumInteger = 2 +) + +func (v *OuterEnumInteger) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := OuterEnumInteger(value) + for _, existing := range []OuterEnumInteger{ 0, 1, 2, } { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid OuterEnumInteger", value) +} + +// Ptr returns reference to OuterEnumInteger value +func (v OuterEnumInteger) Ptr() *OuterEnumInteger { + return &v +} + +type NullableOuterEnumInteger struct { + value *OuterEnumInteger + isSet bool +} + +func (v NullableOuterEnumInteger) Get() *OuterEnumInteger { + return v.value +} + +func (v *NullableOuterEnumInteger) Set(val *OuterEnumInteger) { + v.value = val + v.isSet = true +} + +func (v NullableOuterEnumInteger) IsSet() bool { + return v.isSet +} + +func (v *NullableOuterEnumInteger) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOuterEnumInteger(val *OuterEnumInteger) *NullableOuterEnumInteger { + return &NullableOuterEnumInteger{value: val, isSet: true} +} + +func (v NullableOuterEnumInteger) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOuterEnumInteger) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum_integer_default_value.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum_integer_default_value.go new file mode 100644 index 00000000000..07afc92fac9 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_outer_enum_integer_default_value.go @@ -0,0 +1,84 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "fmt" +) + +// OuterEnumIntegerDefaultValue the model 'OuterEnumIntegerDefaultValue' +type OuterEnumIntegerDefaultValue int32 + +// List of OuterEnumIntegerDefaultValue +const ( + OUTERENUMINTEGERDEFAULTVALUE__0 OuterEnumIntegerDefaultValue = 0 + OUTERENUMINTEGERDEFAULTVALUE__1 OuterEnumIntegerDefaultValue = 1 + OUTERENUMINTEGERDEFAULTVALUE__2 OuterEnumIntegerDefaultValue = 2 +) + +func (v *OuterEnumIntegerDefaultValue) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := OuterEnumIntegerDefaultValue(value) + for _, existing := range []OuterEnumIntegerDefaultValue{ 0, 1, 2, } { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid OuterEnumIntegerDefaultValue", value) +} + +// Ptr returns reference to OuterEnumIntegerDefaultValue value +func (v OuterEnumIntegerDefaultValue) Ptr() *OuterEnumIntegerDefaultValue { + return &v +} + +type NullableOuterEnumIntegerDefaultValue struct { + value *OuterEnumIntegerDefaultValue + isSet bool +} + +func (v NullableOuterEnumIntegerDefaultValue) Get() *OuterEnumIntegerDefaultValue { + return v.value +} + +func (v *NullableOuterEnumIntegerDefaultValue) Set(val *OuterEnumIntegerDefaultValue) { + v.value = val + v.isSet = true +} + +func (v NullableOuterEnumIntegerDefaultValue) IsSet() bool { + return v.isSet +} + +func (v *NullableOuterEnumIntegerDefaultValue) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOuterEnumIntegerDefaultValue(val *OuterEnumIntegerDefaultValue) *NullableOuterEnumIntegerDefaultValue { + return &NullableOuterEnumIntegerDefaultValue{value: val, isSet: true} +} + +func (v NullableOuterEnumIntegerDefaultValue) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOuterEnumIntegerDefaultValue) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_pet.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_pet.go new file mode 100644 index 00000000000..fc4505e1da4 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_pet.go @@ -0,0 +1,311 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Pet struct for Pet +type Pet struct { + Id *int64 `json:"id,omitempty"` + Category *Category `json:"category,omitempty"` + Name string `json:"name"` + PhotoUrls []string `json:"photoUrls"` + Tags *[]Tag `json:"tags,omitempty"` + // pet status in the store + Status *string `json:"status,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Pet 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 +func NewPet(name string, photoUrls []string, ) *Pet { + this := Pet{} + this.Name = name + this.PhotoUrls = photoUrls + return &this +} + +// 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 +func NewPetWithDefaults() *Pet { + this := Pet{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Pet) GetId() int64 { + if o == nil || o.Id == nil { + 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 *Pet) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Pet) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Pet) SetId(v int64) { + o.Id = &v +} + +// GetCategory returns the Category field value if set, zero value otherwise. +func (o *Pet) GetCategory() Category { + if o == nil || o.Category == nil { + var ret Category + return ret + } + return *o.Category +} + +// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Pet) GetCategoryOk() (*Category, bool) { + if o == nil || o.Category == nil { + return nil, false + } + return o.Category, true +} + +// HasCategory returns a boolean if a field has been set. +func (o *Pet) HasCategory() bool { + if o != nil && o.Category != nil { + return true + } + + return false +} + +// SetCategory gets a reference to the given Category and assigns it to the Category field. +func (o *Pet) SetCategory(v Category) { + o.Category = &v +} + +// GetName returns the Name field value +func (o *Pet) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Pet) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Pet) SetName(v string) { + o.Name = v +} + +// GetPhotoUrls returns the PhotoUrls field value +func (o *Pet) GetPhotoUrls() []string { + if o == nil { + var ret []string + return ret + } + + return o.PhotoUrls +} + +// GetPhotoUrlsOk returns a tuple with the PhotoUrls field value +// and a boolean to check if the value has been set. +func (o *Pet) GetPhotoUrlsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.PhotoUrls, true +} + +// SetPhotoUrls sets field value +func (o *Pet) SetPhotoUrls(v []string) { + o.PhotoUrls = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *Pet) GetTags() []Tag { + if o == nil || o.Tags == nil { + var ret []Tag + return ret + } + return *o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Pet) GetTagsOk() (*[]Tag, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *Pet) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []Tag and assigns it to the Tags field. +func (o *Pet) SetTags(v []Tag) { + o.Tags = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Pet) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Pet) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Pet) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Pet) SetStatus(v string) { + o.Status = &v +} + +func (o Pet) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Category != nil { + toSerialize["category"] = o.Category + } + if true { + toSerialize["name"] = o.Name + } + if true { + toSerialize["photoUrls"] = o.PhotoUrls + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Pet) UnmarshalJSON(bytes []byte) (err error) { + varPet := _Pet{} + + if err = json.Unmarshal(bytes, &varPet); err == nil { + *o = Pet(varPet) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "category") + delete(additionalProperties, "name") + delete(additionalProperties, "photoUrls") + delete(additionalProperties, "tags") + delete(additionalProperties, "status") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePet struct { + value *Pet + isSet bool +} + +func (v NullablePet) Get() *Pet { + return v.value +} + +func (v *NullablePet) Set(val *Pet) { + v.value = val + v.isSet = true +} + +func (v NullablePet) IsSet() bool { + return v.isSet +} + +func (v *NullablePet) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePet(val *Pet) *NullablePet { + return &NullablePet{value: val, isSet: true} +} + +func (v NullablePet) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePet) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_read_only_first.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_read_only_first.go new file mode 100644 index 00000000000..206e8ef240a --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_read_only_first.go @@ -0,0 +1,176 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// ReadOnlyFirst struct for ReadOnlyFirst +type ReadOnlyFirst struct { + Bar *string `json:"bar,omitempty"` + Baz *string `json:"baz,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ReadOnlyFirst ReadOnlyFirst + +// NewReadOnlyFirst instantiates a new ReadOnlyFirst 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 NewReadOnlyFirst() *ReadOnlyFirst { + this := ReadOnlyFirst{} + return &this +} + +// NewReadOnlyFirstWithDefaults instantiates a new ReadOnlyFirst 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 NewReadOnlyFirstWithDefaults() *ReadOnlyFirst { + this := ReadOnlyFirst{} + return &this +} + +// GetBar returns the Bar field value if set, zero value otherwise. +func (o *ReadOnlyFirst) GetBar() string { + if o == nil || o.Bar == nil { + var ret string + return ret + } + return *o.Bar +} + +// GetBarOk returns a tuple with the Bar field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReadOnlyFirst) GetBarOk() (*string, bool) { + if o == nil || o.Bar == nil { + return nil, false + } + return o.Bar, true +} + +// HasBar returns a boolean if a field has been set. +func (o *ReadOnlyFirst) HasBar() bool { + if o != nil && o.Bar != nil { + return true + } + + return false +} + +// SetBar gets a reference to the given string and assigns it to the Bar field. +func (o *ReadOnlyFirst) SetBar(v string) { + o.Bar = &v +} + +// GetBaz returns the Baz field value if set, zero value otherwise. +func (o *ReadOnlyFirst) GetBaz() string { + if o == nil || o.Baz == nil { + var ret string + return ret + } + return *o.Baz +} + +// GetBazOk returns a tuple with the Baz field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReadOnlyFirst) GetBazOk() (*string, bool) { + if o == nil || o.Baz == nil { + return nil, false + } + return o.Baz, true +} + +// HasBaz returns a boolean if a field has been set. +func (o *ReadOnlyFirst) HasBaz() bool { + if o != nil && o.Baz != nil { + return true + } + + return false +} + +// SetBaz gets a reference to the given string and assigns it to the Baz field. +func (o *ReadOnlyFirst) SetBaz(v string) { + o.Baz = &v +} + +func (o ReadOnlyFirst) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Bar != nil { + toSerialize["bar"] = o.Bar + } + if o.Baz != nil { + toSerialize["baz"] = o.Baz + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *ReadOnlyFirst) UnmarshalJSON(bytes []byte) (err error) { + varReadOnlyFirst := _ReadOnlyFirst{} + + if err = json.Unmarshal(bytes, &varReadOnlyFirst); err == nil { + *o = ReadOnlyFirst(varReadOnlyFirst) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "bar") + delete(additionalProperties, "baz") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableReadOnlyFirst struct { + value *ReadOnlyFirst + isSet bool +} + +func (v NullableReadOnlyFirst) Get() *ReadOnlyFirst { + return v.value +} + +func (v *NullableReadOnlyFirst) Set(val *ReadOnlyFirst) { + v.value = val + v.isSet = true +} + +func (v NullableReadOnlyFirst) IsSet() bool { + return v.isSet +} + +func (v *NullableReadOnlyFirst) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReadOnlyFirst(val *ReadOnlyFirst) *NullableReadOnlyFirst { + return &NullableReadOnlyFirst{value: val, isSet: true} +} + +func (v NullableReadOnlyFirst) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReadOnlyFirst) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_return.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_return.go new file mode 100644 index 00000000000..1d258ad1ef9 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_return.go @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Return Model for testing reserved words +type Return struct { + Return *int32 `json:"return,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Return Return + +// NewReturn instantiates a new Return 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 NewReturn() *Return { + this := Return{} + return &this +} + +// NewReturnWithDefaults instantiates a new Return 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 NewReturnWithDefaults() *Return { + this := Return{} + return &this +} + +// GetReturn returns the Return field value if set, zero value otherwise. +func (o *Return) GetReturn() int32 { + if o == nil || o.Return == nil { + var ret int32 + return ret + } + return *o.Return +} + +// GetReturnOk returns a tuple with the Return field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Return) GetReturnOk() (*int32, bool) { + if o == nil || o.Return == nil { + return nil, false + } + return o.Return, true +} + +// HasReturn returns a boolean if a field has been set. +func (o *Return) HasReturn() bool { + if o != nil && o.Return != nil { + return true + } + + return false +} + +// SetReturn gets a reference to the given int32 and assigns it to the Return field. +func (o *Return) SetReturn(v int32) { + o.Return = &v +} + +func (o Return) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Return != nil { + toSerialize["return"] = o.Return + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Return) UnmarshalJSON(bytes []byte) (err error) { + varReturn := _Return{} + + if err = json.Unmarshal(bytes, &varReturn); err == nil { + *o = Return(varReturn) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "return") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableReturn struct { + value *Return + isSet bool +} + +func (v NullableReturn) Get() *Return { + return v.value +} + +func (v *NullableReturn) Set(val *Return) { + v.value = val + v.isSet = true +} + +func (v NullableReturn) IsSet() bool { + return v.isSet +} + +func (v *NullableReturn) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReturn(val *Return) *NullableReturn { + return &NullableReturn{value: val, isSet: true} +} + +func (v NullableReturn) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReturn) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_tag.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_tag.go new file mode 100644 index 00000000000..22ede38add3 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_tag.go @@ -0,0 +1,176 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Tag struct for Tag +type Tag struct { + Id *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Tag 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 +func NewTag() *Tag { + this := Tag{} + return &this +} + +// 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 +func NewTagWithDefaults() *Tag { + this := Tag{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Tag) GetId() int64 { + if o == nil || o.Id == nil { + 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 *Tag) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Tag) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Tag) SetId(v int64) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Tag) GetName() string { + if o == nil || o.Name == nil { + 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 *Tag) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Tag) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Tag) SetName(v string) { + o.Name = &v +} + +func (o Tag) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Tag) UnmarshalJSON(bytes []byte) (err error) { + varTag := _Tag{} + + if err = json.Unmarshal(bytes, &varTag); err == nil { + *o = Tag(varTag) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTag struct { + value *Tag + isSet bool +} + +func (v NullableTag) Get() *Tag { + return v.value +} + +func (v *NullableTag) Set(val *Tag) { + v.value = val + v.isSet = true +} + +func (v NullableTag) IsSet() bool { + return v.isSet +} + +func (v *NullableTag) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTag(val *Tag) *NullableTag { + return &NullableTag{value: val, isSet: true} +} + +func (v NullableTag) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTag) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_user.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_user.go new file mode 100644 index 00000000000..eac34a34ab6 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_user.go @@ -0,0 +1,554 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// User struct for User +type User struct { + Id *int64 `json:"id,omitempty"` + Username *string `json:"username,omitempty"` + FirstName *string `json:"firstName,omitempty"` + LastName *string `json:"lastName,omitempty"` + Email *string `json:"email,omitempty"` + Password *string `json:"password,omitempty"` + Phone *string `json:"phone,omitempty"` + // User Status + UserStatus *int32 `json:"userStatus,omitempty"` + // test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + ArbitraryObject *map[string]interface{} `json:"arbitraryObject,omitempty"` + // test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + ArbitraryNullableObject map[string]interface{} `json:"arbitraryNullableObject,omitempty"` + // test code generation for any type Value can be any type - string, number, boolean, array or object. + ArbitraryTypeValue interface{} `json:"arbitraryTypeValue,omitempty"` + // test code generation for any type Value can be any type - string, number, boolean, array, object or the 'null' value. + ArbitraryNullableTypeValue interface{} `json:"arbitraryNullableTypeValue,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _User User + +// NewUser instantiates a new User 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 NewUser() *User { + this := User{} + return &this +} + +// NewUserWithDefaults instantiates a new User 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 NewUserWithDefaults() *User { + this := User{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *User) GetId() int64 { + if o == nil || o.Id == nil { + 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 *User) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *User) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *User) SetId(v int64) { + o.Id = &v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *User) GetUsername() string { + if o == nil || o.Username == nil { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetUsernameOk() (*string, bool) { + if o == nil || o.Username == nil { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *User) HasUsername() bool { + if o != nil && o.Username != nil { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *User) SetUsername(v string) { + o.Username = &v +} + +// GetFirstName returns the FirstName field value if set, zero value otherwise. +func (o *User) GetFirstName() string { + if o == nil || o.FirstName == nil { + var ret string + return ret + } + return *o.FirstName +} + +// GetFirstNameOk returns a tuple with the FirstName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetFirstNameOk() (*string, bool) { + if o == nil || o.FirstName == nil { + return nil, false + } + return o.FirstName, true +} + +// HasFirstName returns a boolean if a field has been set. +func (o *User) HasFirstName() bool { + if o != nil && o.FirstName != nil { + return true + } + + return false +} + +// SetFirstName gets a reference to the given string and assigns it to the FirstName field. +func (o *User) SetFirstName(v string) { + o.FirstName = &v +} + +// GetLastName returns the LastName field value if set, zero value otherwise. +func (o *User) GetLastName() string { + if o == nil || o.LastName == nil { + var ret string + return ret + } + return *o.LastName +} + +// GetLastNameOk returns a tuple with the LastName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetLastNameOk() (*string, bool) { + if o == nil || o.LastName == nil { + return nil, false + } + return o.LastName, true +} + +// HasLastName returns a boolean if a field has been set. +func (o *User) HasLastName() bool { + if o != nil && o.LastName != nil { + return true + } + + return false +} + +// SetLastName gets a reference to the given string and assigns it to the LastName field. +func (o *User) SetLastName(v string) { + o.LastName = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *User) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *User) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *User) SetEmail(v string) { + o.Email = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *User) GetPassword() string { + if o == nil || o.Password == nil { + var ret string + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetPasswordOk() (*string, bool) { + if o == nil || o.Password == nil { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *User) HasPassword() bool { + if o != nil && o.Password != nil { + return true + } + + return false +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *User) SetPassword(v string) { + o.Password = &v +} + +// GetPhone returns the Phone field value if set, zero value otherwise. +func (o *User) GetPhone() string { + if o == nil || o.Phone == nil { + var ret string + return ret + } + return *o.Phone +} + +// GetPhoneOk returns a tuple with the Phone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetPhoneOk() (*string, bool) { + if o == nil || o.Phone == nil { + return nil, false + } + return o.Phone, true +} + +// HasPhone returns a boolean if a field has been set. +func (o *User) HasPhone() bool { + if o != nil && o.Phone != nil { + return true + } + + return false +} + +// SetPhone gets a reference to the given string and assigns it to the Phone field. +func (o *User) SetPhone(v string) { + o.Phone = &v +} + +// GetUserStatus returns the UserStatus field value if set, zero value otherwise. +func (o *User) GetUserStatus() int32 { + if o == nil || o.UserStatus == nil { + var ret int32 + return ret + } + return *o.UserStatus +} + +// GetUserStatusOk returns a tuple with the UserStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetUserStatusOk() (*int32, bool) { + if o == nil || o.UserStatus == nil { + return nil, false + } + return o.UserStatus, true +} + +// HasUserStatus returns a boolean if a field has been set. +func (o *User) HasUserStatus() bool { + if o != nil && o.UserStatus != nil { + return true + } + + return false +} + +// SetUserStatus gets a reference to the given int32 and assigns it to the UserStatus field. +func (o *User) SetUserStatus(v int32) { + o.UserStatus = &v +} + +// GetArbitraryObject returns the ArbitraryObject field value if set, zero value otherwise. +func (o *User) GetArbitraryObject() map[string]interface{} { + if o == nil || o.ArbitraryObject == nil { + var ret map[string]interface{} + return ret + } + return *o.ArbitraryObject +} + +// GetArbitraryObjectOk returns a tuple with the ArbitraryObject field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetArbitraryObjectOk() (*map[string]interface{}, bool) { + if o == nil || o.ArbitraryObject == nil { + return nil, false + } + return o.ArbitraryObject, true +} + +// HasArbitraryObject returns a boolean if a field has been set. +func (o *User) HasArbitraryObject() bool { + if o != nil && o.ArbitraryObject != nil { + return true + } + + return false +} + +// SetArbitraryObject gets a reference to the given map[string]interface{} and assigns it to the ArbitraryObject field. +func (o *User) SetArbitraryObject(v map[string]interface{}) { + o.ArbitraryObject = &v +} + +// GetArbitraryNullableObject returns the ArbitraryNullableObject field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *User) GetArbitraryNullableObject() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + return o.ArbitraryNullableObject +} + +// GetArbitraryNullableObjectOk returns a tuple with the ArbitraryNullableObject field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *User) GetArbitraryNullableObjectOk() (*map[string]interface{}, bool) { + if o == nil || o.ArbitraryNullableObject == nil { + return nil, false + } + return &o.ArbitraryNullableObject, true +} + +// HasArbitraryNullableObject returns a boolean if a field has been set. +func (o *User) HasArbitraryNullableObject() bool { + if o != nil && o.ArbitraryNullableObject != nil { + return true + } + + return false +} + +// SetArbitraryNullableObject gets a reference to the given map[string]interface{} and assigns it to the ArbitraryNullableObject field. +func (o *User) SetArbitraryNullableObject(v map[string]interface{}) { + o.ArbitraryNullableObject = v +} + +// GetArbitraryTypeValue returns the ArbitraryTypeValue field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *User) GetArbitraryTypeValue() interface{} { + if o == nil { + var ret interface{} + return ret + } + return o.ArbitraryTypeValue +} + +// GetArbitraryTypeValueOk returns a tuple with the ArbitraryTypeValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *User) GetArbitraryTypeValueOk() (*interface{}, bool) { + if o == nil || o.ArbitraryTypeValue == nil { + return nil, false + } + return &o.ArbitraryTypeValue, true +} + +// HasArbitraryTypeValue returns a boolean if a field has been set. +func (o *User) HasArbitraryTypeValue() bool { + if o != nil && o.ArbitraryTypeValue != nil { + return true + } + + return false +} + +// SetArbitraryTypeValue gets a reference to the given interface{} and assigns it to the ArbitraryTypeValue field. +func (o *User) SetArbitraryTypeValue(v interface{}) { + o.ArbitraryTypeValue = v +} + +// GetArbitraryNullableTypeValue returns the ArbitraryNullableTypeValue field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *User) GetArbitraryNullableTypeValue() interface{} { + if o == nil { + var ret interface{} + return ret + } + return o.ArbitraryNullableTypeValue +} + +// GetArbitraryNullableTypeValueOk returns a tuple with the ArbitraryNullableTypeValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *User) GetArbitraryNullableTypeValueOk() (*interface{}, bool) { + if o == nil || o.ArbitraryNullableTypeValue == nil { + return nil, false + } + return &o.ArbitraryNullableTypeValue, true +} + +// HasArbitraryNullableTypeValue returns a boolean if a field has been set. +func (o *User) HasArbitraryNullableTypeValue() bool { + if o != nil && o.ArbitraryNullableTypeValue != nil { + return true + } + + return false +} + +// SetArbitraryNullableTypeValue gets a reference to the given interface{} and assigns it to the ArbitraryNullableTypeValue field. +func (o *User) SetArbitraryNullableTypeValue(v interface{}) { + o.ArbitraryNullableTypeValue = v +} + +func (o User) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Username != nil { + toSerialize["username"] = o.Username + } + if o.FirstName != nil { + toSerialize["firstName"] = o.FirstName + } + if o.LastName != nil { + toSerialize["lastName"] = o.LastName + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Password != nil { + toSerialize["password"] = o.Password + } + if o.Phone != nil { + toSerialize["phone"] = o.Phone + } + if o.UserStatus != nil { + toSerialize["userStatus"] = o.UserStatus + } + if o.ArbitraryObject != nil { + toSerialize["arbitraryObject"] = o.ArbitraryObject + } + if o.ArbitraryNullableObject != nil { + toSerialize["arbitraryNullableObject"] = o.ArbitraryNullableObject + } + if o.ArbitraryTypeValue != nil { + toSerialize["arbitraryTypeValue"] = o.ArbitraryTypeValue + } + if o.ArbitraryNullableTypeValue != nil { + toSerialize["arbitraryNullableTypeValue"] = o.ArbitraryNullableTypeValue + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *User) UnmarshalJSON(bytes []byte) (err error) { + varUser := _User{} + + if err = json.Unmarshal(bytes, &varUser); err == nil { + *o = User(varUser) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "username") + delete(additionalProperties, "firstName") + delete(additionalProperties, "lastName") + delete(additionalProperties, "email") + delete(additionalProperties, "password") + delete(additionalProperties, "phone") + delete(additionalProperties, "userStatus") + delete(additionalProperties, "arbitraryObject") + delete(additionalProperties, "arbitraryNullableObject") + delete(additionalProperties, "arbitraryTypeValue") + delete(additionalProperties, "arbitraryNullableTypeValue") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUser struct { + value *User + isSet bool +} + +func (v NullableUser) Get() *User { + return v.value +} + +func (v *NullableUser) Set(val *User) { + v.value = val + v.isSet = true +} + +func (v NullableUser) IsSet() bool { + return v.isSet +} + +func (v *NullableUser) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUser(val *User) *NullableUser { + return &NullableUser{value: val, isSet: true} +} + +func (v NullableUser) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUser) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_whale.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_whale.go new file mode 100644 index 00000000000..4ed4891cb32 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_whale.go @@ -0,0 +1,206 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Whale struct for Whale +type Whale struct { + HasBaleen *bool `json:"hasBaleen,omitempty"` + HasTeeth *bool `json:"hasTeeth,omitempty"` + ClassName string `json:"className"` + AdditionalProperties map[string]interface{} +} + +type _Whale Whale + +// NewWhale instantiates a new Whale 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 NewWhale(className string, ) *Whale { + this := Whale{} + this.ClassName = className + return &this +} + +// NewWhaleWithDefaults instantiates a new Whale 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 NewWhaleWithDefaults() *Whale { + this := Whale{} + return &this +} + +// GetHasBaleen returns the HasBaleen field value if set, zero value otherwise. +func (o *Whale) GetHasBaleen() bool { + if o == nil || o.HasBaleen == nil { + var ret bool + return ret + } + return *o.HasBaleen +} + +// GetHasBaleenOk returns a tuple with the HasBaleen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Whale) GetHasBaleenOk() (*bool, bool) { + if o == nil || o.HasBaleen == nil { + return nil, false + } + return o.HasBaleen, true +} + +// HasHasBaleen returns a boolean if a field has been set. +func (o *Whale) HasHasBaleen() bool { + if o != nil && o.HasBaleen != nil { + return true + } + + return false +} + +// SetHasBaleen gets a reference to the given bool and assigns it to the HasBaleen field. +func (o *Whale) SetHasBaleen(v bool) { + o.HasBaleen = &v +} + +// GetHasTeeth returns the HasTeeth field value if set, zero value otherwise. +func (o *Whale) GetHasTeeth() bool { + if o == nil || o.HasTeeth == nil { + var ret bool + return ret + } + return *o.HasTeeth +} + +// GetHasTeethOk returns a tuple with the HasTeeth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Whale) GetHasTeethOk() (*bool, bool) { + if o == nil || o.HasTeeth == nil { + return nil, false + } + return o.HasTeeth, true +} + +// HasHasTeeth returns a boolean if a field has been set. +func (o *Whale) HasHasTeeth() bool { + if o != nil && o.HasTeeth != nil { + return true + } + + return false +} + +// SetHasTeeth gets a reference to the given bool and assigns it to the HasTeeth field. +func (o *Whale) SetHasTeeth(v bool) { + o.HasTeeth = &v +} + +// GetClassName returns the ClassName field value +func (o *Whale) GetClassName() string { + if o == nil { + var ret string + return ret + } + + return o.ClassName +} + +// GetClassNameOk returns a tuple with the ClassName field value +// and a boolean to check if the value has been set. +func (o *Whale) GetClassNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClassName, true +} + +// SetClassName sets field value +func (o *Whale) SetClassName(v string) { + o.ClassName = v +} + +func (o Whale) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.HasBaleen != nil { + toSerialize["hasBaleen"] = o.HasBaleen + } + if o.HasTeeth != nil { + toSerialize["hasTeeth"] = o.HasTeeth + } + if true { + toSerialize["className"] = o.ClassName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Whale) UnmarshalJSON(bytes []byte) (err error) { + varWhale := _Whale{} + + if err = json.Unmarshal(bytes, &varWhale); err == nil { + *o = Whale(varWhale) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "hasBaleen") + delete(additionalProperties, "hasTeeth") + delete(additionalProperties, "className") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableWhale struct { + value *Whale + isSet bool +} + +func (v NullableWhale) Get() *Whale { + return v.value +} + +func (v *NullableWhale) Set(val *Whale) { + v.value = val + v.isSet = true +} + +func (v NullableWhale) IsSet() bool { + return v.isSet +} + +func (v *NullableWhale) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWhale(val *Whale) *NullableWhale { + return &NullableWhale{value: val, isSet: true} +} + +func (v NullableWhale) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWhale) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/petstore/model_zebra.go b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_zebra.go new file mode 100644 index 00000000000..88733e014ec --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/petstore/model_zebra.go @@ -0,0 +1,169 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" +) + +// Zebra struct for Zebra +type Zebra struct { + Type *string `json:"type,omitempty"` + ClassName string `json:"className"` + AdditionalProperties map[string]interface{} +} + +type _Zebra Zebra + +// NewZebra instantiates a new Zebra 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 NewZebra(className string, ) *Zebra { + this := Zebra{} + this.ClassName = className + return &this +} + +// NewZebraWithDefaults instantiates a new Zebra 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 NewZebraWithDefaults() *Zebra { + this := Zebra{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Zebra) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Zebra) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Zebra) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Zebra) SetType(v string) { + o.Type = &v +} + +// GetClassName returns the ClassName field value +func (o *Zebra) GetClassName() string { + if o == nil { + var ret string + return ret + } + + return o.ClassName +} + +// GetClassNameOk returns a tuple with the ClassName field value +// and a boolean to check if the value has been set. +func (o *Zebra) GetClassNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClassName, true +} + +// SetClassName sets field value +func (o *Zebra) SetClassName(v string) { + o.ClassName = v +} + +func (o Zebra) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if true { + toSerialize["className"] = o.ClassName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *Zebra) UnmarshalJSON(bytes []byte) (err error) { + varZebra := _Zebra{} + + if err = json.Unmarshal(bytes, &varZebra); err == nil { + *o = Zebra(varZebra) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "type") + delete(additionalProperties, "className") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableZebra struct { + value *Zebra + isSet bool +} + +func (v NullableZebra) Get() *Zebra { + return v.value +} + +func (v *NullableZebra) Set(val *Zebra) { + v.value = val + v.isSet = true +} + +func (v NullableZebra) IsSet() bool { + return v.isSet +} + +func (v *NullableZebra) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableZebra(val *Zebra) *NullableZebra { + return &NullableZebra{value: val, isSet: true} +} + +func (v NullableZebra) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableZebra) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/signing.go b/samples/openapi3/client/petstore/go/go-petstore/signing.go new file mode 100644 index 00000000000..2adb5e27676 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/signing.go @@ -0,0 +1,423 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "bytes" + "context" + "crypto" + "crypto/ecdsa" + "crypto/ed25519" + "crypto/rand" + "crypto/rsa" + "crypto/x509" + "encoding/base64" + "encoding/pem" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/textproto" + "os" + "strings" + "time" +) + +const ( + // Constants for HTTP signature parameters. + // The '(request-target)' parameter concatenates the lowercased :method, an + // ASCII space, and the :path pseudo-headers. + HttpSignatureParameterRequestTarget string = "(request-target)" + // The '(created)' parameter expresses when the signature was + // created. The value MUST be a Unix timestamp integer value. + HttpSignatureParameterCreated string = "(created)" + // The '(expires)' parameter expresses when the signature ceases to + // be valid. The value MUST be a Unix timestamp integer value. + HttpSignatureParameterExpires string = "(expires)" +) + +const ( + // Constants for HTTP headers. + // The 'Host' header, as defined in RFC 2616, section 14.23. + HttpHeaderHost string = "Host" + // The 'Date' header. + HttpHeaderDate string = "Date" + // The digest header, as defined in RFC 3230, section 4.3.2. + HttpHeaderDigest string = "Digest" + // The HTTP Authorization header, as defined in RFC 7235, section 4.2. + HttpHeaderAuthorization string = "Authorization" +) + +const ( + // Specifies the Digital Signature Algorithm is derived from metadata + // associated with 'keyId'. Supported DSA algorithms are RSASSA-PKCS1-v1_5, + // RSASSA-PSS, and ECDSA. + // The hash is SHA-512. + // This is the default value. + HttpSigningSchemeHs2019 string = "hs2019" + // Use RSASSA-PKCS1-v1_5 with SHA-512 hash. Deprecated. + HttpSigningSchemeRsaSha512 string = "rsa-sha512" + // Use RSASSA-PKCS1-v1_5 with SHA-256 hash. Deprecated. + HttpSigningSchemeRsaSha256 string = "rsa-sha256" + + // RFC 8017 section 7.2 + // Calculate the message signature using RSASSA-PKCS1-V1_5-SIGN from RSA PKCS#1 v1.5. + // PKCSV1_5 is deterministic. The same message and key will produce an identical + // signature value each time. + HttpSigningAlgorithmRsaPKCS1v15 string = "RSASSA-PKCS1-v1_5" + // Calculate the message signature using probabilistic signature scheme RSASSA-PSS. + // PSS is randomized and will produce a different signature value each time. + HttpSigningAlgorithmRsaPSS string = "RSASSA-PSS" +) + +var supportedSigningSchemes = map[string]bool{ + HttpSigningSchemeHs2019: true, + HttpSigningSchemeRsaSha512: true, + HttpSigningSchemeRsaSha256: true, +} + + +// HttpSignatureAuth provides HTTP signature authentication to a request passed +// via context using ContextHttpSignatureAuth. +// An 'Authorization' header is calculated by creating a hash of select headers, +// and optionally the body of the HTTP request, then signing the hash value using +// a private key which is available to the client. +// +// SignedHeaders specifies the list of HTTP headers that are included when generating +// the message signature. +// The two special signature headers '(request-target)' and '(created)' SHOULD be +// included in SignedHeaders. +// The '(created)' header expresses when the signature was created. +// The '(request-target)' header is a concatenation of the lowercased :method, an +// ASCII space, and the :path pseudo-headers. +// +// For example, SignedHeaders can be set to: +// (request-target) (created) date host digest +// +// When SignedHeaders is not specified, the client defaults to a single value, '(created)', +// in the list of HTTP headers. +// When SignedHeaders contains the 'Digest' value, the client performs the following operations: +// 1. Calculate a digest of request body, as specified in RFC3230, section 4.3.2. +// 2. Set the 'Digest' header in the request body. +// 3. Include the 'Digest' header and value in the HTTP signature. +type HttpSignatureAuth struct { + KeyId string // A key identifier. + PrivateKeyPath string // The path to the private key. + Passphrase string // The passphrase to decrypt the private key, if the key is encrypted. + SigningScheme string // The signature scheme, when signing HTTP requests. Supported value is 'hs2019'. + // The signature algorithm, when signing HTTP requests. + // Supported values are RSASSA-PKCS1-v1_5, RSASSA-PSS. + SigningAlgorithm string + SignedHeaders []string // A list of HTTP headers included when generating the signature for the message. + // SignatureMaxValidity specifies the maximum duration of the signature validity. + // The value is used to set the '(expires)' signature parameter in the HTTP request. + // '(expires)' is set to '(created)' plus the value of the SignatureMaxValidity field. + // To specify the '(expires)' signature parameter, set 'SignatureMaxValidity' and add '(expires)' to 'SignedHeaders'. + SignatureMaxValidity time.Duration + privateKey crypto.PrivateKey // The private key used to sign HTTP requests. +} + +// ContextWithValue validates the HttpSignatureAuth configuration parameters and returns a context +// suitable for HTTP signature. An error is returned if the HttpSignatureAuth configuration parameters +// are invalid. +func (h *HttpSignatureAuth) ContextWithValue(ctx context.Context) (context.Context, error) { + if h.KeyId == "" { + return nil, fmt.Errorf("Key ID must be specified") + } + if h.PrivateKeyPath == "" { + return nil, fmt.Errorf("Private key path must be specified") + } + if _, ok := supportedSigningSchemes[h.SigningScheme]; !ok { + return nil, fmt.Errorf("Invalid signing scheme: '%v'", h.SigningScheme) + } + m := make(map[string]bool) + for _, h := range h.SignedHeaders { + if strings.ToLower(h) == strings.ToLower(HttpHeaderAuthorization) { + return nil, fmt.Errorf("Signed headers cannot include the 'Authorization' header") + } + m[h] = true + } + if len(m) != len(h.SignedHeaders) { + return nil, fmt.Errorf("List of signed headers cannot have duplicate names") + } + if h.SignatureMaxValidity < 0 { + return nil, fmt.Errorf("Signature max validity must be a positive value") + } + if err := h.loadPrivateKey(); err != nil { + return nil, err + } + return context.WithValue(ctx, ContextHttpSignatureAuth, *h), nil +} + +// GetPublicKey returns the public key associated with this HTTP signature configuration. +func (h *HttpSignatureAuth) GetPublicKey() (crypto.PublicKey, error) { + if h.privateKey == nil { + if err := h.loadPrivateKey(); err != nil { + return nil, err + } + } + switch key := h.privateKey.(type) { + case *rsa.PrivateKey: + return key.Public(), nil + case *ecdsa.PrivateKey: + return key.Public(), nil + default: + // Do not change '%T' to anything else such as '%v'! + // The value of the private key must not be returned. + return nil, fmt.Errorf("Unsupported key: %T", h.privateKey) + } +} + +// loadPrivateKey reads the private key from the file specified in the HttpSignatureAuth. +func (h *HttpSignatureAuth) loadPrivateKey() (err error) { + var file *os.File + file, err = os.Open(h.PrivateKeyPath) + if err != nil { + return fmt.Errorf("Cannot load private key '%s'. Error: %v", h.PrivateKeyPath, err) + } + defer func() { + err = file.Close() + }() + var priv []byte + priv, err = ioutil.ReadAll(file) + if err != nil { + return err + } + pemBlock, _ := pem.Decode(priv) + if pemBlock == nil { + // No PEM data has been found. + return fmt.Errorf("File '%s' does not contain PEM data", h.PrivateKeyPath) + } + var privKey []byte + if x509.IsEncryptedPEMBlock(pemBlock) { + // The PEM data is encrypted. + privKey, err = x509.DecryptPEMBlock(pemBlock, []byte(h.Passphrase)) + if err != nil { + // Failed to decrypt PEM block. Because of deficiencies in the encrypted-PEM format, + // it's not always possibleto detect an incorrect password. + return err + } + } else { + privKey = pemBlock.Bytes + } + switch pemBlock.Type { + case "RSA PRIVATE KEY": + if h.privateKey, err = x509.ParsePKCS1PrivateKey(privKey); err != nil { + return err + } + case "EC PRIVATE KEY", "PRIVATE KEY": + // https://tools.ietf.org/html/rfc5915 section 4. + if h.privateKey, err = x509.ParsePKCS8PrivateKey(privKey); err != nil { + return err + } + default: + return fmt.Errorf("Key '%s' is not supported", pemBlock.Type) + } + return nil +} + +// SignRequest signs the request using HTTP signature. +// See https://datatracker.ietf.org/doc/draft-cavage-http-signatures/ +// +// Do not add, remove or change headers that are included in the SignedHeaders +// after SignRequest has been invoked; this is because the header values are +// included in the signature. Any subsequent alteration will cause a signature +// verification failure. +// If there are multiple instances of the same header field, all +// header field values associated with the header field MUST be +// concatenated, separated by a ASCII comma and an ASCII space +// ', ', and used in the order in which they will appear in the +// transmitted HTTP message. +func SignRequest( + ctx context.Context, + r *http.Request, + auth HttpSignatureAuth) error { + + if auth.privateKey == nil { + return fmt.Errorf("Private key is not set") + } + now := time.Now() + date := now.UTC().Format(http.TimeFormat) + // The 'created' field expresses when the signature was created. + // The value MUST be a Unix timestamp integer value. See 'HTTP signature' section 2.1.4. + created := now.Unix() + + var h crypto.Hash + var err error + var prefix string + var expiresUnix float64 + + if auth.SignatureMaxValidity < 0 { + return fmt.Errorf("Signature validity must be a positive value") + } + if auth.SignatureMaxValidity > 0 { + e := now.Add(auth.SignatureMaxValidity) + expiresUnix = float64(e.Unix()) + float64(e.Nanosecond()) / float64(time.Second) + } + // Determine the cryptographic hash to be used for the signature and the body digest. + switch auth.SigningScheme { + case HttpSigningSchemeRsaSha512, HttpSigningSchemeHs2019: + h = crypto.SHA512 + prefix = "SHA-512=" + case HttpSigningSchemeRsaSha256: + // This is deprecated and should no longer be used. + h = crypto.SHA256 + prefix = "SHA-256=" + default: + return fmt.Errorf("Unsupported signature scheme: %v", auth.SigningScheme) + } + if !h.Available() { + return fmt.Errorf("Hash '%v' is not available", h) + } + + // Build the "(request-target)" signature header. + var sb bytes.Buffer + fmt.Fprintf(&sb, "%s %s", strings.ToLower(r.Method), r.URL.EscapedPath()) + if r.URL.RawQuery != "" { + // The ":path" pseudo-header field includes the path and query parts + // of the target URI (the "path-absolute" production and optionally a + // '?' character followed by the "query" production (see Sections 3.3 + // and 3.4 of [RFC3986] + fmt.Fprintf(&sb, "?%s", r.URL.RawQuery) + } + requestTarget := sb.String() + sb.Reset() + + // Build the string to be signed. + signedHeaders := auth.SignedHeaders + if len(signedHeaders) == 0 { + signedHeaders = []string{HttpSignatureParameterCreated} + } + // Validate the list of signed headers has no duplicates. + m := make(map[string]bool) + for _, h := range signedHeaders { + m[h] = true + } + if len(m) != len(signedHeaders) { + return fmt.Errorf("List of signed headers must not have any duplicates") + } + hasCreatedParameter := false + hasExpiresParameter := false + for i, header := range signedHeaders { + header = strings.ToLower(header) + var value string + switch header { + case strings.ToLower(HttpHeaderAuthorization): + return fmt.Errorf("Cannot include the 'Authorization' header as a signed header.") + case HttpSignatureParameterRequestTarget: + value = requestTarget + case HttpSignatureParameterCreated: + value = fmt.Sprintf("%d", created) + hasCreatedParameter = true + case HttpSignatureParameterExpires: + if auth.SignatureMaxValidity.Nanoseconds() == 0 { + return fmt.Errorf("Cannot set '(expires)' signature parameter. SignatureMaxValidity is not configured.") + } + value = fmt.Sprintf("%.3f", expiresUnix) + hasExpiresParameter = true + case "date": + value = date + r.Header.Set(HttpHeaderDate, date) + case "digest": + // Calculate the digest of the HTTP request body. + // Calculate body digest per RFC 3230 section 4.3.2 + bodyHash := h.New() + if r.Body != nil { + // Make a copy of the body io.Reader so that we can read the body to calculate the hash, + // then one more time when marshaling the request. + var body io.Reader + body, err = r.GetBody() + if err != nil { + return err + } + if _, err = io.Copy(bodyHash, body); err != nil { + return err + } + } + d := bodyHash.Sum(nil) + value = prefix + base64.StdEncoding.EncodeToString(d) + r.Header.Set(HttpHeaderDigest, value) + case "host": + value = r.Host + r.Header.Set(HttpHeaderHost, r.Host) + default: + var ok bool + var v []string + canonicalHeader := textproto.CanonicalMIMEHeaderKey(header) + if v, ok = r.Header[canonicalHeader]; !ok { + // If a header specified in the headers parameter cannot be matched with + // a provided header in the message, the implementation MUST produce an error. + return fmt.Errorf("Header '%s' does not exist in the request", canonicalHeader) + } + // If there are multiple instances of the same header field, all + // header field values associated with the header field MUST be + // concatenated, separated by a ASCII comma and an ASCII space + // `, `, and used in the order in which they will appear in the + // transmitted HTTP message. + value = strings.Join(v, ", ") + } + if i > 0 { + fmt.Fprintf(&sb, "\n") + } + fmt.Fprintf(&sb, "%s: %s", header, value) + } + if expiresUnix != 0 && !hasExpiresParameter { + return fmt.Errorf("SignatureMaxValidity is specified, but '(expired)' parameter is not present") + } + msg := []byte(sb.String()) + msgHash := h.New() + if _, err = msgHash.Write(msg); err != nil { + return err + } + d := msgHash.Sum(nil) + + var signature []byte + switch key := auth.privateKey.(type) { + case *rsa.PrivateKey: + switch auth.SigningAlgorithm { + case HttpSigningAlgorithmRsaPKCS1v15: + signature, err = rsa.SignPKCS1v15(rand.Reader, key, h, d) + case "", HttpSigningAlgorithmRsaPSS: + signature, err = rsa.SignPSS(rand.Reader, key, h, d, nil) + default: + return fmt.Errorf("Unsupported signing algorithm: '%s'", auth.SigningAlgorithm) + } + case *ecdsa.PrivateKey: + signature, err = key.Sign(rand.Reader, d, h) + case ed25519.PrivateKey: // requires go 1.13 + signature, err = key.Sign(rand.Reader, msg, crypto.Hash(0)) + default: + return fmt.Errorf("Unsupported private key") + } + if err != nil { + return err + } + + sb.Reset() + for i, header := range signedHeaders { + if i > 0 { + sb.WriteRune(' ') + } + sb.WriteString(strings.ToLower(header)) + } + headers_list := sb.String() + sb.Reset() + fmt.Fprintf(&sb, `Signature keyId="%s",algorithm="%s",`, auth.KeyId, auth.SigningScheme) + if hasCreatedParameter { + fmt.Fprintf(&sb, "created=%d,", created) + } + if hasExpiresParameter { + fmt.Fprintf(&sb, "expires=%.3f,", expiresUnix) + } + fmt.Fprintf(&sb, `headers="%s",signature="%s"`, headers_list, base64.StdEncoding.EncodeToString(signature)) + authStr := sb.String() + r.Header.Set(HttpHeaderAuthorization, authStr) + return nil +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/utils.go b/samples/openapi3/client/petstore/go/go-petstore/utils.go new file mode 100644 index 00000000000..9fb7a1847cd --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/utils.go @@ -0,0 +1,334 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "encoding/json" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given integer value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} -- GitLab From 4994c65a98f0c12d2824b0689f0611353ffd6b92 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Mon, 31 Aug 2020 15:51:55 +0800 Subject: [PATCH 04/10] update test --- .../codegen/go/GoClientCodegenTest.java | 19 ------------------- .../options/GoClientOptionsProvider.java | 7 ++----- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java index 417cd43ccd3..fa0060f4b75 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java @@ -29,25 +29,6 @@ import org.testng.annotations.Test; public class GoClientCodegenTest { - @Test - public void testInitialConfigValues() throws Exception { - final GoClientCodegen codegen = new GoClientCodegen(); - codegen.processOpts(); - - Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE); - Assert.assertEquals(codegen.isHideGenerationTimestamp(), true); - } - - @Test - public void testSettersForConfigValues() throws Exception { - final GoClientCodegen codegen = new GoClientCodegen(); - codegen.setHideGenerationTimestamp(false); - codegen.processOpts(); - - Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE); - Assert.assertEquals(codegen.isHideGenerationTimestamp(), false); - } - @Test public void testAdditionalPropertiesPutForConfigValues() throws Exception { final GoClientCodegen codegen = new GoClientCodegen(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java index 6345595d8e5..3b5c2414090 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java @@ -47,12 +47,9 @@ public class GoClientOptionsProvider implements OptionsProvider { .put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE) .put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true") .put(CodegenConstants.WITH_GO_CODEGEN_COMMENT, "true") - .put(CodegenConstants.WITH_XML, "true") - .put(CodegenConstants.ENUM_CLASS_PREFIX, "true") - .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, "true") .put(CodegenConstants.IS_GO_SUBMODULE, "true") - .put(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT, "true") - .put("structPrefix", "true") + .put(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, "true") + .put(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, "true") .build(); } -- GitLab From bb5299d23f2e7e623e03f7e6e508a34489d03a16 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Mon, 31 Aug 2020 16:04:25 +0800 Subject: [PATCH 05/10] update option test --- .../org/openapitools/codegen/go/GoClientOptionsTest.java | 7 +++---- .../codegen/options/GoClientOptionsProvider.java | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java index e6a65d953a9..7f245df462f 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java @@ -44,11 +44,10 @@ public class GoClientOptionsTest extends AbstractOptionsTest { verify(clientCodegen).setPackageVersion(GoClientOptionsProvider.PACKAGE_VERSION_VALUE); verify(clientCodegen).setPackageName(GoClientOptionsProvider.PACKAGE_NAME_VALUE); verify(clientCodegen).setWithGoCodegenComment(GoClientOptionsProvider.WITH_GO_CODEGEN_COMMENT_VALUE); - verify(clientCodegen).setWithXml(GoClientOptionsProvider.WITH_XML_VALUE); - verify(clientCodegen).setWithXml(GoClientOptionsProvider.ENUM_CLASS_PREFIX_VALUE); - verify(clientCodegen).setPrependFormOrBodyParameters(GoClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE); + verify(clientCodegen).setEnumClassPrefix(GoClientOptionsProvider.ENUM_CLASS_PREFIX_VALUE); verify(clientCodegen).setIsGoSubmodule(GoClientOptionsProvider.IS_GO_SUBMODULE_VALUE); verify(clientCodegen).setStructPrefix(GoClientOptionsProvider.STRUCT_PREFIX_VALUE); - verify(clientCodegen).setWithAWSV4Signature(GoClientOptionsProvider.WITH_AWSV4_SIGNATURE); + verify(clientCodegen).setUseOneOfDiscriminatorLookup(GoClientOptionsProvider.USE_ONEOF_DISCRIMINATOR_LOOKUP_VALUE); + verify(clientCodegen).setDisallowAdditionalPropertiesIfNotPresent(GoClientOptionsProvider.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_VALUE); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java index 3b5c2414090..5f3bf52b4ba 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java @@ -27,12 +27,11 @@ public class GoClientOptionsProvider implements OptionsProvider { public static final String PACKAGE_VERSION_VALUE = "1.0.0"; public static final String PACKAGE_NAME_VALUE = "Go"; public static final boolean WITH_GO_CODEGEN_COMMENT_VALUE = true; - public static final boolean WITH_XML_VALUE = true; public static final boolean ENUM_CLASS_PREFIX_VALUE = true; - public static final Boolean PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = true; public static final boolean IS_GO_SUBMODULE_VALUE = true; public static final boolean STRUCT_PREFIX_VALUE = true; - public static final boolean WITH_AWSV4_SIGNATURE = true; + public static final boolean USE_ONEOF_DISCRIMINATOR_LOOKUP_VALUE = true; + public static final boolean DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_VALUE = true; @Override public String getLanguage() { -- GitLab From 101d95606d294d6e8ed38d6271a67317fc1612c0 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Mon, 31 Aug 2020 16:19:24 +0800 Subject: [PATCH 06/10] fix enum prefix option --- .../openapitools/codegen/options/GoClientOptionsProvider.java | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java index 5f3bf52b4ba..65069b72718 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java @@ -46,6 +46,7 @@ public class GoClientOptionsProvider implements OptionsProvider { .put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE) .put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true") .put(CodegenConstants.WITH_GO_CODEGEN_COMMENT, "true") + .put(CodegenConstants.ENUM_CLASS_PREFIX, "true") .put(CodegenConstants.IS_GO_SUBMODULE, "true") .put(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, "true") .put(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, "true") -- GitLab From 94baa91c5e00de31433f14ba2fb7cb4d4768973e Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Mon, 31 Aug 2020 16:51:32 +0800 Subject: [PATCH 07/10] reove struct prefix test --- .../java/org/openapitools/codegen/go/GoClientOptionsTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java index 7f245df462f..b579459441e 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java @@ -46,7 +46,6 @@ public class GoClientOptionsTest extends AbstractOptionsTest { verify(clientCodegen).setWithGoCodegenComment(GoClientOptionsProvider.WITH_GO_CODEGEN_COMMENT_VALUE); verify(clientCodegen).setEnumClassPrefix(GoClientOptionsProvider.ENUM_CLASS_PREFIX_VALUE); verify(clientCodegen).setIsGoSubmodule(GoClientOptionsProvider.IS_GO_SUBMODULE_VALUE); - verify(clientCodegen).setStructPrefix(GoClientOptionsProvider.STRUCT_PREFIX_VALUE); verify(clientCodegen).setUseOneOfDiscriminatorLookup(GoClientOptionsProvider.USE_ONEOF_DISCRIMINATOR_LOOKUP_VALUE); verify(clientCodegen).setDisallowAdditionalPropertiesIfNotPresent(GoClientOptionsProvider.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_VALUE); } -- GitLab From c6c01e09d883ecfcb5e558cef9fb290bdea2f32c Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Mon, 31 Aug 2020 18:20:55 +0800 Subject: [PATCH 08/10] remove unused file, mark generator as stable --- ' | 244 ------------------ .../codegen/languages/GoClientCodegen.java | 2 +- 2 files changed, 1 insertion(+), 245 deletions(-) delete mode 100644 ' diff --git a/' b/' deleted file mode 100644 index 46392c1aad6..00000000000 --- a/' +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) - * Copyright 2018 SmartBear Software - * - * 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.languages; - -import org.openapitools.codegen.CliOption; -import org.openapitools.codegen.CodegenConstants; -import org.openapitools.codegen.CodegenType; -import org.openapitools.codegen.SupportingFile; -import org.openapitools.codegen.meta.features.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.util.EnumSet; - -public class GoDeprecatedClientCodegen extends AbstractGoCodegen { - - private static final Logger LOGGER = LoggerFactory.getLogger(GoDeprecatedClientCodegen.class); - - protected String packageVersion = "1.0.0"; - protected String apiDocPath = "docs/"; - protected String modelDocPath = "docs/"; - protected boolean isGoSubmodule = false; - public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment"; - public static final String WITH_XML = "withXml"; - public static final String STRUCT_PREFIX = "structPrefix"; - public static final String WITH_AWSV4_SIGNATURE = "withAWSV4Signature"; - - public GoDeprecatedClientCodegen() { - super(); - - modifyFeatureSet(features -> features - .includeDocumentationFeatures(DocumentationFeature.Readme) - .wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML)) - .securityFeatures(EnumSet.of( - SecurityFeature.BasicAuth, - SecurityFeature.ApiKey, - SecurityFeature.OAuth2_Implicit - )) - .includeGlobalFeatures( - GlobalFeature.ParameterizedServer - ) - .excludeGlobalFeatures( - GlobalFeature.XMLStructureDefinitions, - GlobalFeature.Callbacks, - GlobalFeature.LinkObjects, - GlobalFeature.ParameterStyling - ) - .excludeSchemaSupportFeatures( - SchemaSupportFeature.Polymorphism - ) - .includeParameterFeatures( - ParameterFeature.Cookie - ) - .includeClientModificationFeatures( - ClientModificationFeature.BasePath, - ClientModificationFeature.UserAgent - ) - ); - - outputFolder = "generated-code/go-deprecated"; - modelTemplateFiles.put("model.mustache", ".go"); - apiTemplateFiles.put("api.mustache", ".go"); - - modelDocTemplateFiles.put("model_doc.mustache", ".md"); - apiDocTemplateFiles.put("api_doc.mustache", ".md"); - - embeddedTemplateDir = templateDir = "go-deprecated"; - - // default HIDE_GENERATION_TIMESTAMP to true - hideGenerationTimestamp = Boolean.TRUE; - - cliOptions.add(CliOption.newBoolean(CodegenConstants.IS_GO_SUBMODULE, CodegenConstants.IS_GO_SUBMODULE_DESC)); - cliOptions.add(CliOption.newBoolean(WITH_GO_CODEGEN_COMMENT, "whether to include Go codegen comment to disable Go Lint and collapse by default in GitHub PRs and diffs")); - cliOptions.add(CliOption.newBoolean(WITH_XML, "whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)")); - cliOptions.add(CliOption.newBoolean(CodegenConstants.ENUM_CLASS_PREFIX, CodegenConstants.ENUM_CLASS_PREFIX_DESC)); - cliOptions.add(CliOption.newBoolean(STRUCT_PREFIX, "whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts")); - cliOptions.add(CliOption.newBoolean(WITH_AWSV4_SIGNATURE, "whether to include AWS v4 signature support")); - - // option to change the order of form/body parameter - cliOptions.add(CliOption.newBoolean( - CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, - CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS_DESC) - .defaultValue(Boolean.FALSE.toString())); - } - - @Override - public void processOpts() { - super.processOpts(); - - if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { - setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); - } else { - setPackageName("openapi"); - } - - if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) { - setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION)); - } else { - setPackageVersion("1.0.0"); - } - - additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); - additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion); - - additionalProperties.put("apiDocPath", apiDocPath); - additionalProperties.put("modelDocPath", modelDocPath); - - modelPackage = packageName; - apiPackage = packageName; - - supportingFiles.add(new SupportingFile("openapi.mustache", "api", "openapi.yaml")); - supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); - supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); - supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); - supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.go")); - supportingFiles.add(new SupportingFile("client.mustache", "", "client.go")); - supportingFiles.add(new SupportingFile("response.mustache", "", "response.go")); - supportingFiles.add(new SupportingFile("go.mod.mustache", "", "go.mod")); - supportingFiles.add(new SupportingFile("go.sum", "", "go.sum")); - supportingFiles.add(new SupportingFile(".travis.yml", "", ".travis.yml")); - - if (additionalProperties.containsKey(WITH_GO_CODEGEN_COMMENT)) { - setWithGoCodegenComment(Boolean.parseBoolean(additionalProperties.get(WITH_GO_CODEGEN_COMMENT).toString())); - additionalProperties.put(WITH_GO_CODEGEN_COMMENT, withGoCodegenComment); - } - - if (additionalProperties.containsKey(WITH_AWSV4_SIGNATURE)) { - setWithAWSV4Signature(Boolean.parseBoolean(additionalProperties.get(WITH_AWSV4_SIGNATURE).toString())); - additionalProperties.put(WITH_AWSV4_SIGNATURE, withAWSV4Signature); - } - - if (additionalProperties.containsKey(WITH_XML)) { - setWithXml(Boolean.parseBoolean(additionalProperties.get(WITH_XML).toString())); - additionalProperties.put(WITH_XML, withXml); - } - - if (additionalProperties.containsKey(CodegenConstants.ENUM_CLASS_PREFIX)) { - setEnumClassPrefix(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.ENUM_CLASS_PREFIX).toString())); - additionalProperties.put(CodegenConstants.ENUM_CLASS_PREFIX, enumClassPrefix); - } - - if (additionalProperties.containsKey(CodegenConstants.IS_GO_SUBMODULE)) { - setIsGoSubmodule(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.IS_GO_SUBMODULE).toString())); - additionalProperties.put(CodegenConstants.IS_GO_SUBMODULE, isGoSubmodule); - } - - if (additionalProperties.containsKey(STRUCT_PREFIX)) { - setStructPrefix(Boolean.parseBoolean(additionalProperties.get(STRUCT_PREFIX).toString())); - additionalProperties.put(STRUCT_PREFIX, structPrefix); - } - } - - /** - * Configures the type of generator. - * - * @return the CodegenType for this generator - * @see org.openapitools.codegen.CodegenType - */ - @Override - public CodegenType getTag() { - return CodegenType.CLIENT; - } - - /** - * Configures a friendly name for the generator. This will be used by the generator - * to select the library with the -g flag. - * - * @return the friendly name for the generator - */ - @Override - public String getName() { - return "go-deprecated"; - } - - /** - * Returns human-friendly help for the generator. Provide the consumer with help - * tips, parameters here - * - * @return A string value for the help message - */ - @Override - public String getHelp() { - return "Generates a Go client library (beta). NOTE: this generator has been dprecated. Please switch to `go` client generator instead."; - } - - /** - * Location to write api files. You can use the apiPackage() as defined when the class is - * instantiated - */ - @Override - public String apiFileFolder() { - return outputFolder + File.separator; - } - - @Override - public String modelFileFolder() { - return outputFolder + File.separator; - } - - @Override - public String apiDocFileFolder() { - return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); - } - - @Override - public String modelDocFileFolder() { - return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); - } - - @Override - public String toModelDocFilename(String name) { - return toModelName(name); - } - - @Override - public String toApiDocFilename(String name) { - return toApiName(name); - } - - public void setPackageVersion(String packageVersion) { - this.packageVersion = packageVersion; - } - - public void setIsGoSubmodule(boolean isGoSubmodule) { - this.isGoSubmodule = isGoSubmodule; - } - -} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java index 820f82e658e..06c0011f511 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java @@ -88,7 +88,7 @@ public class GoClientCodegen extends AbstractGoCodegen { usesOptionals = false; - generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata).stability(Stability.EXPERIMENTAL).build(); + generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata).stability(Stability.STABLE).build(); cliOptions.add(new CliOption(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC).defaultValue("false")); // option to change how we process + set the data in the 'additionalProperties' keyword. -- GitLab From 97fa965b51cc18397000c032b8bd407a14a7a777 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Mon, 31 Aug 2020 20:48:02 +0800 Subject: [PATCH 09/10] update doc --- docs/generators.md | 7 +- docs/generators/go-deprecated.md | 210 +++++++++++++++++++++++++++++++ docs/generators/go.md | 6 +- 3 files changed, 217 insertions(+), 6 deletions(-) create mode 100644 docs/generators/go-deprecated.md diff --git a/docs/generators.md b/docs/generators.md index 45fb3721dc7..0264e7bbce1 100644 --- a/docs/generators.md +++ b/docs/generators.md @@ -28,8 +28,7 @@ The following generators are available: * [erlang-client](generators/erlang-client.md) * [erlang-proper](generators/erlang-proper.md) * [flash-deprecated (deprecated)](generators/flash-deprecated.md) -* [go](generators/go.md) -* [go-experimental (experimental)](generators/go-experimental.md) +* [go-deprecated](generators/go-deprecated.md) * [groovy](generators/groovy.md) * [haskell-http-client](generators/haskell-http-client.md) * [java](generators/java.md) @@ -149,4 +148,8 @@ The following generators are available: * [protobuf-schema (beta)](generators/protobuf-schema.md) +## UNSPECIFIED generators +* [go](generators/go.md) + + diff --git a/docs/generators/go-deprecated.md b/docs/generators/go-deprecated.md new file mode 100644 index 00000000000..d2f334b01df --- /dev/null +++ b/docs/generators/go-deprecated.md @@ -0,0 +1,210 @@ +--- +title: Config Options for go-deprecated +sidebar_label: go-deprecated +--- + +| Option | Description | Values | Default | +| ------ | ----------- | ------ | ------- | +|enumClassPrefix|Prefix enum with class name| |false| +|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| +|isGoSubmodule|whether the generated Go module is a submodule| |false| +|packageName|Go package name (convention: lowercase).| |openapi| +|packageVersion|Go package version.| |1.0.0| +|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| +|structPrefix|whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts| |false| +|withAWSV4Signature|whether to include AWS v4 signature support| |false| +|withGoCodegenComment|whether to include Go codegen comment to disable Go Lint and collapse by default in GitHub PRs and diffs| |false| +|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| + +## IMPORT MAPPING + +| Type/Alias | Imports | +| ---------- | ------- | + + +## INSTANTIATION TYPES + +| Type/Alias | Instantiated By | +| ---------- | --------------- | + + +## LANGUAGE PRIMITIVES + +<ul class="column-ul"> +<li>bool</li> +<li>byte</li> +<li>complex128</li> +<li>complex64</li> +<li>float32</li> +<li>float64</li> +<li>int</li> +<li>int32</li> +<li>int64</li> +<li>interface{}</li> +<li>map[string]interface{}</li> +<li>rune</li> +<li>string</li> +<li>uint</li> +<li>uint32</li> +<li>uint64</li> +</ul> + +## RESERVED WORDS + +<ul class="column-ul"> +<li>bool</li> +<li>break</li> +<li>byte</li> +<li>case</li> +<li>chan</li> +<li>complex128</li> +<li>complex64</li> +<li>const</li> +<li>continue</li> +<li>default</li> +<li>defer</li> +<li>else</li> +<li>error</li> +<li>fallthrough</li> +<li>float32</li> +<li>float64</li> +<li>for</li> +<li>func</li> +<li>go</li> +<li>goto</li> +<li>if</li> +<li>import</li> +<li>int</li> +<li>int16</li> +<li>int32</li> +<li>int64</li> +<li>int8</li> +<li>interface</li> +<li>map</li> +<li>nil</li> +<li>package</li> +<li>range</li> +<li>return</li> +<li>rune</li> +<li>select</li> +<li>string</li> +<li>struct</li> +<li>switch</li> +<li>type</li> +<li>uint</li> +<li>uint16</li> +<li>uint32</li> +<li>uint64</li> +<li>uint8</li> +<li>uintptr</li> +<li>var</li> +</ul> + +## FEATURE SET + + +### Client Modification Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasePath|✓|ToolingExtension +|Authorizations|✗|ToolingExtension +|UserAgent|✓|ToolingExtension +|MockServer|✗|ToolingExtension + +### Data Type Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Custom|✗|OAS2,OAS3 +|Int32|✓|OAS2,OAS3 +|Int64|✓|OAS2,OAS3 +|Float|✓|OAS2,OAS3 +|Double|✓|OAS2,OAS3 +|Decimal|✓|ToolingExtension +|String|✓|OAS2,OAS3 +|Byte|✓|OAS2,OAS3 +|Binary|✓|OAS2,OAS3 +|Boolean|✓|OAS2,OAS3 +|Date|✓|OAS2,OAS3 +|DateTime|✓|OAS2,OAS3 +|Password|✓|OAS2,OAS3 +|File|✓|OAS2 +|Array|✓|OAS2,OAS3 +|Maps|✓|ToolingExtension +|CollectionFormat|✓|OAS2 +|CollectionFormatMulti|✓|OAS2 +|Enum|✓|OAS2,OAS3 +|ArrayOfEnum|✓|ToolingExtension +|ArrayOfModel|✓|ToolingExtension +|ArrayOfCollectionOfPrimitives|✓|ToolingExtension +|ArrayOfCollectionOfModel|✓|ToolingExtension +|ArrayOfCollectionOfEnum|✓|ToolingExtension +|MapOfEnum|✓|ToolingExtension +|MapOfModel|✓|ToolingExtension +|MapOfCollectionOfPrimitives|✓|ToolingExtension +|MapOfCollectionOfModel|✓|ToolingExtension +|MapOfCollectionOfEnum|✓|ToolingExtension + +### Documentation Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Readme|✓|ToolingExtension +|Model|✓|ToolingExtension +|Api|✓|ToolingExtension + +### Global Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Host|✓|OAS2,OAS3 +|BasePath|✓|OAS2,OAS3 +|Info|✓|OAS2,OAS3 +|Schemes|✗|OAS2,OAS3 +|PartialSchemes|✓|OAS2,OAS3 +|Consumes|✓|OAS2 +|Produces|✓|OAS2 +|ExternalDocumentation|✓|OAS2,OAS3 +|Examples|✓|OAS2,OAS3 +|XMLStructureDefinitions|✗|OAS2,OAS3 +|MultiServer|✗|OAS3 +|ParameterizedServer|✓|OAS3 +|ParameterStyling|✗|OAS3 +|Callbacks|✗|OAS3 +|LinkObjects|✗|OAS3 + +### Parameter Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Path|✓|OAS2,OAS3 +|Query|✓|OAS2,OAS3 +|Header|✓|OAS2,OAS3 +|Body|✓|OAS2 +|FormUnencoded|✓|OAS2 +|FormMultipart|✓|OAS2 +|Cookie|✓|OAS3 + +### Schema Support Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Simple|✓|OAS2,OAS3 +|Composite|✓|OAS2,OAS3 +|Polymorphism|✗|OAS2,OAS3 +|Union|✗|OAS3 + +### Security Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 +|OpenIDConnect|✗|OAS3 +|BearerToken|✗|OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 +|OAuth2_Password|✗|OAS2,OAS3 +|OAuth2_ClientCredentials|✗|OAS2,OAS3 +|OAuth2_AuthorizationCode|✗|OAS2,OAS3 + +### Wire Format Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|JSON|✓|OAS2,OAS3 +|XML|✓|OAS2,OAS3 +|PROTOBUF|✗|ToolingExtension +|Custom|✗|OAS2,OAS3 diff --git a/docs/generators/go.md b/docs/generators/go.md index 68985fbea68..ce1028a487d 100644 --- a/docs/generators/go.md +++ b/docs/generators/go.md @@ -5,16 +5,14 @@ sidebar_label: go | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|disallowAdditionalPropertiesIfNotPresent|Specify the behavior when the 'additionalProperties' keyword is not present in the OAS document. If false: the 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. If true: when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.This setting is currently ignored for OAS 2.0 documents: 1) When the 'additionalProperties' keyword is not present in a 2.0 schema, additional properties are NOT allowed. 2) Boolean values of the 'additionalProperties' keyword are ignored. It's as if additional properties are NOT allowed.Note: the root cause are issues #1369 and #1371, which must be resolved in the swagger-parser project.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.</dd></dl>|true| |enumClassPrefix|Prefix enum with class name| |false| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |isGoSubmodule|whether the generated Go module is a submodule| |false| |packageName|Go package name (convention: lowercase).| |openapi| |packageVersion|Go package version.| |1.0.0| -|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| -|structPrefix|whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts| |false| -|withAWSV4Signature|whether to include AWS v4 signature support| |false| +|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and onlye one match in oneOf's schemas) will be skipped.| |false| |withGoCodegenComment|whether to include Go codegen comment to disable Go Lint and collapse by default in GitHub PRs and diffs| |false| -|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| ## IMPORT MAPPING -- GitLab From 66cfedd35b0118758e3aedeaa1ccdc2e7de01cb4 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Mon, 31 Aug 2020 20:58:42 +0800 Subject: [PATCH 10/10] mark the generator as deprecated --- .../org/openapitools/codegen/languages/GoClientCodegen.java | 1 + .../codegen/languages/GoDeprecatedClientCodegen.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java index 06c0011f511..388b4d076c1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java @@ -1,5 +1,6 @@ /* * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoDeprecatedClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoDeprecatedClientCodegen.java index 46392c1aad6..abc58f47e0a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoDeprecatedClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoDeprecatedClientCodegen.java @@ -21,6 +21,8 @@ import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.CodegenType; import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.meta.GeneratorMetadata; +import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.meta.features.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -73,6 +75,8 @@ public class GoDeprecatedClientCodegen extends AbstractGoCodegen { ) ); + generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata).stability(Stability.DEPRECATED).build(); + outputFolder = "generated-code/go-deprecated"; modelTemplateFiles.put("model.mustache", ".go"); apiTemplateFiles.put("api.mustache", ".go"); -- GitLab