[Golang][client] Add option for standard Go generated code comment (#555)

* update go generated code comment

* update samples for go petstore

* update code generation comment

* update samples for go petstore

* Trigger CI due to previous Shippable race condition

* add -DwithGoCodegenComment=true option

* reset samples

* add withGoCodegenComment=true to bin/go-petstore-withxml.sh

* update samples/.../go-petstore-withXml using -DwithGoCodegenComment=true
This commit is contained in:
John Wang 2018-07-18 21:21:51 -07:00 committed by William Cheng
parent 995edc0b75
commit 0f0d8a01cb
55 changed files with 308 additions and 192 deletions

View File

@ -30,6 +30,6 @@ rm -rf samples/client/petstore/go/go-petstore-withXml
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/go -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g go -o samples/client/petstore/go/go-petstore-withXml -DpackageName=petstore,withXml=true $@"
ags="generate -t modules/openapi-generator/src/main/resources/go -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g go -o samples/client/petstore/go/go-petstore-withXml -DpackageName=petstore,withXml=true,withGoCodegenComment=true $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -56,6 +56,9 @@ public class CodegenConstants {
public static final String PYTHON_PACKAGE_NAME = "pythonPackageName";
public static final String PYTHON_PACKAGE_NAME_DESC = "package name for generated python code";
public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment";
public static final String WITH_GO_CODEGEN_COMMENT_DESC = "whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs";
public static final String GROUP_ID = "groupId";
public static final String GROUP_ID_DESC = "groupId in generated pom.xml";

View File

@ -37,6 +37,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractGoCodegen.class);
protected boolean withGoCodegenComment = false;
protected boolean withXml = false;
protected String packageName = "openapi";
@ -584,6 +585,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
}
}
public void setWithGoCodegenComment(boolean withGoCodegenComment) {
this.withGoCodegenComment = withGoCodegenComment;
}
public void setWithXml(boolean withXml) {
this.withXml = withXml;
}

View File

@ -30,6 +30,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
protected String packageVersion = "1.0.0";
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment";
public static final String WITH_XML = "withXml";
public GoClientCodegen() {
@ -49,8 +50,10 @@ public class GoClientCodegen extends AbstractGoCodegen {
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_VERSION, "Go package version.")
.defaultValue("1.0.0"));
cliOptions.add(CliOption.newBoolean(WITH_GO_CODEGEN_COMMENT, "whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in 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)"));
// option to change the order of form/body parameter
cliOptions.add(CliOption.newBoolean(
CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS,
@ -93,6 +96,13 @@ public class GoClientCodegen extends AbstractGoCodegen {
supportingFiles.add(new SupportingFile("response.mustache", "", "response.go"));
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()));
if (withGoCodegenComment) {
additionalProperties.put(WITH_GO_CODEGEN_COMMENT, "true");
}
}
if (additionalProperties.containsKey(WITH_XML)) {
setWithXml(Boolean.parseBoolean(additionalProperties.get(WITH_XML).toString()));
if (withXml) {

View File

@ -13,5 +13,11 @@
{{#infoEmail}}
* Contact: {{{infoEmail}}}
{{/infoEmail}}
{{^withGoCodegenComment}}
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
{{/withGoCodegenComment}}
*/
{{#withGoCodegenComment}}
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
{{/withGoCodegenComment}}

View File

@ -47,6 +47,8 @@ public class GoClientOptionsTest extends AbstractOptionsTest {
times = 1;
clientCodegen.setPackageName(GoClientOptionsProvider.PACKAGE_NAME_VALUE);
times = 1;
clientCodegen.setWithGoCodegenComment(GoClientOptionsProvider.WITH_GO_CODEGEN_COMMENT_VALUE);
times = 1;
clientCodegen.setWithXml(GoClientOptionsProvider.WITH_XML_VALUE);
times = 1;
clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(GoClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE));

View File

@ -28,6 +28,7 @@ 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 PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = true;
@ -43,6 +44,7 @@ public class GoClientOptionsProvider implements OptionsProvider {
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
.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.PREPEND_FORM_OR_BODY_PARAMETERS, "true")
.build();

View File

@ -1 +1 @@
3.1.0-SNAPSHOT
3.1.1-SNAPSHOT

View File

@ -1008,12 +1008,12 @@ paths:
additionalMetadata:
description: Additional data to pass to server
type: string
file:
requiredFile:
description: file to upload
format: binary
type: string
required:
- file
- requiredFile
required: true
responses:
200:
@ -1507,6 +1507,7 @@ components:
$ref: '#/components/schemas/Animal'
type: array
File:
description: Must be named `File` for test.
example:
sourceURI: sourceURI
properties:

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
@ -34,9 +35,10 @@ To test special tags
func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, client Client) (Client, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Patch")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Client
)
@ -66,7 +68,7 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, client Clie
}
// body params
localVarPostBody = &client
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
@ -42,9 +43,10 @@ type FakeOuterBooleanSerializeOpts struct {
func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue bool
)
@ -77,7 +79,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar
localVarPostBody = localVarOptionals.Body.Value()
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -138,9 +140,10 @@ type FakeOuterCompositeSerializeOpts struct {
func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue OuterComposite
)
@ -177,7 +180,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV
localVarPostBody = &localVarOptionalOuterComposite
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -238,9 +241,10 @@ type FakeOuterNumberSerializeOpts struct {
func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue float32
)
@ -273,7 +277,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO
localVarPostBody = localVarOptionals.Body.Value()
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -334,9 +338,10 @@ type FakeOuterStringSerializeOpts struct {
func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue string
)
@ -369,7 +374,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
localVarPostBody = localVarOptionals.Body.Value()
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -423,9 +428,10 @@ For this test, the body for this request much reference a schema named `Fil
func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, fileSchemaTestClass FileSchemaTestClass) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -454,7 +460,7 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, fileSchemaT
}
// body params
localVarPostBody = &fileSchemaTestClass
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -490,9 +496,10 @@ FakeApiService
func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query string, user User) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -522,7 +529,7 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query stri
}
// body params
localVarPostBody = &user
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -559,9 +566,10 @@ To test \"client\" model
func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Client, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Patch")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Client
)
@ -591,7 +599,7 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl
}
// body params
localVarPostBody = &client
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -673,9 +681,10 @@ type TestEndpointParametersOpts struct {
func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -733,6 +742,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
}
localVarFormParams.Add("pattern_without_delimiter", parameterToString(patternWithoutDelimiter, ""))
localVarFormParams.Add("byte", parameterToString(byte_, ""))
localVarFormFileName = "binary"
var localVarFile *os.File
if localVarOptionals != nil && localVarOptionals.Binary.IsSet() {
localVarFileOk := false
@ -759,7 +769,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
if localVarOptionals != nil && localVarOptionals.Callback.IsSet() {
localVarFormParams.Add("callback", parameterToString(localVarOptionals.Callback.Value(), ""))
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -815,9 +825,10 @@ type TestEnumParametersOpts struct {
func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptionals *TestEnumParametersOpts) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -868,7 +879,7 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
if localVarOptionals != nil && localVarOptionals.EnumFormString.IsSet() {
localVarFormParams.Add("enum_form_string", parameterToString(localVarOptionals.EnumFormString.Value(), ""))
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -903,9 +914,10 @@ FakeApiService test inline additionalProperties
func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, requestBody map[string]string) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -934,7 +946,7 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, req
}
// body params
localVarPostBody = &requestBody
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -970,9 +982,10 @@ FakeApiService test json serialization of form data
func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, param2 string) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -1001,7 +1014,7 @@ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, par
}
localVarFormParams.Add("param", parameterToString(param, ""))
localVarFormParams.Add("param2", parameterToString(param2, ""))
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
@ -34,9 +35,10 @@ To test class name in snake case
func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, client Client) (Client, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Patch")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Client
)
@ -79,7 +81,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, clie
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
@ -35,9 +36,10 @@ PetApiService Add a new pet to the store
func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -66,7 +68,7 @@ func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, er
}
// body params
localVarPostBody = &pet
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -108,9 +110,10 @@ type DeletePetOpts struct {
func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals *DeletePetOpts) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Delete")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -141,7 +144,7 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
if localVarOptionals != nil && localVarOptionals.ApiKey.IsSet() {
localVarHeaderParams["api_key"] = parameterToString(localVarOptionals.ApiKey.Value(), "")
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -178,9 +181,10 @@ Multiple status values can be provided with comma separated strings
func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []Pet
)
@ -209,7 +213,7 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -264,9 +268,10 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []Pet
)
@ -295,7 +300,7 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -350,9 +355,10 @@ Returns a single pet
func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Pet
)
@ -394,7 +400,7 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -447,9 +453,10 @@ PetApiService Update an existing pet
func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -478,7 +485,7 @@ func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response,
}
// body params
localVarPostBody = &pet
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -522,9 +529,10 @@ type UpdatePetWithFormOpts struct {
func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -558,7 +566,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
if localVarOptionals != nil && localVarOptionals.Status.IsSet() {
localVarFormParams.Add("status", parameterToString(localVarOptionals.Status.Value(), ""))
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -603,9 +611,10 @@ type UploadFileOpts struct {
func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue ApiResponse
)
@ -637,6 +646,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() {
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), ""))
}
localVarFormFileName = "file"
var localVarFile *os.File
if localVarOptionals != nil && localVarOptionals.File.IsSet() {
localVarFileOk := false
@ -651,7 +661,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
localVarFileName = localVarFile.Name()
localVarFile.Close()
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -700,7 +710,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
PetApiService 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
* @param file file to upload
* @param requiredFile file to upload
* @param optional nil or *UploadFileWithRequiredFileOpts - Optional Parameters:
* @param "AdditionalMetadata" (optional.String) - Additional data to pass to server
@return ApiResponse
@ -710,12 +720,13 @@ type UploadFileWithRequiredFileOpts struct {
AdditionalMetadata optional.String
}
func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId int64, file *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *http.Response, error) {
func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue ApiResponse
)
@ -747,14 +758,15 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId in
if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() {
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), ""))
}
localVarFile := file
localVarFormFileName = "requiredFile"
localVarFile := requiredFile
if localVarFile != nil {
fbs, _ := ioutil.ReadAll(localVarFile)
localVarFileBytes = fbs
localVarFileName = localVarFile.Name()
localVarFile.Close()
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
@ -34,9 +35,10 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or
func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Delete")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -64,7 +66,7 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*htt
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -100,9 +102,10 @@ Returns a map of status codes to quantities
func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue map[string]int32
)
@ -143,7 +146,7 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -198,9 +201,10 @@ For valid response try integer IDs with value <= 5 or > 10. Other val
func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Order
)
@ -235,7 +239,7 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -289,9 +293,10 @@ StoreApiService Place an order for a pet
func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Order
)
@ -321,7 +326,7 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *
}
// body params
localVarPostBody = &order
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
@ -34,9 +35,10 @@ This can only be done by the logged in user.
func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -65,7 +67,7 @@ func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Respo
}
// body params
localVarPostBody = &user
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -100,9 +102,10 @@ UserApiService Creates list of users with given input array
func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []User) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -131,7 +134,7 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []U
}
// body params
localVarPostBody = &user
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -166,9 +169,10 @@ UserApiService Creates list of users with given input array
func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []User) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -197,7 +201,7 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []Us
}
// body params
localVarPostBody = &user
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -233,9 +237,10 @@ This can only be done by the logged in user.
func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Delete")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -263,7 +268,7 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -299,9 +304,10 @@ UserApiService Get user by user name
func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue User
)
@ -330,7 +336,7 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -385,9 +391,10 @@ UserApiService Logs user into the system
func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue string
)
@ -417,7 +424,7 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -469,9 +476,10 @@ UserApiService Logs out current logged in user session
func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -498,7 +506,7 @@ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -535,9 +543,10 @@ This can only be done by the logged in user.
func (a *UserApiService) UpdateUser(ctx context.Context, username string, user User) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -567,7 +576,7 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, user U
}
// body params
localVarPostBody = &user
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
@ -153,6 +154,8 @@ func parameterToString(obj interface{}, collectionFormat string) string {
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)
@ -176,6 +179,7 @@ func (c *APIClient) prepareRequest(
headerParams map[string]string,
queryParams url.Values,
formParams url.Values,
formFileName string,
fileName string,
fileBytes []byte) (localVarRequest *http.Request, err error) {
@ -218,7 +222,7 @@ func (c *APIClient) prepareRequest(
if len(fileBytes) > 0 && fileName != "" {
w.Boundary()
//_, fileNm := filepath.Split(fileName)
part, err := w.CreateFormFile("file", filepath.Base(fileName))
part, err := w.CreateFormFile(formFileName, filepath.Base(fileName))
if err != nil {
return nil, err
}
@ -438,8 +442,9 @@ func CacheExpires(r *http.Response) time.Time {
lifetime, err := time.ParseDuration(maxAge + "s")
if err != nil {
expires = now
} else {
expires = now.Add(lifetime)
}
expires = now.Add(lifetime)
} else {
expiresHeader := r.Header.Get("Expires")
if expiresHeader != "" {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (

View File

@ -259,7 +259,7 @@ Name | Type | Description | Notes
[[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, file, optional)
> ApiResponse UploadFileWithRequiredFile(ctx, petId, requiredFile, optional)
uploads an image (required)
### Required Parameters
@ -268,7 +268,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**petId** | **int64**| ID of pet to update |
**file** | ***os.File*****os.File**| file to upload |
**requiredFile** | ***os.File*****os.File**| file to upload |
**optional** | ***UploadFileWithRequiredFileOpts** | optional parameters | nil if no parameters
### Optional Parameters

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
// Model for testing model name starting with number

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type AdditionalPropertiesClass struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Animal struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type AnimalFarm struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type ApiResponse struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type ArrayOfArrayOfNumberOnly struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type ArrayOfNumberOnly struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type ArrayTest struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Capitalization struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Cat struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Category struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
// Model for testing model with \"_class\" property

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Client struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Dog struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type EnumArrays struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type EnumClass string

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type EnumTest struct {

View File

@ -4,11 +4,13 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
// Must be named `File` for test.
type File struct {
// Test capitalization
SourceURI string `json:"sourceURI,omitempty" xml:"sourceURI"`

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type FileSchemaTestClass struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
"os"

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type HasOnlyReadOnly struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type List struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type MapTest struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
"time"

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
// Model for testing model name same as property name

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type NumberOnly struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
"time"

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type OuterComposite struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type OuterEnum string

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Pet struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type ReadOnlyFirst struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
// Model for testing reserved words

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type SpecialModelName struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type StringBooleanMap struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Tag struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type User struct {

View File

@ -4,9 +4,10 @@
* 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)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (