From bf0968bbaf0ee412e5a55a6b866b4b43cd339568 Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Thu, 9 Apr 2020 18:11:25 -0500 Subject: [PATCH 01/16] [Go]: Interface definitions for api functions * Fix #2294 with code suggested by @partkyle --- .../src/main/resources/go/api.mustache | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/go/api.mustache b/modules/openapi-generator/src/main/resources/go/api.mustache index e5d81ff292a4..be5aa98849f0 100644 --- a/modules/openapi-generator/src/main/resources/go/api.mustache +++ b/modules/openapi-generator/src/main/resources/go/api.mustache @@ -17,6 +17,35 @@ var ( _ _context.Context ) +type {{classname}} interface { +{{#operation}} + /* + {{{classname}}}Service{{#summary}} {{{.}}}{{/summary}} + {{#notes}} + {{notes}} + {{/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 *{{{nickname}}}Opts - Optional Parameters: + {{#allParams}} + {{^required}} + * @param "{{vendorExtensions.x-exportParamName}}" ({{#isPrimitiveType}}{{^isBinary}}optional.{{vendorExtensions.x-optionalDataType}}{{/isBinary}}{{#isBinary}}optional.Interface of {{dataType}}{{/isBinary}}{{/isPrimitiveType}}{{^isPrimitiveType}}optional.Interface of {{dataType}}{{/isPrimitiveType}}) - {{#description}} {{{.}}}{{/description}} + {{/required}} + {{/allParams}} + {{/hasOptionalParams}} + {{#returnType}} + @return {{{returnType}}} + {{/returnType}} + */ + {{{nickname}}}(ctx context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*http.Response, error) +{{/operation}} +} + // {{classname}}Service {{classname}} service type {{classname}}Service service {{#operation}} From a3454a3a6178da2ced3fb53baafaa68d2c35a1d7 Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Fri, 10 Apr 2020 17:22:16 -0500 Subject: [PATCH 02/16] Use interface in client struct --- modules/openapi-generator/src/main/resources/go/client.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/go/client.mustache b/modules/openapi-generator/src/main/resources/go/client.mustache index 8dcefae5f865..70b0055668a0 100644 --- a/modules/openapi-generator/src/main/resources/go/client.mustache +++ b/modules/openapi-generator/src/main/resources/go/client.mustache @@ -47,7 +47,7 @@ type APIClient struct { {{#apis}} {{#operations}} - {{classname}} *{{classname}}Service + {{classname}} {{classname}} {{/operations}} {{/apis}} {{/apiInfo}} From 1b50c28ca5fb336ad1587e53b481f0455389bb41 Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Fri, 10 Apr 2020 10:58:53 -0500 Subject: [PATCH 03/16] Fixups to align with current master --- .../openapi-generator/src/main/resources/go/api.mustache | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/go/api.mustache b/modules/openapi-generator/src/main/resources/go/api.mustache index be5aa98849f0..46e6ee000a18 100644 --- a/modules/openapi-generator/src/main/resources/go/api.mustache +++ b/modules/openapi-generator/src/main/resources/go/api.mustache @@ -24,17 +24,17 @@ type {{classname}} interface { {{#notes}} {{notes}} {{/notes}} - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @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 *{{{nickname}}}Opts - Optional Parameters: + * @param optional nil or *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts - Optional Parameters: {{#allParams}} {{^required}} - * @param "{{vendorExtensions.x-exportParamName}}" ({{#isPrimitiveType}}{{^isBinary}}optional.{{vendorExtensions.x-optionalDataType}}{{/isBinary}}{{#isBinary}}optional.Interface of {{dataType}}{{/isBinary}}{{/isPrimitiveType}}{{^isPrimitiveType}}optional.Interface of {{dataType}}{{/isPrimitiveType}}) - {{#description}} {{{.}}}{{/description}} + * @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}} @@ -42,7 +42,7 @@ type {{classname}} interface { @return {{{returnType}}} {{/returnType}} */ - {{{nickname}}}(ctx context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*http.Response, error) + {{{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) {{/operation}} } From a06ed942f9d15ba7b1369c9f02d468877f925bb2 Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Thu, 9 Apr 2020 18:20:02 -0500 Subject: [PATCH 04/16] Replace classname with method name in method comments --- modules/openapi-generator/src/main/resources/go/api.mustache | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/go/api.mustache b/modules/openapi-generator/src/main/resources/go/api.mustache index 46e6ee000a18..44738753f0bd 100644 --- a/modules/openapi-generator/src/main/resources/go/api.mustache +++ b/modules/openapi-generator/src/main/resources/go/api.mustache @@ -19,8 +19,9 @@ var ( type {{classname}} interface { {{#operation}} + /* - {{{classname}}}Service{{#summary}} {{{.}}}{{/summary}} + {{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} {{#notes}} {{notes}} {{/notes}} From b5abc28e28f5d0b4d1a3be3f47f8f47b81725406 Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Fri, 10 Apr 2020 18:16:15 -0500 Subject: [PATCH 05/16] Make method comments a bit prettier --- .../src/main/resources/go/api.mustache | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/go/api.mustache b/modules/openapi-generator/src/main/resources/go/api.mustache index 44738753f0bd..ca8f35342e27 100644 --- a/modules/openapi-generator/src/main/resources/go/api.mustache +++ b/modules/openapi-generator/src/main/resources/go/api.mustache @@ -21,28 +21,30 @@ type {{classname}} interface { {{#operation}} /* - {{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} + * {{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} + * {{#notes}} - {{notes}} + * {{notes}} + * {{/notes}} - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). {{#allParams}} {{#required}} - * @param {{paramName}}{{#description}} {{{.}}}{{/description}} + * @param {{paramName}}{{#description}} {{{.}}}{{/description}} {{/required}} {{/allParams}} {{#hasOptionalParams}} - * @param optional nil or *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts - Optional Parameters: + * @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}} + * @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 {{{returnType}}} + * @return {{{returnType}}} {{/returnType}} - */ + */ {{{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) {{/operation}} } @@ -73,9 +75,11 @@ type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts struct { {{/hasOptionalParams}} /* -{{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} + * {{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} + * {{#notes}} -{{notes}} + * {{notes}} + * {{/notes}} * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). {{#allParams}} @@ -92,9 +96,9 @@ type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts struct { {{/allParams}} {{/hasOptionalParams}} {{#returnType}} -@return {{{returnType}}} + * @return {{{returnType}}} {{/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) { var ( localVarHTTPMethod = _nethttp.Method{{httpMethod}} From 7bca6e019c9affab2af4ec776f645f0771c91ca7 Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Fri, 10 Apr 2020 22:46:45 -0500 Subject: [PATCH 06/16] Add commandline option to enable generateInterfaces --- docs/generators/go.md | 1 + .../openapitools/codegen/languages/AbstractGoCodegen.java | 5 +++++ .../openapitools/codegen/languages/GoClientCodegen.java | 7 +++++++ .../openapi-generator/src/main/resources/go/api.mustache | 2 ++ .../src/main/resources/go/client.mustache | 5 +++++ .../org/openapitools/codegen/go/GoClientOptionsTest.java | 3 ++- .../codegen/options/GoClientOptionsProvider.java | 2 ++ 7 files changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/generators/go.md b/docs/generators/go.md index 68985fbea688..6a8ad90d7f16 100644 --- a/docs/generators/go.md +++ b/docs/generators/go.md @@ -6,6 +6,7 @@ sidebar_label: go | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | |enumClassPrefix|Prefix enum with class name| |false| +|generateInterfaces|Generate interfaces for api classes| |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| 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 c9cb89877774..c64bfa64f81d 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 @@ -42,6 +42,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege protected boolean withXml = false; protected boolean enumClassPrefix = false; protected boolean structPrefix = false; + protected boolean generateInterfaces = false; protected String packageName = "openapi"; protected Set numberTypes; @@ -780,6 +781,10 @@ public void setStructPrefix(boolean structPrefix) { this.structPrefix = structPrefix; } + public void setGenerateInterfaces(boolean generateInterfaces) { + this.generateInterfaces = generateInterfaces; + } + @Override public String toDefaultValue(Schema schema) { if (schema.getDefault() != null) { 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 33dda391ee54..4f2dbf0fbeef 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 @@ -40,6 +40,7 @@ public class GoClientCodegen extends AbstractGoCodegen { public static final String WITH_XML = "withXml"; public static final String STRUCT_PREFIX = "structPrefix"; public static final String WITH_AWSV4_SIGNATURE = "withAWSV4Signature"; + public static final String GENERATE_INTERFACES = "generateInterfaces"; public GoClientCodegen() { super(); @@ -91,6 +92,7 @@ public GoClientCodegen() { 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")); + cliOptions.add(CliOption.newBoolean(GENERATE_INTERFACES, "Generate interfaces for api classes")); // option to change the order of form/body parameter cliOptions.add(CliOption.newBoolean( @@ -164,6 +166,11 @@ public void processOpts() { setStructPrefix(Boolean.parseBoolean(additionalProperties.get(STRUCT_PREFIX).toString())); additionalProperties.put(STRUCT_PREFIX, structPrefix); } + + if (additionalProperties.containsKey(GENERATE_INTERFACES)) { + setGenerateInterfaces(Boolean.parseBoolean(additionalProperties.get(GENERATE_INTERFACES).toString())); + additionalProperties.put(GENERATE_INTERFACES, generateInterfaces); + } } /** diff --git a/modules/openapi-generator/src/main/resources/go/api.mustache b/modules/openapi-generator/src/main/resources/go/api.mustache index ca8f35342e27..95875da699b5 100644 --- a/modules/openapi-generator/src/main/resources/go/api.mustache +++ b/modules/openapi-generator/src/main/resources/go/api.mustache @@ -17,6 +17,7 @@ var ( _ _context.Context ) +{{#generateInterfaces}} type {{classname}} interface { {{#operation}} @@ -49,6 +50,7 @@ type {{classname}} interface { {{/operation}} } +{{/generateInterfaces}} // {{classname}}Service {{classname}} service type {{classname}}Service service {{#operation}} diff --git a/modules/openapi-generator/src/main/resources/go/client.mustache b/modules/openapi-generator/src/main/resources/go/client.mustache index 70b0055668a0..a3723b68602c 100644 --- a/modules/openapi-generator/src/main/resources/go/client.mustache +++ b/modules/openapi-generator/src/main/resources/go/client.mustache @@ -47,7 +47,12 @@ type APIClient struct { {{#apis}} {{#operations}} +{{#generateInterfaces}} {{classname}} {{classname}} +{{/generateInterfaces}} +{{^generateInterfaces}} + {{classname}} *{{classname}}Service +{{/generateInterfaces}} {{/operations}} {{/apis}} {{/apiInfo}} 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 e6a65d953a9a..386b9f808d96 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 @@ -45,10 +45,11 @@ protected void verifyOptions() { 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).setEnumClassPrefix(GoClientOptionsProvider.ENUM_CLASS_PREFIX_VALUE); verify(clientCodegen).setPrependFormOrBodyParameters(GoClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_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).setGenerateInterfaces(GoClientOptionsProvider.GENERATE_INTERFACES_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 6345595d8e53..3ac5e44cf9ac 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 @@ -33,6 +33,7 @@ public class GoClientOptionsProvider implements OptionsProvider { 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 GENERATE_INTERFACES_VALUE = true; @Override public String getLanguage() { @@ -52,6 +53,7 @@ public Map createOptions() { .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, "true") .put(CodegenConstants.IS_GO_SUBMODULE, "true") .put(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT, "true") + .put("generateInterfaces", "true") .put("structPrefix", "true") .build(); } From 9822d5cf4a42b4f1a4f8735a96f0928e21331bc2 Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Sat, 11 Apr 2020 10:33:16 -0500 Subject: [PATCH 07/16] Update go-petstore & oa3/go-petstore samples with prettier comments - Use default generateInterfaces=false to suppress interfaces --- .../go-petstore-withXml/api_another_fake.go | 10 +- .../go/go-petstore-withXml/api_fake.go | 113 ++++++++++------- .../api_fake_classname_tags123.go | 10 +- .../go/go-petstore-withXml/api_pet.go | 64 ++++++---- .../go/go-petstore-withXml/api_store.go | 35 +++--- .../go/go-petstore-withXml/api_user.go | 53 ++++---- .../go/go-petstore/api_another_fake.go | 10 +- .../petstore/go/go-petstore/api_fake.go | 113 ++++++++++------- .../go-petstore/api_fake_classname_tags123.go | 10 +- .../client/petstore/go/go-petstore/api_pet.go | 64 ++++++---- .../petstore/go/go-petstore/api_store.go | 35 +++--- .../petstore/go/go-petstore/api_user.go | 53 ++++---- .../go/go-petstore/api_another_fake.go | 10 +- .../petstore/go/go-petstore/api_default.go | 7 +- .../petstore/go/go-petstore/api_fake.go | 117 +++++++++++------- .../go-petstore/api_fake_classname_tags123.go | 10 +- .../client/petstore/go/go-petstore/api_pet.go | 64 ++++++---- .../petstore/go/go-petstore/api_store.go | 35 +++--- .../petstore/go/go-petstore/api_user.go | 53 ++++---- 19 files changed, 522 insertions(+), 344 deletions(-) diff --git a/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go b/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go index e7e0b2d0c99e..cd9a207a3717 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go @@ -27,12 +27,14 @@ var ( type AnotherFakeApiService service /* -Call123TestSpecialTags To test special tags -To test special tags and operation ID starting with number + * 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(). * @param body client model -@return Client -*/ + * @return Client + */ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch diff --git a/samples/client/petstore/go/go-petstore-withXml/api_fake.go b/samples/client/petstore/go/go-petstore-withXml/api_fake.go index 764ec664e3d8..4f69812bcfca 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_fake.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_fake.go @@ -30,11 +30,13 @@ var ( type FakeApiService service /* -CreateXmlItem creates an XmlItem -this route creates an XmlItem + * 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(). * @param xmlItem XmlItem Body -*/ + */ func (a *FakeApiService) CreateXmlItem(ctx _context.Context, xmlItem XmlItem) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -103,13 +105,15 @@ type FakeOuterBooleanSerializeOpts struct { } /* -FakeOuterBooleanSerialize Method for FakeOuterBooleanSerialize -Test serialization of outer boolean types + * 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(). * @param optional nil or *FakeOuterBooleanSerializeOpts - Optional Parameters: * @param "Body" (optional.Bool) - Input boolean as post body -@return bool -*/ + * @return bool + */ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -191,13 +195,15 @@ type FakeOuterCompositeSerializeOpts struct { } /* -FakeOuterCompositeSerialize Method for FakeOuterCompositeSerialize -Test serialization of object with outer number type + * 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(). * @param optional nil or *FakeOuterCompositeSerializeOpts - Optional Parameters: * @param "Body" (optional.Interface of OuterComposite) - Input composite as post body -@return OuterComposite -*/ + * @return OuterComposite + */ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -283,13 +289,15 @@ type FakeOuterNumberSerializeOpts struct { } /* -FakeOuterNumberSerialize Method for FakeOuterNumberSerialize -Test serialization of outer number types + * 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(). * @param optional nil or *FakeOuterNumberSerializeOpts - Optional Parameters: * @param "Body" (optional.Float32) - Input number as post body -@return float32 -*/ + * @return float32 + */ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -371,13 +379,15 @@ type FakeOuterStringSerializeOpts struct { } /* -FakeOuterStringSerialize Method for FakeOuterStringSerialize -Test serialization of outer string types + * 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(). * @param optional nil or *FakeOuterStringSerializeOpts - Optional Parameters: * @param "Body" (optional.String) - Input string as post body -@return string -*/ + * @return string + */ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -454,11 +464,13 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar } /* -TestBodyWithFileSchema Method for TestBodyWithFileSchema -For this test, the body for this request much reference a schema named `File`. + * 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(). * @param body -*/ + */ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, body FileSchemaTestClass) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -522,11 +534,12 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, body FileS } /* -TestBodyWithQueryParams Method for TestBodyWithQueryParams + * TestBodyWithQueryParams Method for TestBodyWithQueryParams + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param query * @param body -*/ + */ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query string, body User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -591,12 +604,14 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query str } /* -TestClientModel To test \"client\" model -To test \"client\" model + * 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(). * @param body client model -@return Client -*/ + * @return Client + */ func (a *FakeApiService) TestClientModel(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch @@ -684,8 +699,10 @@ type TestEndpointParametersOpts struct { } /* -TestEndpointParameters Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * 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(). * @param number None * @param double None @@ -702,7 +719,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイ * @param "DateTime" (optional.Time) - None * @param "Password" (optional.String) - None * @param "Callback" (optional.String) - None -*/ + */ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -834,8 +851,10 @@ type TestEnumParametersOpts struct { } /* -TestEnumParameters To test enum parameters -To test enum parameters + * 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(). * @param optional nil or *TestEnumParametersOpts - Optional Parameters: * @param "EnumHeaderStringArray" (optional.Interface of []string) - Header parameter enum test (string array) @@ -846,7 +865,7 @@ To test enum parameters * @param "EnumQueryDouble" (optional.Float64) - Query parameter enum test (double) * @param "EnumFormStringArray" (optional.Interface of []string) - Form parameter enum test (string array) * @param "EnumFormString" (optional.String) - Form parameter enum test (string) -*/ + */ func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOptionals *TestEnumParametersOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -939,8 +958,10 @@ type TestGroupParametersOpts struct { } /* -TestGroupParameters Fake endpoint to test group parameters (optional) -Fake endpoint to test group parameters (optional) + * 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(). * @param requiredStringGroup Required String in group parameters * @param requiredBooleanGroup Required Boolean in group parameters @@ -949,7 +970,7 @@ Fake endpoint to test group parameters (optional) * @param "StringGroup" (optional.Int32) - String in group parameters * @param "BooleanGroup" (optional.Bool) - Boolean in group parameters * @param "Int64Group" (optional.Int64) - Integer in group parameters -*/ + */ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStringGroup int32, requiredBooleanGroup bool, requiredInt64Group int64, localVarOptionals *TestGroupParametersOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -1023,10 +1044,11 @@ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStrin } /* -TestInlineAdditionalProperties test inline additionalProperties + * TestInlineAdditionalProperties test inline additionalProperties + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param param request body -*/ + */ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, param map[string]string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -1090,11 +1112,12 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, pa } /* -TestJsonFormData test json serialization of form data + * 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(). * @param param field1 * @param param2 field2 -*/ + */ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, param2 string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -1158,15 +1181,17 @@ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, pa } /* -TestQueryParameterCollectionFormat Method for TestQueryParameterCollectionFormat -To test the collection format in query parameters + * 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(). * @param pipe * @param ioutil * @param http * @param url * @param context -*/ + */ func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context, pipe []string, ioutil []string, http []string, url []string, context []string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut diff --git a/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go b/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go index f45ad39eb2af..8333f82b7b38 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go @@ -27,12 +27,14 @@ var ( type FakeClassnameTags123ApiService service /* -TestClassname To test class name in snake case -To test class name in snake case + * 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(). * @param body client model -@return Client -*/ + * @return Client + */ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch diff --git a/samples/client/petstore/go/go-petstore-withXml/api_pet.go b/samples/client/petstore/go/go-petstore-withXml/api_pet.go index bd5e210fadca..9621b12fc66f 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_pet.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_pet.go @@ -30,10 +30,11 @@ var ( type PetApiService service /* -AddPet Add a new pet to the store + * 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(). * @param body Pet object that needs to be added to the store -*/ + */ func (a *PetApiService) AddPet(ctx _context.Context, body Pet) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -102,12 +103,13 @@ type DeletePetOpts struct { } /* -DeletePet Deletes a pet + * 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 * @param optional nil or *DeletePetOpts - Optional Parameters: * @param "ApiKey" (optional.String) - -*/ + */ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOptionals *DeletePetOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -174,12 +176,14 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt } /* -FindPetsByStatus Finds Pets by status -Multiple status values can be provided with comma separated strings + * 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(). * @param status Status values that need to be considered for filter -@return []Pet -*/ + * @return []Pet + */ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) ([]Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -252,12 +256,14 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) } /* -FindPetsByTags Finds Pets by tags -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * 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(). * @param tags Tags to filter by -@return []Pet -*/ + * @return []Pet + */ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -330,12 +336,14 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P } /* -GetPetById Find pet by ID -Returns a single pet + * 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 Pet -*/ + * @return Pet + */ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -421,10 +429,11 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne } /* -UpdatePet Update an existing pet + * UpdatePet Update an existing pet + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param body Pet object that needs to be added to the store -*/ + */ func (a *PetApiService) UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -494,13 +503,14 @@ type UpdatePetWithFormOpts struct { } /* -UpdatePetWithForm Updates a pet in the store with form data + * 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 * @param optional nil or *UpdatePetWithFormOpts - Optional Parameters: * @param "Name" (optional.String) - Updated name of the pet * @param "Status" (optional.String) - Updated status of the pet -*/ + */ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -576,14 +586,15 @@ type UploadFileOpts struct { } /* -UploadFile uploads an image + * 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 * @param optional nil or *UploadFileOpts - Optional Parameters: * @param "AdditionalMetadata" (optional.String) - Additional data to pass to server * @param "File" (optional.Interface of *os.File) - file to upload -@return ApiResponse -*/ + * @return ApiResponse + */ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -680,14 +691,15 @@ type UploadFileWithRequiredFileOpts struct { } /* -UploadFileWithRequiredFile uploads an image (required) + * 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 * @param requiredFile file to upload * @param optional nil or *UploadFileWithRequiredFileOpts - Optional Parameters: * @param "AdditionalMetadata" (optional.String) - Additional data to pass to server -@return ApiResponse -*/ + * @return ApiResponse + */ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost diff --git a/samples/client/petstore/go/go-petstore-withXml/api_store.go b/samples/client/petstore/go/go-petstore-withXml/api_store.go index e66437db5dfa..9f1a6d891bfe 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_store.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_store.go @@ -28,11 +28,13 @@ var ( type StoreApiService service /* -DeleteOrder Delete purchase order by ID -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * 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 -*/ + */ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -96,11 +98,13 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n } /* -GetInventory Returns pet inventories by status -Returns a map of status codes to quantities + * 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 map[string]int32 -*/ + * @return map[string]int32 + */ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -184,12 +188,14 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, } /* -GetOrderById Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * 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 Order -*/ + * @return Order + */ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Order, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -269,11 +275,12 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord } /* -PlaceOrder Place an order for a pet + * 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(). * @param body order placed for purchasing the pet -@return Order -*/ + * @return Order + */ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost diff --git a/samples/client/petstore/go/go-petstore-withXml/api_user.go b/samples/client/petstore/go/go-petstore-withXml/api_user.go index 88bdf94e6246..cad9cfb4a85c 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_user.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_user.go @@ -28,11 +28,13 @@ var ( type UserApiService service /* -CreateUser Create user -This can only be done by the logged in user. + * 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(). * @param body Created user object -*/ + */ func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -96,10 +98,11 @@ func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp. } /* -CreateUsersWithArrayInput Creates list of users with given input array + * 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(). * @param body List of user object -*/ + */ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body []User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -163,10 +166,11 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body [] } /* -CreateUsersWithListInput Creates list of users with given input array + * 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(). * @param body List of user object -*/ + */ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -230,11 +234,13 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []U } /* -DeleteUser Delete user -This can only be done by the logged in user. + * 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 -*/ + */ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -298,11 +304,12 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne } /* -GetUserByName Get user by user name + * 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 User -*/ + * @return User + */ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (User, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -376,12 +383,13 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U } /* -LoginUser Logs user into the system + * LoginUser Logs user into the system + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param username The user name for login * @param password The password for login in clear text -@return string -*/ + * @return string + */ func (a *UserApiService) LoginUser(ctx _context.Context, username string, password string) (string, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -455,9 +463,10 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo } /* -LogoutUser Logs out current logged in user session + * 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(). -*/ + */ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -519,12 +528,14 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e } /* -UpdateUser Updated user -This can only be done by the logged in user. + * 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 * @param body Updated user object -*/ + */ func (a *UserApiService) UpdateUser(ctx _context.Context, username string, body User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut diff --git a/samples/client/petstore/go/go-petstore/api_another_fake.go b/samples/client/petstore/go/go-petstore/api_another_fake.go index 21d088438e8a..ab06c6e93fac 100644 --- a/samples/client/petstore/go/go-petstore/api_another_fake.go +++ b/samples/client/petstore/go/go-petstore/api_another_fake.go @@ -26,12 +26,14 @@ var ( type AnotherFakeApiService service /* -Call123TestSpecialTags To test special tags -To test special tags and operation ID starting with number + * 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(). * @param body client model -@return Client -*/ + * @return Client + */ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch diff --git a/samples/client/petstore/go/go-petstore/api_fake.go b/samples/client/petstore/go/go-petstore/api_fake.go index da9cdaac23b1..60b5cede6bd9 100644 --- a/samples/client/petstore/go/go-petstore/api_fake.go +++ b/samples/client/petstore/go/go-petstore/api_fake.go @@ -29,11 +29,13 @@ var ( type FakeApiService service /* -CreateXmlItem creates an XmlItem -this route creates an XmlItem + * 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(). * @param xmlItem XmlItem Body -*/ + */ func (a *FakeApiService) CreateXmlItem(ctx _context.Context, xmlItem XmlItem) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -102,13 +104,15 @@ type FakeOuterBooleanSerializeOpts struct { } /* -FakeOuterBooleanSerialize Method for FakeOuterBooleanSerialize -Test serialization of outer boolean types + * 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(). * @param optional nil or *FakeOuterBooleanSerializeOpts - Optional Parameters: * @param "Body" (optional.Bool) - Input boolean as post body -@return bool -*/ + * @return bool + */ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -190,13 +194,15 @@ type FakeOuterCompositeSerializeOpts struct { } /* -FakeOuterCompositeSerialize Method for FakeOuterCompositeSerialize -Test serialization of object with outer number type + * 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(). * @param optional nil or *FakeOuterCompositeSerializeOpts - Optional Parameters: * @param "Body" (optional.Interface of OuterComposite) - Input composite as post body -@return OuterComposite -*/ + * @return OuterComposite + */ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -282,13 +288,15 @@ type FakeOuterNumberSerializeOpts struct { } /* -FakeOuterNumberSerialize Method for FakeOuterNumberSerialize -Test serialization of outer number types + * 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(). * @param optional nil or *FakeOuterNumberSerializeOpts - Optional Parameters: * @param "Body" (optional.Float32) - Input number as post body -@return float32 -*/ + * @return float32 + */ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -370,13 +378,15 @@ type FakeOuterStringSerializeOpts struct { } /* -FakeOuterStringSerialize Method for FakeOuterStringSerialize -Test serialization of outer string types + * 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(). * @param optional nil or *FakeOuterStringSerializeOpts - Optional Parameters: * @param "Body" (optional.String) - Input string as post body -@return string -*/ + * @return string + */ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -453,11 +463,13 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar } /* -TestBodyWithFileSchema Method for TestBodyWithFileSchema -For this test, the body for this request much reference a schema named `File`. + * 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(). * @param body -*/ + */ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, body FileSchemaTestClass) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -521,11 +533,12 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, body FileS } /* -TestBodyWithQueryParams Method for TestBodyWithQueryParams + * TestBodyWithQueryParams Method for TestBodyWithQueryParams + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param query * @param body -*/ + */ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query string, body User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -590,12 +603,14 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query str } /* -TestClientModel To test \"client\" model -To test \"client\" model + * 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(). * @param body client model -@return Client -*/ + * @return Client + */ func (a *FakeApiService) TestClientModel(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch @@ -683,8 +698,10 @@ type TestEndpointParametersOpts struct { } /* -TestEndpointParameters Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * 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(). * @param number None * @param double None @@ -701,7 +718,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイ * @param "DateTime" (optional.Time) - None * @param "Password" (optional.String) - None * @param "Callback" (optional.String) - None -*/ + */ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -833,8 +850,10 @@ type TestEnumParametersOpts struct { } /* -TestEnumParameters To test enum parameters -To test enum parameters + * 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(). * @param optional nil or *TestEnumParametersOpts - Optional Parameters: * @param "EnumHeaderStringArray" (optional.Interface of []string) - Header parameter enum test (string array) @@ -845,7 +864,7 @@ To test enum parameters * @param "EnumQueryDouble" (optional.Float64) - Query parameter enum test (double) * @param "EnumFormStringArray" (optional.Interface of []string) - Form parameter enum test (string array) * @param "EnumFormString" (optional.String) - Form parameter enum test (string) -*/ + */ func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOptionals *TestEnumParametersOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -938,8 +957,10 @@ type TestGroupParametersOpts struct { } /* -TestGroupParameters Fake endpoint to test group parameters (optional) -Fake endpoint to test group parameters (optional) + * 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(). * @param requiredStringGroup Required String in group parameters * @param requiredBooleanGroup Required Boolean in group parameters @@ -948,7 +969,7 @@ Fake endpoint to test group parameters (optional) * @param "StringGroup" (optional.Int32) - String in group parameters * @param "BooleanGroup" (optional.Bool) - Boolean in group parameters * @param "Int64Group" (optional.Int64) - Integer in group parameters -*/ + */ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStringGroup int32, requiredBooleanGroup bool, requiredInt64Group int64, localVarOptionals *TestGroupParametersOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -1022,10 +1043,11 @@ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStrin } /* -TestInlineAdditionalProperties test inline additionalProperties + * TestInlineAdditionalProperties test inline additionalProperties + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param param request body -*/ + */ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, param map[string]string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -1089,11 +1111,12 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, pa } /* -TestJsonFormData test json serialization of form data + * 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(). * @param param field1 * @param param2 field2 -*/ + */ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, param2 string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -1157,15 +1180,17 @@ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, pa } /* -TestQueryParameterCollectionFormat Method for TestQueryParameterCollectionFormat -To test the collection format in query parameters + * 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(). * @param pipe * @param ioutil * @param http * @param url * @param context -*/ + */ func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context, pipe []string, ioutil []string, http []string, url []string, context []string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut diff --git a/samples/client/petstore/go/go-petstore/api_fake_classname_tags123.go b/samples/client/petstore/go/go-petstore/api_fake_classname_tags123.go index edd549a329da..a57ae520af59 100644 --- a/samples/client/petstore/go/go-petstore/api_fake_classname_tags123.go +++ b/samples/client/petstore/go/go-petstore/api_fake_classname_tags123.go @@ -26,12 +26,14 @@ var ( type FakeClassnameTags123ApiService service /* -TestClassname To test class name in snake case -To test class name in snake case + * 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(). * @param body client model -@return Client -*/ + * @return Client + */ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch diff --git a/samples/client/petstore/go/go-petstore/api_pet.go b/samples/client/petstore/go/go-petstore/api_pet.go index 0a20263a3072..e4e0b0d49829 100644 --- a/samples/client/petstore/go/go-petstore/api_pet.go +++ b/samples/client/petstore/go/go-petstore/api_pet.go @@ -29,10 +29,11 @@ var ( type PetApiService service /* -AddPet Add a new pet to the store + * 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(). * @param body Pet object that needs to be added to the store -*/ + */ func (a *PetApiService) AddPet(ctx _context.Context, body Pet) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -101,12 +102,13 @@ type DeletePetOpts struct { } /* -DeletePet Deletes a pet + * 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 * @param optional nil or *DeletePetOpts - Optional Parameters: * @param "ApiKey" (optional.String) - -*/ + */ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOptionals *DeletePetOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -173,12 +175,14 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt } /* -FindPetsByStatus Finds Pets by status -Multiple status values can be provided with comma separated strings + * 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(). * @param status Status values that need to be considered for filter -@return []Pet -*/ + * @return []Pet + */ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) ([]Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -251,12 +255,14 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) } /* -FindPetsByTags Finds Pets by tags -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * 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(). * @param tags Tags to filter by -@return []Pet -*/ + * @return []Pet + */ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -329,12 +335,14 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P } /* -GetPetById Find pet by ID -Returns a single pet + * 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 Pet -*/ + * @return Pet + */ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -420,10 +428,11 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne } /* -UpdatePet Update an existing pet + * UpdatePet Update an existing pet + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param body Pet object that needs to be added to the store -*/ + */ func (a *PetApiService) UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -493,13 +502,14 @@ type UpdatePetWithFormOpts struct { } /* -UpdatePetWithForm Updates a pet in the store with form data + * 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 * @param optional nil or *UpdatePetWithFormOpts - Optional Parameters: * @param "Name" (optional.String) - Updated name of the pet * @param "Status" (optional.String) - Updated status of the pet -*/ + */ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -575,14 +585,15 @@ type UploadFileOpts struct { } /* -UploadFile uploads an image + * 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 * @param optional nil or *UploadFileOpts - Optional Parameters: * @param "AdditionalMetadata" (optional.String) - Additional data to pass to server * @param "File" (optional.Interface of *os.File) - file to upload -@return ApiResponse -*/ + * @return ApiResponse + */ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -679,14 +690,15 @@ type UploadFileWithRequiredFileOpts struct { } /* -UploadFileWithRequiredFile uploads an image (required) + * 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 * @param requiredFile file to upload * @param optional nil or *UploadFileWithRequiredFileOpts - Optional Parameters: * @param "AdditionalMetadata" (optional.String) - Additional data to pass to server -@return ApiResponse -*/ + * @return ApiResponse + */ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost diff --git a/samples/client/petstore/go/go-petstore/api_store.go b/samples/client/petstore/go/go-petstore/api_store.go index 150168fb6ff5..d85adb592216 100644 --- a/samples/client/petstore/go/go-petstore/api_store.go +++ b/samples/client/petstore/go/go-petstore/api_store.go @@ -27,11 +27,13 @@ var ( type StoreApiService service /* -DeleteOrder Delete purchase order by ID -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * 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 -*/ + */ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -95,11 +97,13 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n } /* -GetInventory Returns pet inventories by status -Returns a map of status codes to quantities + * 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 map[string]int32 -*/ + * @return map[string]int32 + */ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -183,12 +187,14 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, } /* -GetOrderById Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * 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 Order -*/ + * @return Order + */ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Order, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -268,11 +274,12 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord } /* -PlaceOrder Place an order for a pet + * 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(). * @param body order placed for purchasing the pet -@return Order -*/ + * @return Order + */ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost diff --git a/samples/client/petstore/go/go-petstore/api_user.go b/samples/client/petstore/go/go-petstore/api_user.go index e2e4871f3311..2ac2969f714e 100644 --- a/samples/client/petstore/go/go-petstore/api_user.go +++ b/samples/client/petstore/go/go-petstore/api_user.go @@ -27,11 +27,13 @@ var ( type UserApiService service /* -CreateUser Create user -This can only be done by the logged in user. + * 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(). * @param body Created user object -*/ + */ func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -95,10 +97,11 @@ func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp. } /* -CreateUsersWithArrayInput Creates list of users with given input array + * 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(). * @param body List of user object -*/ + */ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body []User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -162,10 +165,11 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body [] } /* -CreateUsersWithListInput Creates list of users with given input array + * 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(). * @param body List of user object -*/ + */ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -229,11 +233,13 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []U } /* -DeleteUser Delete user -This can only be done by the logged in user. + * 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 -*/ + */ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -297,11 +303,12 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne } /* -GetUserByName Get user by user name + * 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 User -*/ + * @return User + */ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (User, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -375,12 +382,13 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U } /* -LoginUser Logs user into the system + * LoginUser Logs user into the system + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param username The user name for login * @param password The password for login in clear text -@return string -*/ + * @return string + */ func (a *UserApiService) LoginUser(ctx _context.Context, username string, password string) (string, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -454,9 +462,10 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo } /* -LogoutUser Logs out current logged in user session + * 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(). -*/ + */ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -518,12 +527,14 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e } /* -UpdateUser Updated user -This can only be done by the logged in user. + * 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 * @param body Updated user object -*/ + */ func (a *UserApiService) UpdateUser(ctx _context.Context, username string, body User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_another_fake.go b/samples/openapi3/client/petstore/go/go-petstore/api_another_fake.go index 2dbbcb47db58..d0126855865e 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_another_fake.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_another_fake.go @@ -26,12 +26,14 @@ var ( type AnotherFakeApiService service /* -Call123TestSpecialTags To test special tags -To test special tags and operation ID starting with number + * 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(). * @param client client model -@return Client -*/ + * @return Client + */ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, client Client) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_default.go b/samples/openapi3/client/petstore/go/go-petstore/api_default.go index 0619c2c41dee..183a2d799f1b 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_default.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_default.go @@ -26,10 +26,11 @@ var ( type DefaultApiService service /* -FooGet Method for FooGet + * FooGet Method for FooGet + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). -@return InlineResponseDefault -*/ + * @return InlineResponseDefault + */ func (a *DefaultApiService) FooGet(ctx _context.Context) (InlineResponseDefault, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_fake.go b/samples/openapi3/client/petstore/go/go-petstore/api_fake.go index 1934c7bcc5ef..6e36a8816a3a 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_fake.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_fake.go @@ -29,10 +29,11 @@ var ( type FakeApiService service /* -FakeHealthGet Health check endpoint + * FakeHealthGet Health check endpoint + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). -@return HealthCheckResult -*/ + * @return HealthCheckResult + */ func (a *FakeApiService) FakeHealthGet(ctx _context.Context) (HealthCheckResult, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -110,13 +111,14 @@ type FakeHttpSignatureTestOpts struct { } /* -FakeHttpSignatureTest test http signature authentication + * FakeHttpSignatureTest test http signature authentication + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param pet Pet object that needs to be added to the store * @param optional nil or *FakeHttpSignatureTestOpts - Optional Parameters: * @param "Query1" (optional.String) - query parameter * @param "Header1" (optional.String) - header parameter -*/ + */ func (a *FakeApiService) FakeHttpSignatureTest(ctx _context.Context, pet Pet, localVarOptionals *FakeHttpSignatureTestOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -191,13 +193,15 @@ type FakeOuterBooleanSerializeOpts struct { } /* -FakeOuterBooleanSerialize Method for FakeOuterBooleanSerialize -Test serialization of outer boolean types + * 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(). * @param optional nil or *FakeOuterBooleanSerializeOpts - Optional Parameters: * @param "Body" (optional.Bool) - Input boolean as post body -@return bool -*/ + * @return bool + */ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -279,13 +283,15 @@ type FakeOuterCompositeSerializeOpts struct { } /* -FakeOuterCompositeSerialize Method for FakeOuterCompositeSerialize -Test serialization of object with outer number type + * 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(). * @param optional nil or *FakeOuterCompositeSerializeOpts - Optional Parameters: * @param "OuterComposite" (optional.Interface of OuterComposite) - Input composite as post body -@return OuterComposite -*/ + * @return OuterComposite + */ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -371,13 +377,15 @@ type FakeOuterNumberSerializeOpts struct { } /* -FakeOuterNumberSerialize Method for FakeOuterNumberSerialize -Test serialization of outer number types + * 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(). * @param optional nil or *FakeOuterNumberSerializeOpts - Optional Parameters: * @param "Body" (optional.Float32) - Input number as post body -@return float32 -*/ + * @return float32 + */ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -459,13 +467,15 @@ type FakeOuterStringSerializeOpts struct { } /* -FakeOuterStringSerialize Method for FakeOuterStringSerialize -Test serialization of outer string types + * 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(). * @param optional nil or *FakeOuterStringSerializeOpts - Optional Parameters: * @param "Body" (optional.String) - Input string as post body -@return string -*/ + * @return string + */ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -542,11 +552,13 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar } /* -TestBodyWithFileSchema Method for TestBodyWithFileSchema -For this test, the body for this request much reference a schema named `File`. + * 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(). * @param fileSchemaTestClass -*/ + */ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, fileSchemaTestClass FileSchemaTestClass) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -610,11 +622,12 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, fileSchema } /* -TestBodyWithQueryParams Method for TestBodyWithQueryParams + * TestBodyWithQueryParams Method for TestBodyWithQueryParams + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param query * @param user -*/ + */ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query string, user User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -679,12 +692,14 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query str } /* -TestClientModel To test \"client\" model -To test \"client\" model + * 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(). * @param client client model -@return Client -*/ + * @return Client + */ func (a *FakeApiService) TestClientModel(ctx _context.Context, client Client) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch @@ -772,8 +787,10 @@ type TestEndpointParametersOpts struct { } /* -TestEndpointParameters Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * 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(). * @param number None * @param double None @@ -790,7 +807,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン * @param "DateTime" (optional.Time) - None * @param "Password" (optional.String) - None * @param "Callback" (optional.String) - None -*/ + */ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -922,8 +939,10 @@ type TestEnumParametersOpts struct { } /* -TestEnumParameters To test enum parameters -To test enum parameters + * 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(). * @param optional nil or *TestEnumParametersOpts - Optional Parameters: * @param "EnumHeaderStringArray" (optional.Interface of []string) - Header parameter enum test (string array) @@ -934,7 +953,7 @@ To test enum parameters * @param "EnumQueryDouble" (optional.Float64) - Query parameter enum test (double) * @param "EnumFormStringArray" (optional.Interface of []string) - Form parameter enum test (string array) * @param "EnumFormString" (optional.String) - Form parameter enum test (string) -*/ + */ func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOptionals *TestEnumParametersOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -1035,8 +1054,10 @@ type TestGroupParametersOpts struct { } /* -TestGroupParameters Fake endpoint to test group parameters (optional) -Fake endpoint to test group parameters (optional) + * 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(). * @param requiredStringGroup Required String in group parameters * @param requiredBooleanGroup Required Boolean in group parameters @@ -1045,7 +1066,7 @@ Fake endpoint to test group parameters (optional) * @param "StringGroup" (optional.Int32) - String in group parameters * @param "BooleanGroup" (optional.Bool) - Boolean in group parameters * @param "Int64Group" (optional.Int64) - Integer in group parameters -*/ + */ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStringGroup int32, requiredBooleanGroup bool, requiredInt64Group int64, localVarOptionals *TestGroupParametersOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -1119,10 +1140,11 @@ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStrin } /* -TestInlineAdditionalProperties test inline additionalProperties + * TestInlineAdditionalProperties test inline additionalProperties + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param requestBody request body -*/ + */ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, requestBody map[string]string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -1186,11 +1208,12 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, re } /* -TestJsonFormData test json serialization of form data + * 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(). * @param param field1 * @param param2 field2 -*/ + */ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, param2 string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -1254,15 +1277,17 @@ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, pa } /* -TestQueryParameterCollectionFormat Method for TestQueryParameterCollectionFormat -To test the collection format in query parameters + * 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(). * @param pipe * @param ioutil * @param http * @param url * @param context -*/ + */ func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context, pipe []string, ioutil []string, http []string, url []string, context []string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_fake_classname_tags123.go b/samples/openapi3/client/petstore/go/go-petstore/api_fake_classname_tags123.go index 68d75806e10d..c0d1668e7912 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_fake_classname_tags123.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_fake_classname_tags123.go @@ -26,12 +26,14 @@ var ( type FakeClassnameTags123ApiService service /* -TestClassname To test class name in snake case -To test class name in snake case + * 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(). * @param client client model -@return Client -*/ + * @return Client + */ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, client Client) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_pet.go b/samples/openapi3/client/petstore/go/go-petstore/api_pet.go index 5e781bf15cd3..fb17f2361104 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_pet.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_pet.go @@ -29,10 +29,11 @@ var ( type PetApiService service /* -AddPet Add a new pet to the store + * 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(). * @param pet Pet object that needs to be added to the store -*/ + */ func (a *PetApiService) AddPet(ctx _context.Context, pet Pet) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -101,12 +102,13 @@ type DeletePetOpts struct { } /* -DeletePet Deletes a pet + * 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 * @param optional nil or *DeletePetOpts - Optional Parameters: * @param "ApiKey" (optional.String) - -*/ + */ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOptionals *DeletePetOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -173,12 +175,14 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt } /* -FindPetsByStatus Finds Pets by status -Multiple status values can be provided with comma separated strings + * 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(). * @param status Status values that need to be considered for filter -@return []Pet -*/ + * @return []Pet + */ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) ([]Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -251,12 +255,14 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) } /* -FindPetsByTags Finds Pets by tags -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * 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(). * @param tags Tags to filter by -@return []Pet -*/ + * @return []Pet + */ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -329,12 +335,14 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P } /* -GetPetById Find pet by ID -Returns a single pet + * 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 Pet -*/ + * @return Pet + */ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -420,10 +428,11 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne } /* -UpdatePet Update an existing pet + * UpdatePet Update an existing pet + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param pet Pet object that needs to be added to the store -*/ + */ func (a *PetApiService) UpdatePet(ctx _context.Context, pet Pet) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -493,13 +502,14 @@ type UpdatePetWithFormOpts struct { } /* -UpdatePetWithForm Updates a pet in the store with form data + * 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 * @param optional nil or *UpdatePetWithFormOpts - Optional Parameters: * @param "Name" (optional.String) - Updated name of the pet * @param "Status" (optional.String) - Updated status of the pet -*/ + */ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -575,14 +585,15 @@ type UploadFileOpts struct { } /* -UploadFile uploads an image + * 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 * @param optional nil or *UploadFileOpts - Optional Parameters: * @param "AdditionalMetadata" (optional.String) - Additional data to pass to server * @param "File" (optional.Interface of *os.File) - file to upload -@return ApiResponse -*/ + * @return ApiResponse + */ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -679,14 +690,15 @@ type UploadFileWithRequiredFileOpts struct { } /* -UploadFileWithRequiredFile uploads an image (required) + * 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 * @param requiredFile file to upload * @param optional nil or *UploadFileWithRequiredFileOpts - Optional Parameters: * @param "AdditionalMetadata" (optional.String) - Additional data to pass to server -@return ApiResponse -*/ + * @return ApiResponse + */ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_store.go b/samples/openapi3/client/petstore/go/go-petstore/api_store.go index 4685c6275738..f683edb1814f 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_store.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_store.go @@ -27,11 +27,13 @@ var ( type StoreApiService service /* -DeleteOrder Delete purchase order by ID -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * 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 -*/ + */ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -95,11 +97,13 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n } /* -GetInventory Returns pet inventories by status -Returns a map of status codes to quantities + * 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 map[string]int32 -*/ + * @return map[string]int32 + */ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -183,12 +187,14 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, } /* -GetOrderById Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * 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 Order -*/ + * @return Order + */ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Order, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -268,11 +274,12 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord } /* -PlaceOrder Place an order for a pet + * 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(). * @param order order placed for purchasing the pet -@return Order -*/ + * @return Order + */ func (a *StoreApiService) PlaceOrder(ctx _context.Context, order Order) (Order, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_user.go b/samples/openapi3/client/petstore/go/go-petstore/api_user.go index c026ecce3241..ad3e4e42c145 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_user.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_user.go @@ -27,11 +27,13 @@ var ( type UserApiService service /* -CreateUser Create user -This can only be done by the logged in user. + * 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(). * @param user Created user object -*/ + */ func (a *UserApiService) CreateUser(ctx _context.Context, user User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -95,10 +97,11 @@ func (a *UserApiService) CreateUser(ctx _context.Context, user User) (*_nethttp. } /* -CreateUsersWithArrayInput Creates list of users with given input array + * 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(). * @param user List of user object -*/ + */ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, user []User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -162,10 +165,11 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, user [] } /* -CreateUsersWithListInput Creates list of users with given input array + * 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(). * @param user List of user object -*/ + */ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, user []User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -229,11 +233,13 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, user []U } /* -DeleteUser Delete user -This can only be done by the logged in user. + * 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 -*/ + */ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -297,11 +303,12 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne } /* -GetUserByName Get user by user name + * 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 User -*/ + * @return User + */ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (User, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -375,12 +382,13 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U } /* -LoginUser Logs user into the system + * LoginUser Logs user into the system + * * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param username The user name for login * @param password The password for login in clear text -@return string -*/ + * @return string + */ func (a *UserApiService) LoginUser(ctx _context.Context, username string, password string) (string, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -454,9 +462,10 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo } /* -LogoutUser Logs out current logged in user session + * 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(). -*/ + */ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -518,12 +527,14 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e } /* -UpdateUser Updated user -This can only be done by the logged in user. + * 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 * @param user Updated user object -*/ + */ func (a *UserApiService) UpdateUser(ctx _context.Context, username string, user User) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut From 9653a67cefe2228f66f8830f87b02e5610989c53 Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Sat, 11 Apr 2020 19:16:30 -0500 Subject: [PATCH 08/16] Enable generateInterfaces and update samples for go-petstore-withxml --- bin/configs/go-petstore-withXml.yaml | 1 + .../go-petstore-withXml/api_another_fake.go | 14 ++ .../go/go-petstore-withXml/api_fake.go | 180 ++++++++++++++++++ .../api_fake_classname_tags123.go | 14 ++ .../go/go-petstore-withXml/api_pet.go | 97 ++++++++++ .../go/go-petstore-withXml/api_store.go | 43 +++++ .../go/go-petstore-withXml/api_user.go | 76 ++++++++ .../petstore/go/go-petstore-withXml/client.go | 12 +- 8 files changed, 431 insertions(+), 6 deletions(-) diff --git a/bin/configs/go-petstore-withXml.yaml b/bin/configs/go-petstore-withXml.yaml index f80df1e76814..618d59e016ba 100644 --- a/bin/configs/go-petstore-withXml.yaml +++ b/bin/configs/go-petstore-withXml.yaml @@ -6,3 +6,4 @@ additionalProperties: packageName: petstore withXml: "true" withGoCodegenComment: "true" + generateInterfaces: true diff --git a/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go b/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go index cd9a207a3717..fa9845ac61be 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go @@ -23,6 +23,20 @@ var ( _ _context.Context ) +type AnotherFakeApi interface { + + /* + * 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(). + * @param body client model + * @return Client + */ + Call123TestSpecialTags(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) +} + // AnotherFakeApiService AnotherFakeApi service type AnotherFakeApiService service diff --git a/samples/client/petstore/go/go-petstore-withXml/api_fake.go b/samples/client/petstore/go/go-petstore-withXml/api_fake.go index 4f69812bcfca..afc6908431bc 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_fake.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_fake.go @@ -26,6 +26,186 @@ var ( _ _context.Context ) +type FakeApi interface { + + /* + * 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(). + * @param xmlItem XmlItem Body + */ + CreateXmlItem(ctx _context.Context, xmlItem XmlItem) (*_nethttp.Response, error) + + /* + * 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(). + * @param optional nil or *FakeOuterBooleanSerializeOpts - Optional Parameters: + * @param "Body" (optional.Bool) - Input boolean as post body + * @return bool + */ + FakeOuterBooleanSerialize(ctx _context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *_nethttp.Response, error) + + /* + * 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(). + * @param optional nil or *FakeOuterCompositeSerializeOpts - Optional Parameters: + * @param "Body" (optional.Interface of OuterComposite) - Input composite as post body + * @return OuterComposite + */ + FakeOuterCompositeSerialize(ctx _context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *_nethttp.Response, error) + + /* + * 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(). + * @param optional nil or *FakeOuterNumberSerializeOpts - Optional Parameters: + * @param "Body" (optional.Float32) - Input number as post body + * @return float32 + */ + FakeOuterNumberSerialize(ctx _context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *_nethttp.Response, error) + + /* + * 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(). + * @param optional nil or *FakeOuterStringSerializeOpts - Optional Parameters: + * @param "Body" (optional.String) - Input string as post body + * @return string + */ + FakeOuterStringSerialize(ctx _context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *_nethttp.Response, error) + + /* + * 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(). + * @param body + */ + TestBodyWithFileSchema(ctx _context.Context, body FileSchemaTestClass) (*_nethttp.Response, error) + + /* + * TestBodyWithQueryParams Method for TestBodyWithQueryParams + * + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param query + * @param body + */ + TestBodyWithQueryParams(ctx _context.Context, query string, body User) (*_nethttp.Response, error) + + /* + * 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(). + * @param body client model + * @return Client + */ + TestClientModel(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) + + /* + * 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(). + * @param number None + * @param double None + * @param patternWithoutDelimiter None + * @param byte_ None + * @param optional nil or *TestEndpointParametersOpts - Optional Parameters: + * @param "Integer" (optional.Int32) - None + * @param "Int32_" (optional.Int32) - None + * @param "Int64_" (optional.Int64) - None + * @param "Float" (optional.Float32) - None + * @param "String_" (optional.String) - None + * @param "Binary" (optional.Interface of *os.File) - None + * @param "Date" (optional.String) - None + * @param "DateTime" (optional.Time) - None + * @param "Password" (optional.String) - None + * @param "Callback" (optional.String) - None + */ + TestEndpointParameters(ctx _context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*_nethttp.Response, error) + + /* + * 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(). + * @param optional nil or *TestEnumParametersOpts - Optional Parameters: + * @param "EnumHeaderStringArray" (optional.Interface of []string) - Header parameter enum test (string array) + * @param "EnumHeaderString" (optional.String) - Header parameter enum test (string) + * @param "EnumQueryStringArray" (optional.Interface of []string) - Query parameter enum test (string array) + * @param "EnumQueryString" (optional.String) - Query parameter enum test (string) + * @param "EnumQueryInteger" (optional.Int32) - Query parameter enum test (double) + * @param "EnumQueryDouble" (optional.Float64) - Query parameter enum test (double) + * @param "EnumFormStringArray" (optional.Interface of []string) - Form parameter enum test (string array) + * @param "EnumFormString" (optional.String) - Form parameter enum test (string) + */ + TestEnumParameters(ctx _context.Context, localVarOptionals *TestEnumParametersOpts) (*_nethttp.Response, error) + + /* + * 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(). + * @param requiredStringGroup Required String in group parameters + * @param requiredBooleanGroup Required Boolean in group parameters + * @param requiredInt64Group Required Integer in group parameters + * @param optional nil or *TestGroupParametersOpts - Optional Parameters: + * @param "StringGroup" (optional.Int32) - String in group parameters + * @param "BooleanGroup" (optional.Bool) - Boolean in group parameters + * @param "Int64Group" (optional.Int64) - Integer in group parameters + */ + TestGroupParameters(ctx _context.Context, requiredStringGroup int32, requiredBooleanGroup bool, requiredInt64Group int64, localVarOptionals *TestGroupParametersOpts) (*_nethttp.Response, error) + + /* + * TestInlineAdditionalProperties test inline additionalProperties + * + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param param request body + */ + TestInlineAdditionalProperties(ctx _context.Context, param map[string]string) (*_nethttp.Response, error) + + /* + * 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(). + * @param param field1 + * @param param2 field2 + */ + TestJsonFormData(ctx _context.Context, param string, param2 string) (*_nethttp.Response, error) + + /* + * 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(). + * @param pipe + * @param ioutil + * @param http + * @param url + * @param context + */ + TestQueryParameterCollectionFormat(ctx _context.Context, pipe []string, ioutil []string, http []string, url []string, context []string) (*_nethttp.Response, error) +} + // FakeApiService FakeApi service type FakeApiService service diff --git a/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go b/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go index 8333f82b7b38..2125090eeba7 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go @@ -23,6 +23,20 @@ var ( _ _context.Context ) +type FakeClassnameTags123Api interface { + + /* + * 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(). + * @param body client model + * @return Client + */ + TestClassname(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) +} + // FakeClassnameTags123ApiService FakeClassnameTags123Api service type FakeClassnameTags123ApiService service diff --git a/samples/client/petstore/go/go-petstore-withXml/api_pet.go b/samples/client/petstore/go/go-petstore-withXml/api_pet.go index 9621b12fc66f..e10c2a4db464 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_pet.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_pet.go @@ -26,6 +26,103 @@ var ( _ _context.Context ) +type PetApi interface { + + /* + * 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(). + * @param body Pet object that needs to be added to the store + */ + AddPet(ctx _context.Context, body Pet) (*_nethttp.Response, error) + + /* + * 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 + * @param optional nil or *DeletePetOpts - Optional Parameters: + * @param "ApiKey" (optional.String) - + */ + DeletePet(ctx _context.Context, petId int64, localVarOptionals *DeletePetOpts) (*_nethttp.Response, error) + + /* + * 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(). + * @param status Status values that need to be considered for filter + * @return []Pet + */ + FindPetsByStatus(ctx _context.Context, status []string) ([]Pet, *_nethttp.Response, error) + + /* + * 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(). + * @param tags Tags to filter by + * @return []Pet + */ + FindPetsByTags(ctx _context.Context, tags []string) ([]Pet, *_nethttp.Response, error) + + /* + * 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 Pet + */ + GetPetById(ctx _context.Context, petId int64) (Pet, *_nethttp.Response, error) + + /* + * UpdatePet Update an existing pet + * + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body Pet object that needs to be added to the store + */ + UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Response, error) + + /* + * 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 + * @param optional nil or *UpdatePetWithFormOpts - Optional Parameters: + * @param "Name" (optional.String) - Updated name of the pet + * @param "Status" (optional.String) - Updated status of the pet + */ + UpdatePetWithForm(ctx _context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*_nethttp.Response, error) + + /* + * 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 + * @param optional nil or *UploadFileOpts - Optional Parameters: + * @param "AdditionalMetadata" (optional.String) - Additional data to pass to server + * @param "File" (optional.Interface of *os.File) - file to upload + * @return ApiResponse + */ + UploadFile(ctx _context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *_nethttp.Response, error) + + /* + * 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 + * @param requiredFile file to upload + * @param optional nil or *UploadFileWithRequiredFileOpts - Optional Parameters: + * @param "AdditionalMetadata" (optional.String) - Additional data to pass to server + * @return ApiResponse + */ + UploadFileWithRequiredFile(ctx _context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *_nethttp.Response, error) +} + // PetApiService PetApi service type PetApiService service diff --git a/samples/client/petstore/go/go-petstore-withXml/api_store.go b/samples/client/petstore/go/go-petstore-withXml/api_store.go index 9f1a6d891bfe..9064808b3dad 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_store.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_store.go @@ -24,6 +24,49 @@ var ( _ _context.Context ) +type StoreApi interface { + + /* + * 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 + */ + DeleteOrder(ctx _context.Context, orderId string) (*_nethttp.Response, error) + + /* + * 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 map[string]int32 + */ + GetInventory(ctx _context.Context) (map[string]int32, *_nethttp.Response, error) + + /* + * 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 Order + */ + GetOrderById(ctx _context.Context, orderId int64) (Order, *_nethttp.Response, error) + + /* + * 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(). + * @param body order placed for purchasing the pet + * @return Order + */ + PlaceOrder(ctx _context.Context, body Order) (Order, *_nethttp.Response, error) +} + // StoreApiService StoreApi service type StoreApiService service diff --git a/samples/client/petstore/go/go-petstore-withXml/api_user.go b/samples/client/petstore/go/go-petstore-withXml/api_user.go index cad9cfb4a85c..d5589f3d0ea6 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_user.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_user.go @@ -24,6 +24,82 @@ var ( _ _context.Context ) +type UserApi interface { + + /* + * 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(). + * @param body Created user object + */ + CreateUser(ctx _context.Context, body User) (*_nethttp.Response, error) + + /* + * 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(). + * @param body List of user object + */ + CreateUsersWithArrayInput(ctx _context.Context, body []User) (*_nethttp.Response, error) + + /* + * 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(). + * @param body List of user object + */ + CreateUsersWithListInput(ctx _context.Context, body []User) (*_nethttp.Response, error) + + /* + * 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 + */ + DeleteUser(ctx _context.Context, username string) (*_nethttp.Response, error) + + /* + * 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 User + */ + GetUserByName(ctx _context.Context, username string) (User, *_nethttp.Response, error) + + /* + * LoginUser Logs user into the system + * + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param username The user name for login + * @param password The password for login in clear text + * @return string + */ + LoginUser(ctx _context.Context, username string, password string) (string, *_nethttp.Response, error) + + /* + * 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(). + */ + LogoutUser(ctx _context.Context) (*_nethttp.Response, error) + + /* + * 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 + * @param body Updated user object + */ + UpdateUser(ctx _context.Context, username string, body User) (*_nethttp.Response, error) +} + // UserApiService UserApi service type UserApiService service diff --git a/samples/client/petstore/go/go-petstore-withXml/client.go b/samples/client/petstore/go/go-petstore-withXml/client.go index 00f4296fa6f0..5742286abc01 100644 --- a/samples/client/petstore/go/go-petstore-withXml/client.go +++ b/samples/client/petstore/go/go-petstore-withXml/client.go @@ -49,17 +49,17 @@ type APIClient struct { // API Services - AnotherFakeApi *AnotherFakeApiService + AnotherFakeApi AnotherFakeApi - FakeApi *FakeApiService + FakeApi FakeApi - FakeClassnameTags123Api *FakeClassnameTags123ApiService + FakeClassnameTags123Api FakeClassnameTags123Api - PetApi *PetApiService + PetApi PetApi - StoreApi *StoreApiService + StoreApi StoreApi - UserApi *UserApiService + UserApi UserApi } type service struct { From 75cfe81211408236256bb6c130e4d5a051ad5f5a Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Tue, 12 May 2020 18:48:19 -0500 Subject: [PATCH 09/16] Add generateInterfaces/prettier comments for go-experimental templates * Backward incompatible since it changes the api method signatures significantly. * Adheres to a builder pattern more strictly. Execute now runs on the req object returned by the builder, instead of the builder itself * Prettify/align method comments --- docs/generators/go-experimental.md | 1 + .../resources/go-experimental/api.mustache | 70 ++++++++++++------- .../resources/go-experimental/client.mustache | 5 ++ 3 files changed, 50 insertions(+), 26 deletions(-) diff --git a/docs/generators/go-experimental.md b/docs/generators/go-experimental.md index e4c738c0e3c7..a2a1b1df2b1f 100644 --- a/docs/generators/go-experimental.md +++ b/docs/generators/go-experimental.md @@ -7,6 +7,7 @@ sidebar_label: go-experimental | ------ | ----------- | ------ | ------- | |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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**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.
|true| |enumClassPrefix|Prefix enum with class name| |false| +|generateInterfaces|Generate interfaces for api classes| |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| diff --git a/modules/openapi-generator/src/main/resources/go-experimental/api.mustache b/modules/openapi-generator/src/main/resources/go-experimental/api.mustache index fb2553be562a..e48ae14fdd87 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/api.mustache +++ b/modules/openapi-generator/src/main/resources/go-experimental/api.mustache @@ -16,48 +16,66 @@ var ( _ _context.Context ) +{{#generateInterfaces}} + type {{classname}} interface { + {{#operation}} + /* + * {{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} + {{#notes}} + * {{{unescapedNotes}}} + {{/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 + */ + {{{nickname}}}GetRequest(ctx _context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) Api{{operationId}}Request + + /* + * Execute executes the request{{#returnType}} + * @return {{{.}}}{{/returnType}} + */ + {{nickname}}Execute(r Api{{operationId}}Request) ({{#returnType}}{{{.}}}, {{/returnType}}*_nethttp.Response, error) + + {{/operation}} + } + +{{/generateInterfaces}} // {{classname}}Service {{classname}} service type {{classname}}Service service {{#operation}} -type api{{operationId}}Request struct { - ctx _context.Context - apiService *{{classname}}Service{{#allParams}} +type Api{{operationId}}Request struct { + ctx _context.Context{{#allParams}} {{paramName}} {{^isPathParam}}*{{/isPathParam}}{{{dataType}}}{{/allParams}} } -{{#allParams}} -{{^isPathParam}} -func (r api{{operationId}}Request) {{vendorExtensions.x-export-param-name}}({{paramName}} {{{dataType}}}) api{{operationId}}Request { +{{#allParams}}{{^isPathParam}} +func (r Api{{operationId}}Request) {{vendorExtensions.x-export-param-name}}({{paramName}} {{{dataType}}}) Api{{operationId}}Request { r.{{paramName}} = &{{paramName}} return r } -{{/isPathParam}} -{{/allParams}} +{{/isPathParam}}{{/allParams}} /* -{{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} + * {{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} {{#notes}} -{{{unescapedNotes}}} + * {{{unescapedNotes}}} {{/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, + * @return api{{operationId}}Request + */ +func (a *{{{classname}}}Service) {{{nickname}}}GetRequest(ctx _context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) Api{{operationId}}Request { + return Api{{operationId}}Request{ ctx: ctx,{{#pathParams}} {{paramName}}: {{paramName}},{{/pathParams}} } } /* -Execute executes the request -{{#returnType}} -@return {{{.}}} -{{/returnType}} -*/ -func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnType}}*_nethttp.Response, error) { + * Execute executes the request{{#returnType}} + * @return {{{.}}}{{/returnType}} + */ +func (a *{{{classname}}}Service) {{nickname}}Execute(r Api{{operationId}}Request) ({{#returnType}}{{{.}}}, {{/returnType}}*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.Method{{httpMethod}} localVarPostBody interface{} @@ -69,7 +87,7 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT {{/returnType}} ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "{{{classname}}}Service.{{{nickname}}}") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "{{{classname}}}Service.{{{nickname}}}") if err != nil { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, GenericOpenAPIError{error: err.Error()} } @@ -271,12 +289,12 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT {{/isKeyInCookie}} {{/isApiKey}} {{/authMethods}} - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.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(req) if err != nil || localVarHTTPResponse == nil { return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err } @@ -300,7 +318,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 @@ -320,7 +338,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-experimental/client.mustache b/modules/openapi-generator/src/main/resources/go-experimental/client.mustache index 6fe63dcfdf97..5bd19cdbe59f 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/client.mustache +++ b/modules/openapi-generator/src/main/resources/go-experimental/client.mustache @@ -42,7 +42,12 @@ type APIClient struct { {{#apis}} {{#operations}} + {{#generateInterfaces}} + {{classname}} {{classname}} + {{/generateInterfaces}} + {{^generateInterfaces}} {{classname}} *{{classname}}Service + {{/generateInterfaces}} {{/operations}} {{/apis}} {{/apiInfo}} From fc00c988d63ab398a0a51e4aae7e8d8a1468e4b7 Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Tue, 12 May 2020 18:53:33 -0500 Subject: [PATCH 10/16] Method signature refactors for go-experimental (and openapi3) samples * Also update to include prettier method comments --- .../petstore/go-experimental/auth_test.go | 48 +- .../petstore/go-experimental/fake_api_test.go | 3 +- .../go-petstore/api_another_fake.go | 34 +- .../go-experimental/go-petstore/api_fake.go | 496 +++++++++--------- .../go-petstore/api_fake_classname_tags123.go | 34 +- .../go-experimental/go-petstore/api_pet.go | 282 +++++----- .../go-experimental/go-petstore/api_store.go | 124 ++--- .../go-experimental/go-petstore/api_user.go | 234 ++++----- .../petstore/go-experimental/pet_api_test.go | 33 +- .../go-experimental/store_api_test.go | 3 +- .../petstore/go-experimental/user_api_test.go | 18 +- .../petstore/go-experimental/auth_test.go | 48 +- .../petstore/go-experimental/fake_api_test.go | 3 +- .../go-petstore/api_another_fake.go | 34 +- .../go-petstore/api_default.go | 32 +- .../go-experimental/go-petstore/api_fake.go | 496 +++++++++--------- .../go-petstore/api_fake_classname_tags123.go | 34 +- .../go-experimental/go-petstore/api_pet.go | 282 +++++----- .../go-experimental/go-petstore/api_store.go | 124 ++--- .../go-experimental/go-petstore/api_user.go | 234 ++++----- .../go-experimental/http_signature_test.go | 6 +- .../petstore/go-experimental/pet_api_test.go | 33 +- .../go-experimental/store_api_test.go | 3 +- .../petstore/go-experimental/user_api_test.go | 18 +- 24 files changed, 1289 insertions(+), 1367 deletions(-) diff --git a/samples/client/petstore/go-experimental/auth_test.go b/samples/client/petstore/go-experimental/auth_test.go index 0e532aeff3ac..a8c7b7205678 100644 --- a/samples/client/petstore/go-experimental/auth_test.go +++ b/samples/client/petstore/go-experimental/auth_test.go @@ -41,7 +41,8 @@ func TestOAuth2(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute() + addReq := client.PetApi.AddPetGetRequest(context.Background()).Body(newPet) + r, err := client.PetApi.AddPetExecute(addReq) if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -50,7 +51,8 @@ func TestOAuth2(t *testing.T) { t.Log(r) } - r, err = client.PetApi.DeletePet(auth, 12992).Execute() + delReq := client.PetApi.DeletePetGetRequest(auth, 12992) + r, err = client.PetApi.DeletePetExecute(delReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -76,7 +78,8 @@ func TestBasicAuth(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - r, err := client.PetApi.AddPet(auth).Body(newPet).Execute() + addReq := client.PetApi.AddPetGetRequest(auth).Body(newPet) + r, err := client.PetApi.AddPetExecute(addReq) if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -85,7 +88,8 @@ func TestBasicAuth(t *testing.T) { t.Log(r) } - r, err = client.PetApi.DeletePet(auth, 12992).Execute() + delReq := client.PetApi.DeletePetGetRequest(auth, 12992) + r, err = client.PetApi.DeletePetExecute(delReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -106,7 +110,8 @@ func TestAccessToken(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - r, err := client.PetApi.AddPet(nil).Body(newPet).Execute() + addReq := client.PetApi.AddPetGetRequest(nil).Body(newPet) + r, err := client.PetApi.AddPetExecute(addReq) if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -115,7 +120,8 @@ func TestAccessToken(t *testing.T) { t.Log(r) } - r, err = client.PetApi.DeletePet(auth, 12992).Execute() + delReq := client.PetApi.DeletePetGetRequest(auth, 12992) + r, err = client.PetApi.DeletePetExecute(delReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -136,7 +142,8 @@ func TestAPIKeyNoPrefix(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute() + addReq := client.PetApi.AddPetGetRequest(context.Background()).Body(newPet) + r, err := client.PetApi.AddPetExecute(addReq) if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -145,7 +152,8 @@ func TestAPIKeyNoPrefix(t *testing.T) { t.Log(r) } - _, r, err = client.PetApi.GetPetById(auth, 12992).Execute() + getReq := client.PetApi.GetPetByIdGetRequest(auth, 12992) + _, r, err = client.PetApi.GetPetByIdExecute(getReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -155,7 +163,8 @@ func TestAPIKeyNoPrefix(t *testing.T) { t.Errorf("APIKey Authentication is missing") } - r, err = client.PetApi.DeletePet(auth, 12992).Execute() + delReq := client.PetApi.DeletePetGetRequest(auth, 12992) + r, err = client.PetApi.DeletePetExecute(delReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -171,7 +180,8 @@ func TestAPIKeyWithPrefix(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - r, err := client.PetApi.AddPet(nil).Body(newPet).Execute() + addReq := client.PetApi.AddPetGetRequest(nil).Body(newPet) + r, err := client.PetApi.AddPetExecute(addReq) if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -180,7 +190,8 @@ func TestAPIKeyWithPrefix(t *testing.T) { t.Log(r) } - _, r, err = client.PetApi.GetPetById(auth, 12992).Execute() + getReq := client.PetApi.GetPetByIdGetRequest(auth, 12992) + _, r, err = client.PetApi.GetPetByIdExecute(getReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -190,7 +201,8 @@ func TestAPIKeyWithPrefix(t *testing.T) { t.Errorf("APIKey Authentication is missing") } - r, err = client.PetApi.DeletePet(auth, 12992).Execute() + delReq := client.PetApi.DeletePetGetRequest(auth, 12992) + r, err = client.PetApi.DeletePetExecute(delReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -204,7 +216,8 @@ func TestDefaultHeader(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute() + addReq := client.PetApi.AddPetGetRequest(context.Background()).Body(newPet) + r, err := client.PetApi.AddPetExecute(addReq) if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -213,7 +226,8 @@ func TestDefaultHeader(t *testing.T) { t.Log(r) } - r, err = client.PetApi.DeletePet(context.Background(), 12992).Execute() + delReq := client.PetApi.DeletePetGetRequest(context.Background(), 12992) + r, err = client.PetApi.DeletePetExecute(delReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -228,7 +242,8 @@ func TestDefaultHeader(t *testing.T) { } func TestHostOverride(t *testing.T) { - _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute() + req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status(nil) + _, r, err := client.PetApi.FindPetsByStatusExecute(req) if err != nil { t.Fatalf("Error while finding pets by status: %v", err) @@ -240,7 +255,8 @@ func TestHostOverride(t *testing.T) { } func TestSchemeOverride(t *testing.T) { - _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute() + req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status(nil) + _, r, err := client.PetApi.FindPetsByStatusExecute(req) if err != nil { t.Fatalf("Error while finding pets by status: %v", err) diff --git a/samples/client/petstore/go-experimental/fake_api_test.go b/samples/client/petstore/go-experimental/fake_api_test.go index d27137eeacfa..99c0ff29531b 100644 --- a/samples/client/petstore/go-experimental/fake_api_test.go +++ b/samples/client/petstore/go-experimental/fake_api_test.go @@ -17,7 +17,8 @@ func TestPutBodyWithFileSchema(t *testing.T) { File: &sw.File{SourceURI: sw.PtrString("https://example.com/image.png")}, Files: &[]sw.File{{SourceURI: sw.PtrString("https://example.com/image.png")}}} - r, err := client.FakeApi.TestBodyWithFileSchema(context.Background()).Body(schema).Execute() + req := client.FakeApi.TestBodyWithFileSchemaGetRequest(context.Background()).Body(schema) + r, err := client.FakeApi.TestBodyWithFileSchemaExecute(req) if err != nil { t.Fatalf("Error while adding pet: %v", err) diff --git a/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go index cbcbcd620d28..e056b8e60b42 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go @@ -24,34 +24,32 @@ var ( // AnotherFakeApiService AnotherFakeApi service type AnotherFakeApiService service -type apiCall123TestSpecialTagsRequest struct { +type ApiCall123TestSpecialTagsRequest struct { ctx _context.Context - apiService *AnotherFakeApiService body *Client } -func (r apiCall123TestSpecialTagsRequest) Body(body Client) apiCall123TestSpecialTagsRequest { +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 + * 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, + * @return apiCall123TestSpecialTagsRequest + */ +func (a *AnotherFakeApiService) Call123TestSpecialTagsGetRequest(ctx _context.Context) ApiCall123TestSpecialTagsRequest { + return ApiCall123TestSpecialTagsRequest{ ctx: ctx, } } /* -Execute executes the request -@return Client -*/ -func (r apiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, error) { + * Execute executes the request + * @return Client + */ +func (a *AnotherFakeApiService) Call123TestSpecialTagsExecute(r ApiCall123TestSpecialTagsRequest) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -61,7 +59,7 @@ func (r apiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, localVarReturnValue Client ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "AnotherFakeApiService.Call123TestSpecialTags") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AnotherFakeApiService.Call123TestSpecialTags") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -94,12 +92,12 @@ func (r apiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -118,7 +116,7 @@ func (r apiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, return localVarReturnValue, localVarHTTPResponse, newErr } - 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/samples/client/petstore/go-experimental/go-petstore/api_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_fake.go index 773eb594fbf6..a7436012ccb1 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_fake.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_fake.go @@ -27,33 +27,31 @@ var ( // FakeApiService FakeApi service type FakeApiService service -type apiCreateXmlItemRequest struct { +type ApiCreateXmlItemRequest struct { ctx _context.Context - apiService *FakeApiService xmlItem *XmlItem } -func (r apiCreateXmlItemRequest) XmlItem(xmlItem XmlItem) apiCreateXmlItemRequest { +func (r ApiCreateXmlItemRequest) XmlItem(xmlItem XmlItem) ApiCreateXmlItemRequest { r.xmlItem = &xmlItem return r } /* -CreateXmlItem creates an XmlItem -this route creates an XmlItem + * 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, + * @return apiCreateXmlItemRequest + */ +func (a *FakeApiService) CreateXmlItemGetRequest(ctx _context.Context) ApiCreateXmlItemRequest { + return ApiCreateXmlItemRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiCreateXmlItemRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) CreateXmlItemExecute(r ApiCreateXmlItemRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -62,7 +60,7 @@ func (r apiCreateXmlItemRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.CreateXmlItem") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.CreateXmlItem") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -95,12 +93,12 @@ func (r apiCreateXmlItemRequest) Execute() (*_nethttp.Response, error) { } // body params localVarPostBody = r.xmlItem - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -121,34 +119,32 @@ func (r apiCreateXmlItemRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiFakeOuterBooleanSerializeRequest struct { +type ApiFakeOuterBooleanSerializeRequest struct { ctx _context.Context - apiService *FakeApiService body *bool } -func (r apiFakeOuterBooleanSerializeRequest) Body(body bool) apiFakeOuterBooleanSerializeRequest { +func (r ApiFakeOuterBooleanSerializeRequest) Body(body bool) ApiFakeOuterBooleanSerializeRequest { r.body = &body return r } /* -FakeOuterBooleanSerialize Method for FakeOuterBooleanSerialize -Test serialization of outer boolean types + * 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, + * @return apiFakeOuterBooleanSerializeRequest + */ +func (a *FakeApiService) FakeOuterBooleanSerializeGetRequest(ctx _context.Context) ApiFakeOuterBooleanSerializeRequest { + return ApiFakeOuterBooleanSerializeRequest{ ctx: ctx, } } /* -Execute executes the request -@return bool -*/ -func (r apiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response, error) { + * Execute executes the request + * @return bool + */ +func (a *FakeApiService) FakeOuterBooleanSerializeExecute(r ApiFakeOuterBooleanSerializeRequest) (bool, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -158,7 +154,7 @@ func (r apiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response localVarReturnValue bool ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterBooleanSerialize") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterBooleanSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -188,12 +184,12 @@ func (r apiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -212,7 +208,7 @@ func (r apiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -223,34 +219,32 @@ func (r apiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response return localVarReturnValue, localVarHTTPResponse, nil } -type apiFakeOuterCompositeSerializeRequest struct { +type ApiFakeOuterCompositeSerializeRequest struct { ctx _context.Context - apiService *FakeApiService body *OuterComposite } -func (r apiFakeOuterCompositeSerializeRequest) Body(body OuterComposite) apiFakeOuterCompositeSerializeRequest { +func (r ApiFakeOuterCompositeSerializeRequest) Body(body OuterComposite) ApiFakeOuterCompositeSerializeRequest { r.body = &body return r } /* -FakeOuterCompositeSerialize Method for FakeOuterCompositeSerialize -Test serialization of object with outer number type + * 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, + * @return apiFakeOuterCompositeSerializeRequest + */ +func (a *FakeApiService) FakeOuterCompositeSerializeGetRequest(ctx _context.Context) ApiFakeOuterCompositeSerializeRequest { + return ApiFakeOuterCompositeSerializeRequest{ ctx: ctx, } } /* -Execute executes the request -@return OuterComposite -*/ -func (r apiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_nethttp.Response, error) { + * Execute executes the request + * @return OuterComposite + */ +func (a *FakeApiService) FakeOuterCompositeSerializeExecute(r ApiFakeOuterCompositeSerializeRequest) (OuterComposite, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -260,7 +254,7 @@ func (r apiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_neth localVarReturnValue OuterComposite ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterCompositeSerialize") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterCompositeSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -290,12 +284,12 @@ func (r apiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_neth } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -314,7 +308,7 @@ func (r apiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_neth return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -325,34 +319,32 @@ func (r apiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_neth return localVarReturnValue, localVarHTTPResponse, nil } -type apiFakeOuterNumberSerializeRequest struct { +type ApiFakeOuterNumberSerializeRequest struct { ctx _context.Context - apiService *FakeApiService body *float32 } -func (r apiFakeOuterNumberSerializeRequest) Body(body float32) apiFakeOuterNumberSerializeRequest { +func (r ApiFakeOuterNumberSerializeRequest) Body(body float32) ApiFakeOuterNumberSerializeRequest { r.body = &body return r } /* -FakeOuterNumberSerialize Method for FakeOuterNumberSerialize -Test serialization of outer number types + * 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, + * @return apiFakeOuterNumberSerializeRequest + */ +func (a *FakeApiService) FakeOuterNumberSerializeGetRequest(ctx _context.Context) ApiFakeOuterNumberSerializeRequest { + return ApiFakeOuterNumberSerializeRequest{ ctx: ctx, } } /* -Execute executes the request -@return float32 -*/ -func (r apiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Response, error) { + * Execute executes the request + * @return float32 + */ +func (a *FakeApiService) FakeOuterNumberSerializeExecute(r ApiFakeOuterNumberSerializeRequest) (float32, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -362,7 +354,7 @@ func (r apiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Respon localVarReturnValue float32 ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterNumberSerialize") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterNumberSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -392,12 +384,12 @@ func (r apiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Respon } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -416,7 +408,7 @@ func (r apiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Respon return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -427,34 +419,32 @@ func (r apiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Respon return localVarReturnValue, localVarHTTPResponse, nil } -type apiFakeOuterStringSerializeRequest struct { +type ApiFakeOuterStringSerializeRequest struct { ctx _context.Context - apiService *FakeApiService body *string } -func (r apiFakeOuterStringSerializeRequest) Body(body string) apiFakeOuterStringSerializeRequest { +func (r ApiFakeOuterStringSerializeRequest) Body(body string) ApiFakeOuterStringSerializeRequest { r.body = &body return r } /* -FakeOuterStringSerialize Method for FakeOuterStringSerialize -Test serialization of outer string types + * 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, + * @return apiFakeOuterStringSerializeRequest + */ +func (a *FakeApiService) FakeOuterStringSerializeGetRequest(ctx _context.Context) ApiFakeOuterStringSerializeRequest { + return ApiFakeOuterStringSerializeRequest{ ctx: ctx, } } /* -Execute executes the request -@return string -*/ -func (r apiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Response, error) { + * Execute executes the request + * @return string + */ +func (a *FakeApiService) FakeOuterStringSerializeExecute(r ApiFakeOuterStringSerializeRequest) (string, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -464,7 +454,7 @@ func (r apiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Respons localVarReturnValue string ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterStringSerialize") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterStringSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -494,12 +484,12 @@ func (r apiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Respons } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -518,7 +508,7 @@ func (r apiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Respons return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -529,33 +519,31 @@ func (r apiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Respons return localVarReturnValue, localVarHTTPResponse, nil } -type apiTestBodyWithFileSchemaRequest struct { +type ApiTestBodyWithFileSchemaRequest struct { ctx _context.Context - apiService *FakeApiService body *FileSchemaTestClass } -func (r apiTestBodyWithFileSchemaRequest) Body(body FileSchemaTestClass) apiTestBodyWithFileSchemaRequest { +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`. + * 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, + * @return apiTestBodyWithFileSchemaRequest + */ +func (a *FakeApiService) TestBodyWithFileSchemaGetRequest(ctx _context.Context) ApiTestBodyWithFileSchemaRequest { + return ApiTestBodyWithFileSchemaRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestBodyWithFileSchemaRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestBodyWithFileSchemaExecute(r ApiTestBodyWithFileSchemaRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -564,7 +552,7 @@ func (r apiTestBodyWithFileSchemaRequest) Execute() (*_nethttp.Response, error) localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithFileSchema") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithFileSchema") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -597,12 +585,12 @@ func (r apiTestBodyWithFileSchemaRequest) Execute() (*_nethttp.Response, error) } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -623,37 +611,35 @@ func (r apiTestBodyWithFileSchemaRequest) Execute() (*_nethttp.Response, error) return localVarHTTPResponse, nil } -type apiTestBodyWithQueryParamsRequest struct { +type ApiTestBodyWithQueryParamsRequest struct { ctx _context.Context - apiService *FakeApiService query *string body *User } -func (r apiTestBodyWithQueryParamsRequest) Query(query string) apiTestBodyWithQueryParamsRequest { +func (r ApiTestBodyWithQueryParamsRequest) Query(query string) ApiTestBodyWithQueryParamsRequest { r.query = &query return r } -func (r apiTestBodyWithQueryParamsRequest) Body(body User) apiTestBodyWithQueryParamsRequest { +func (r ApiTestBodyWithQueryParamsRequest) Body(body User) ApiTestBodyWithQueryParamsRequest { r.body = &body return r } /* -TestBodyWithQueryParams Method for TestBodyWithQueryParams + * 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, + * @return apiTestBodyWithQueryParamsRequest + */ +func (a *FakeApiService) TestBodyWithQueryParamsGetRequest(ctx _context.Context) ApiTestBodyWithQueryParamsRequest { + return ApiTestBodyWithQueryParamsRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestBodyWithQueryParamsRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestBodyWithQueryParamsExecute(r ApiTestBodyWithQueryParamsRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -662,7 +648,7 @@ func (r apiTestBodyWithQueryParamsRequest) Execute() (*_nethttp.Response, error) localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithQueryParams") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithQueryParams") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -699,12 +685,12 @@ func (r apiTestBodyWithQueryParamsRequest) Execute() (*_nethttp.Response, error) } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -725,34 +711,32 @@ func (r apiTestBodyWithQueryParamsRequest) Execute() (*_nethttp.Response, error) return localVarHTTPResponse, nil } -type apiTestClientModelRequest struct { +type ApiTestClientModelRequest struct { ctx _context.Context - apiService *FakeApiService body *Client } -func (r apiTestClientModelRequest) Body(body Client) apiTestClientModelRequest { +func (r ApiTestClientModelRequest) Body(body Client) ApiTestClientModelRequest { r.body = &body return r } /* -TestClientModel To test \"client\" model -To test "client" model + * 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, + * @return apiTestClientModelRequest + */ +func (a *FakeApiService) TestClientModelGetRequest(ctx _context.Context) ApiTestClientModelRequest { + return ApiTestClientModelRequest{ ctx: ctx, } } /* -Execute executes the request -@return Client -*/ -func (r apiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) { + * Execute executes the request + * @return Client + */ +func (a *FakeApiService) TestClientModelExecute(r ApiTestClientModelRequest) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -762,7 +746,7 @@ func (r apiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) localVarReturnValue Client ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestClientModel") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestClientModel") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -795,12 +779,12 @@ func (r apiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -819,7 +803,7 @@ func (r apiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -830,9 +814,8 @@ func (r apiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) return localVarReturnValue, localVarHTTPResponse, nil } -type apiTestEndpointParametersRequest struct { +type ApiTestEndpointParametersRequest struct { ctx _context.Context - apiService *FakeApiService number *float32 double *float64 patternWithoutDelimiter *string @@ -849,82 +832,81 @@ type apiTestEndpointParametersRequest struct { callback *string } -func (r apiTestEndpointParametersRequest) Number(number float32) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Number(number float32) ApiTestEndpointParametersRequest { r.number = &number return r } -func (r apiTestEndpointParametersRequest) Double(double float64) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Double(double float64) ApiTestEndpointParametersRequest { r.double = &double return r } -func (r apiTestEndpointParametersRequest) PatternWithoutDelimiter(patternWithoutDelimiter string) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) PatternWithoutDelimiter(patternWithoutDelimiter string) ApiTestEndpointParametersRequest { r.patternWithoutDelimiter = &patternWithoutDelimiter return r } -func (r apiTestEndpointParametersRequest) Byte_(byte_ string) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Byte_(byte_ string) ApiTestEndpointParametersRequest { r.byte_ = &byte_ return r } -func (r apiTestEndpointParametersRequest) Integer(integer int32) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Integer(integer int32) ApiTestEndpointParametersRequest { r.integer = &integer return r } -func (r apiTestEndpointParametersRequest) Int32_(int32_ int32) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Int32_(int32_ int32) ApiTestEndpointParametersRequest { r.int32_ = &int32_ return r } -func (r apiTestEndpointParametersRequest) Int64_(int64_ int64) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Int64_(int64_ int64) ApiTestEndpointParametersRequest { r.int64_ = &int64_ return r } -func (r apiTestEndpointParametersRequest) Float(float float32) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Float(float float32) ApiTestEndpointParametersRequest { r.float = &float return r } -func (r apiTestEndpointParametersRequest) String_(string_ string) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) String_(string_ string) ApiTestEndpointParametersRequest { r.string_ = &string_ return r } -func (r apiTestEndpointParametersRequest) Binary(binary *os.File) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Binary(binary *os.File) ApiTestEndpointParametersRequest { r.binary = &binary return r } -func (r apiTestEndpointParametersRequest) Date(date string) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Date(date string) ApiTestEndpointParametersRequest { r.date = &date return r } -func (r apiTestEndpointParametersRequest) DateTime(dateTime time.Time) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) DateTime(dateTime time.Time) ApiTestEndpointParametersRequest { r.dateTime = &dateTime return r } -func (r apiTestEndpointParametersRequest) Password(password string) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Password(password string) ApiTestEndpointParametersRequest { r.password = &password return r } -func (r apiTestEndpointParametersRequest) Callback(callback string) apiTestEndpointParametersRequest { +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 + * 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, + * @return apiTestEndpointParametersRequest + */ +func (a *FakeApiService) TestEndpointParametersGetRequest(ctx _context.Context) ApiTestEndpointParametersRequest { + return ApiTestEndpointParametersRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestEndpointParametersRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestEndpointParametersExecute(r ApiTestEndpointParametersRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -933,7 +915,7 @@ func (r apiTestEndpointParametersRequest) Execute() (*_nethttp.Response, error) localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEndpointParameters") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEndpointParameters") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1027,12 +1009,12 @@ func (r apiTestEndpointParametersRequest) Execute() (*_nethttp.Response, error) 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) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1053,9 +1035,8 @@ func (r apiTestEndpointParametersRequest) Execute() (*_nethttp.Response, error) return localVarHTTPResponse, nil } -type apiTestEnumParametersRequest struct { +type ApiTestEnumParametersRequest struct { ctx _context.Context - apiService *FakeApiService enumHeaderStringArray *[]string enumHeaderString *string enumQueryStringArray *[]string @@ -1066,55 +1047,54 @@ type apiTestEnumParametersRequest struct { enumFormString *string } -func (r apiTestEnumParametersRequest) EnumHeaderStringArray(enumHeaderStringArray []string) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumHeaderStringArray(enumHeaderStringArray []string) ApiTestEnumParametersRequest { r.enumHeaderStringArray = &enumHeaderStringArray return r } -func (r apiTestEnumParametersRequest) EnumHeaderString(enumHeaderString string) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumHeaderString(enumHeaderString string) ApiTestEnumParametersRequest { r.enumHeaderString = &enumHeaderString return r } -func (r apiTestEnumParametersRequest) EnumQueryStringArray(enumQueryStringArray []string) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumQueryStringArray(enumQueryStringArray []string) ApiTestEnumParametersRequest { r.enumQueryStringArray = &enumQueryStringArray return r } -func (r apiTestEnumParametersRequest) EnumQueryString(enumQueryString string) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumQueryString(enumQueryString string) ApiTestEnumParametersRequest { r.enumQueryString = &enumQueryString return r } -func (r apiTestEnumParametersRequest) EnumQueryInteger(enumQueryInteger int32) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumQueryInteger(enumQueryInteger int32) ApiTestEnumParametersRequest { r.enumQueryInteger = &enumQueryInteger return r } -func (r apiTestEnumParametersRequest) EnumQueryDouble(enumQueryDouble float64) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumQueryDouble(enumQueryDouble float64) ApiTestEnumParametersRequest { r.enumQueryDouble = &enumQueryDouble return r } -func (r apiTestEnumParametersRequest) EnumFormStringArray(enumFormStringArray []string) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumFormStringArray(enumFormStringArray []string) ApiTestEnumParametersRequest { r.enumFormStringArray = &enumFormStringArray return r } -func (r apiTestEnumParametersRequest) EnumFormString(enumFormString string) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumFormString(enumFormString string) ApiTestEnumParametersRequest { r.enumFormString = &enumFormString return r } /* -TestEnumParameters To test enum parameters -To test enum parameters + * 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, + * @return apiTestEnumParametersRequest + */ +func (a *FakeApiService) TestEnumParametersGetRequest(ctx _context.Context) ApiTestEnumParametersRequest { + return ApiTestEnumParametersRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestEnumParametersRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestEnumParametersExecute(r ApiTestEnumParametersRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1123,7 +1103,7 @@ func (r apiTestEnumParametersRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEnumParameters") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEnumParameters") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1175,12 +1155,12 @@ func (r apiTestEnumParametersRequest) Execute() (*_nethttp.Response, error) { 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) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1201,9 +1181,8 @@ func (r apiTestEnumParametersRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiTestGroupParametersRequest struct { +type ApiTestGroupParametersRequest struct { ctx _context.Context - apiService *FakeApiService requiredStringGroup *int32 requiredBooleanGroup *bool requiredInt64Group *int64 @@ -1212,47 +1191,46 @@ type apiTestGroupParametersRequest struct { int64Group *int64 } -func (r apiTestGroupParametersRequest) RequiredStringGroup(requiredStringGroup int32) apiTestGroupParametersRequest { +func (r ApiTestGroupParametersRequest) RequiredStringGroup(requiredStringGroup int32) ApiTestGroupParametersRequest { r.requiredStringGroup = &requiredStringGroup return r } -func (r apiTestGroupParametersRequest) RequiredBooleanGroup(requiredBooleanGroup bool) apiTestGroupParametersRequest { +func (r ApiTestGroupParametersRequest) RequiredBooleanGroup(requiredBooleanGroup bool) ApiTestGroupParametersRequest { r.requiredBooleanGroup = &requiredBooleanGroup return r } -func (r apiTestGroupParametersRequest) RequiredInt64Group(requiredInt64Group int64) apiTestGroupParametersRequest { +func (r ApiTestGroupParametersRequest) RequiredInt64Group(requiredInt64Group int64) ApiTestGroupParametersRequest { r.requiredInt64Group = &requiredInt64Group return r } -func (r apiTestGroupParametersRequest) StringGroup(stringGroup int32) apiTestGroupParametersRequest { +func (r ApiTestGroupParametersRequest) StringGroup(stringGroup int32) ApiTestGroupParametersRequest { r.stringGroup = &stringGroup return r } -func (r apiTestGroupParametersRequest) BooleanGroup(booleanGroup bool) apiTestGroupParametersRequest { +func (r ApiTestGroupParametersRequest) BooleanGroup(booleanGroup bool) ApiTestGroupParametersRequest { r.booleanGroup = &booleanGroup return r } -func (r apiTestGroupParametersRequest) Int64Group(int64Group int64) apiTestGroupParametersRequest { +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) + * 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, + * @return apiTestGroupParametersRequest + */ +func (a *FakeApiService) TestGroupParametersGetRequest(ctx _context.Context) ApiTestGroupParametersRequest { + return ApiTestGroupParametersRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestGroupParametersRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestGroupParametersExecute(r ApiTestGroupParametersRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -1261,7 +1239,7 @@ func (r apiTestGroupParametersRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestGroupParameters") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestGroupParameters") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1310,12 +1288,12 @@ func (r apiTestGroupParametersRequest) Execute() (*_nethttp.Response, error) { 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) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1336,32 +1314,30 @@ func (r apiTestGroupParametersRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiTestInlineAdditionalPropertiesRequest struct { +type ApiTestInlineAdditionalPropertiesRequest struct { ctx _context.Context - apiService *FakeApiService param *map[string]string } -func (r apiTestInlineAdditionalPropertiesRequest) Param(param map[string]string) apiTestInlineAdditionalPropertiesRequest { +func (r ApiTestInlineAdditionalPropertiesRequest) Param(param map[string]string) ApiTestInlineAdditionalPropertiesRequest { r.param = ¶m return r } /* -TestInlineAdditionalProperties test inline additionalProperties + * 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, + * @return apiTestInlineAdditionalPropertiesRequest + */ +func (a *FakeApiService) TestInlineAdditionalPropertiesGetRequest(ctx _context.Context) ApiTestInlineAdditionalPropertiesRequest { + return ApiTestInlineAdditionalPropertiesRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestInlineAdditionalPropertiesRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestInlineAdditionalPropertiesExecute(r ApiTestInlineAdditionalPropertiesRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1370,7 +1346,7 @@ func (r apiTestInlineAdditionalPropertiesRequest) Execute() (*_nethttp.Response, localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestInlineAdditionalProperties") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestInlineAdditionalProperties") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1403,12 +1379,12 @@ func (r apiTestInlineAdditionalPropertiesRequest) Execute() (*_nethttp.Response, } // body params localVarPostBody = r.param - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1429,37 +1405,35 @@ func (r apiTestInlineAdditionalPropertiesRequest) Execute() (*_nethttp.Response, return localVarHTTPResponse, nil } -type apiTestJsonFormDataRequest struct { +type ApiTestJsonFormDataRequest struct { ctx _context.Context - apiService *FakeApiService param *string param2 *string } -func (r apiTestJsonFormDataRequest) Param(param string) apiTestJsonFormDataRequest { +func (r ApiTestJsonFormDataRequest) Param(param string) ApiTestJsonFormDataRequest { r.param = ¶m return r } -func (r apiTestJsonFormDataRequest) Param2(param2 string) apiTestJsonFormDataRequest { +func (r ApiTestJsonFormDataRequest) Param2(param2 string) ApiTestJsonFormDataRequest { r.param2 = ¶m2 return r } /* -TestJsonFormData test json serialization of form data + * 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, + * @return apiTestJsonFormDataRequest + */ +func (a *FakeApiService) TestJsonFormDataGetRequest(ctx _context.Context) ApiTestJsonFormDataRequest { + return ApiTestJsonFormDataRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestJsonFormDataRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestJsonFormDataExecute(r ApiTestJsonFormDataRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1468,7 +1442,7 @@ func (r apiTestJsonFormDataRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestJsonFormData") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestJsonFormData") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1504,12 +1478,12 @@ func (r apiTestJsonFormDataRequest) Execute() (*_nethttp.Response, error) { } 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) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1530,9 +1504,8 @@ func (r apiTestJsonFormDataRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiTestQueryParameterCollectionFormatRequest struct { +type ApiTestQueryParameterCollectionFormatRequest struct { ctx _context.Context - apiService *FakeApiService pipe *[]string ioutil *[]string http *[]string @@ -1540,43 +1513,42 @@ type apiTestQueryParameterCollectionFormatRequest struct { context *[]string } -func (r apiTestQueryParameterCollectionFormatRequest) Pipe(pipe []string) apiTestQueryParameterCollectionFormatRequest { +func (r ApiTestQueryParameterCollectionFormatRequest) Pipe(pipe []string) ApiTestQueryParameterCollectionFormatRequest { r.pipe = &pipe return r } -func (r apiTestQueryParameterCollectionFormatRequest) Ioutil(ioutil []string) apiTestQueryParameterCollectionFormatRequest { +func (r ApiTestQueryParameterCollectionFormatRequest) Ioutil(ioutil []string) ApiTestQueryParameterCollectionFormatRequest { r.ioutil = &ioutil return r } -func (r apiTestQueryParameterCollectionFormatRequest) Http(http []string) apiTestQueryParameterCollectionFormatRequest { +func (r ApiTestQueryParameterCollectionFormatRequest) Http(http []string) ApiTestQueryParameterCollectionFormatRequest { r.http = &http return r } -func (r apiTestQueryParameterCollectionFormatRequest) Url(url []string) apiTestQueryParameterCollectionFormatRequest { +func (r ApiTestQueryParameterCollectionFormatRequest) Url(url []string) ApiTestQueryParameterCollectionFormatRequest { r.url = &url return r } -func (r apiTestQueryParameterCollectionFormatRequest) Context(context []string) apiTestQueryParameterCollectionFormatRequest { +func (r ApiTestQueryParameterCollectionFormatRequest) Context(context []string) ApiTestQueryParameterCollectionFormatRequest { r.context = &context return r } /* -TestQueryParameterCollectionFormat Method for TestQueryParameterCollectionFormat -To test the collection format in query parameters + * 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, + * @return apiTestQueryParameterCollectionFormatRequest + */ +func (a *FakeApiService) TestQueryParameterCollectionFormatGetRequest(ctx _context.Context) ApiTestQueryParameterCollectionFormatRequest { + return ApiTestQueryParameterCollectionFormatRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestQueryParameterCollectionFormatRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestQueryParameterCollectionFormatExecute(r ApiTestQueryParameterCollectionFormatRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1585,7 +1557,7 @@ func (r apiTestQueryParameterCollectionFormatRequest) Execute() (*_nethttp.Respo localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestQueryParameterCollectionFormat") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestQueryParameterCollectionFormat") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1643,12 +1615,12 @@ func (r apiTestQueryParameterCollectionFormatRequest) Execute() (*_nethttp.Respo if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } diff --git a/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go b/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go index d126ee0bd33e..afb29bedf8fd 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go @@ -24,34 +24,32 @@ var ( // FakeClassnameTags123ApiService FakeClassnameTags123Api service type FakeClassnameTags123ApiService service -type apiTestClassnameRequest struct { +type ApiTestClassnameRequest struct { ctx _context.Context - apiService *FakeClassnameTags123ApiService body *Client } -func (r apiTestClassnameRequest) Body(body Client) apiTestClassnameRequest { +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 + * 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, + * @return apiTestClassnameRequest + */ +func (a *FakeClassnameTags123ApiService) TestClassnameGetRequest(ctx _context.Context) ApiTestClassnameRequest { + return ApiTestClassnameRequest{ ctx: ctx, } } /* -Execute executes the request -@return Client -*/ -func (r apiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) { + * Execute executes the request + * @return Client + */ +func (a *FakeClassnameTags123ApiService) TestClassnameExecute(r ApiTestClassnameRequest) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -61,7 +59,7 @@ func (r apiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) { localVarReturnValue Client ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeClassnameTags123ApiService.TestClassname") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeClassnameTags123ApiService.TestClassname") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -108,12 +106,12 @@ func (r apiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) { } } } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -132,7 +130,7 @@ func (r apiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, newErr } - 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/samples/client/petstore/go-experimental/go-petstore/api_pet.go b/samples/client/petstore/go-experimental/go-petstore/api_pet.go index 7bdcc03c6bff..1709d29b98ce 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_pet.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_pet.go @@ -26,32 +26,30 @@ var ( // PetApiService PetApi service type PetApiService service -type apiAddPetRequest struct { +type ApiAddPetRequest struct { ctx _context.Context - apiService *PetApiService body *Pet } -func (r apiAddPetRequest) Body(body Pet) apiAddPetRequest { +func (r ApiAddPetRequest) Body(body Pet) ApiAddPetRequest { r.body = &body return r } /* -AddPet Add a new pet to the store + * 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, + * @return apiAddPetRequest + */ +func (a *PetApiService) AddPetGetRequest(ctx _context.Context) ApiAddPetRequest { + return ApiAddPetRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiAddPetRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *PetApiService) AddPetExecute(r ApiAddPetRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -60,7 +58,7 @@ func (r apiAddPetRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.AddPet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.AddPet") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -93,12 +91,12 @@ func (r apiAddPetRequest) Execute() (*_nethttp.Response, error) { } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -119,35 +117,33 @@ func (r apiAddPetRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiDeletePetRequest struct { +type ApiDeletePetRequest struct { ctx _context.Context - apiService *PetApiService petId int64 apiKey *string } -func (r apiDeletePetRequest) ApiKey(apiKey string) apiDeletePetRequest { +func (r ApiDeletePetRequest) ApiKey(apiKey string) ApiDeletePetRequest { r.apiKey = &apiKey return r } /* -DeletePet Deletes a pet + * 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, + * @return apiDeletePetRequest + */ +func (a *PetApiService) DeletePetGetRequest(ctx _context.Context, petId int64) ApiDeletePetRequest { + return ApiDeletePetRequest{ ctx: ctx, petId: petId, } } /* -Execute executes the request -*/ -func (r apiDeletePetRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *PetApiService) DeletePetExecute(r ApiDeletePetRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -156,7 +152,7 @@ func (r apiDeletePetRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.DeletePet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.DeletePet") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -188,12 +184,12 @@ func (r apiDeletePetRequest) Execute() (*_nethttp.Response, error) { 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) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -214,34 +210,32 @@ func (r apiDeletePetRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiFindPetsByStatusRequest struct { +type ApiFindPetsByStatusRequest struct { ctx _context.Context - apiService *PetApiService status *[]string } -func (r apiFindPetsByStatusRequest) Status(status []string) apiFindPetsByStatusRequest { +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 + * 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, + * @return apiFindPetsByStatusRequest + */ +func (a *PetApiService) FindPetsByStatusGetRequest(ctx _context.Context) ApiFindPetsByStatusRequest { + return ApiFindPetsByStatusRequest{ ctx: ctx, } } /* -Execute executes the request -@return []Pet -*/ -func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) { + * Execute executes the request + * @return []Pet + */ +func (a *PetApiService) FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([]Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -251,7 +245,7 @@ func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) localVarReturnValue []Pet ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByStatus") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByStatus") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -283,12 +277,12 @@ func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -307,7 +301,7 @@ func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -318,34 +312,32 @@ func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) return localVarReturnValue, localVarHTTPResponse, nil } -type apiFindPetsByTagsRequest struct { +type ApiFindPetsByTagsRequest struct { ctx _context.Context - apiService *PetApiService tags *[]string } -func (r apiFindPetsByTagsRequest) Tags(tags []string) apiFindPetsByTagsRequest { +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. + * 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, + * @return apiFindPetsByTagsRequest + */ +func (a *PetApiService) FindPetsByTagsGetRequest(ctx _context.Context) ApiFindPetsByTagsRequest { + return ApiFindPetsByTagsRequest{ ctx: ctx, } } /* -Execute executes the request -@return []Pet -*/ -func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { + * Execute executes the request + * @return []Pet + */ +func (a *PetApiService) FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -355,7 +347,7 @@ func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { localVarReturnValue []Pet ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByTags") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByTags") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -387,12 +379,12 @@ func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -411,7 +403,7 @@ func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -422,32 +414,30 @@ func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, nil } -type apiGetPetByIdRequest struct { +type ApiGetPetByIdRequest struct { ctx _context.Context - apiService *PetApiService petId int64 } /* -GetPetById Find pet by ID -Returns a single pet + * 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, + * @return apiGetPetByIdRequest + */ +func (a *PetApiService) GetPetByIdGetRequest(ctx _context.Context, petId int64) ApiGetPetByIdRequest { + return ApiGetPetByIdRequest{ ctx: ctx, petId: petId, } } /* -Execute executes the request -@return Pet -*/ -func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { + * Execute executes the request + * @return Pet + */ +func (a *PetApiService) GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -457,7 +447,7 @@ func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { localVarReturnValue Pet ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.GetPetById") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.GetPetById") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -500,12 +490,12 @@ func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { } } } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -524,7 +514,7 @@ func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -535,32 +525,30 @@ func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, nil } -type apiUpdatePetRequest struct { +type ApiUpdatePetRequest struct { ctx _context.Context - apiService *PetApiService body *Pet } -func (r apiUpdatePetRequest) Body(body Pet) apiUpdatePetRequest { +func (r ApiUpdatePetRequest) Body(body Pet) ApiUpdatePetRequest { r.body = &body return r } /* -UpdatePet Update an existing pet + * 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, + * @return apiUpdatePetRequest + */ +func (a *PetApiService) UpdatePetGetRequest(ctx _context.Context) ApiUpdatePetRequest { + return ApiUpdatePetRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiUpdatePetRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *PetApiService) UpdatePetExecute(r ApiUpdatePetRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -569,7 +557,7 @@ func (r apiUpdatePetRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePet") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -602,12 +590,12 @@ func (r apiUpdatePetRequest) Execute() (*_nethttp.Response, error) { } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -628,40 +616,38 @@ func (r apiUpdatePetRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiUpdatePetWithFormRequest struct { +type ApiUpdatePetWithFormRequest struct { ctx _context.Context - apiService *PetApiService petId int64 name *string status *string } -func (r apiUpdatePetWithFormRequest) Name(name string) apiUpdatePetWithFormRequest { +func (r ApiUpdatePetWithFormRequest) Name(name string) ApiUpdatePetWithFormRequest { r.name = &name return r } -func (r apiUpdatePetWithFormRequest) Status(status string) apiUpdatePetWithFormRequest { +func (r ApiUpdatePetWithFormRequest) Status(status string) ApiUpdatePetWithFormRequest { r.status = &status return r } /* -UpdatePetWithForm Updates a pet in the store with form data + * 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, + * @return apiUpdatePetWithFormRequest + */ +func (a *PetApiService) UpdatePetWithFormGetRequest(ctx _context.Context, petId int64) ApiUpdatePetWithFormRequest { + return ApiUpdatePetWithFormRequest{ ctx: ctx, petId: petId, } } /* -Execute executes the request -*/ -func (r apiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *PetApiService) UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -670,7 +656,7 @@ func (r apiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePetWithForm") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePetWithForm") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -705,12 +691,12 @@ func (r apiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) { 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) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -731,41 +717,39 @@ func (r apiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiUploadFileRequest struct { +type ApiUploadFileRequest struct { ctx _context.Context - apiService *PetApiService petId int64 additionalMetadata *string file **os.File } -func (r apiUploadFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileRequest { +func (r ApiUploadFileRequest) AdditionalMetadata(additionalMetadata string) ApiUploadFileRequest { r.additionalMetadata = &additionalMetadata return r } -func (r apiUploadFileRequest) File(file *os.File) apiUploadFileRequest { +func (r ApiUploadFileRequest) File(file *os.File) ApiUploadFileRequest { r.file = &file return r } /* -UploadFile uploads an image + * 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, + * @return apiUploadFileRequest + */ +func (a *PetApiService) UploadFileGetRequest(ctx _context.Context, petId int64) ApiUploadFileRequest { + return ApiUploadFileRequest{ ctx: ctx, petId: petId, } } /* -Execute executes the request -@return ApiResponse -*/ -func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { + * Execute executes the request + * @return ApiResponse + */ +func (a *PetApiService) UploadFileExecute(r ApiUploadFileRequest) (ApiResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -775,7 +759,7 @@ func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) localVarReturnValue ApiResponse ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFile") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFile") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -818,12 +802,12 @@ func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) localVarFileName = localVarFile.Name() localVarFile.Close() } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -842,7 +826,7 @@ func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -853,41 +837,39 @@ func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) return localVarReturnValue, localVarHTTPResponse, nil } -type apiUploadFileWithRequiredFileRequest struct { +type ApiUploadFileWithRequiredFileRequest struct { ctx _context.Context - apiService *PetApiService petId int64 requiredFile **os.File additionalMetadata *string } -func (r apiUploadFileWithRequiredFileRequest) RequiredFile(requiredFile *os.File) apiUploadFileWithRequiredFileRequest { +func (r ApiUploadFileWithRequiredFileRequest) RequiredFile(requiredFile *os.File) ApiUploadFileWithRequiredFileRequest { r.requiredFile = &requiredFile return r } -func (r apiUploadFileWithRequiredFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileWithRequiredFileRequest { +func (r ApiUploadFileWithRequiredFileRequest) AdditionalMetadata(additionalMetadata string) ApiUploadFileWithRequiredFileRequest { r.additionalMetadata = &additionalMetadata return r } /* -UploadFileWithRequiredFile uploads an image (required) + * 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, + * @return apiUploadFileWithRequiredFileRequest + */ +func (a *PetApiService) UploadFileWithRequiredFileGetRequest(ctx _context.Context, petId int64) ApiUploadFileWithRequiredFileRequest { + return ApiUploadFileWithRequiredFileRequest{ ctx: ctx, petId: petId, } } /* -Execute executes the request -@return ApiResponse -*/ -func (r apiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { + * Execute executes the request + * @return ApiResponse + */ +func (a *PetApiService) UploadFileWithRequiredFileExecute(r ApiUploadFileWithRequiredFileRequest) (ApiResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -897,7 +879,7 @@ func (r apiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp. localVarReturnValue ApiResponse ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFileWithRequiredFile") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFileWithRequiredFile") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -940,12 +922,12 @@ func (r apiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp. localVarFileName = localVarFile.Name() localVarFile.Close() } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -964,7 +946,7 @@ func (r apiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp. return localVarReturnValue, localVarHTTPResponse, newErr } - 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/samples/client/petstore/go-experimental/go-petstore/api_store.go b/samples/client/petstore/go-experimental/go-petstore/api_store.go index 8d81867701cf..6eac7f21e211 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_store.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_store.go @@ -25,31 +25,29 @@ var ( // StoreApiService StoreApi service type StoreApiService service -type apiDeleteOrderRequest struct { +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 + * 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, + * @return apiDeleteOrderRequest + */ +func (a *StoreApiService) DeleteOrderGetRequest(ctx _context.Context, orderId string) ApiDeleteOrderRequest { + return ApiDeleteOrderRequest{ ctx: ctx, orderId: orderId, } } /* -Execute executes the request -*/ -func (r apiDeleteOrderRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *StoreApiService) DeleteOrderExecute(r ApiDeleteOrderRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -58,7 +56,7 @@ func (r apiDeleteOrderRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.DeleteOrder") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.DeleteOrder") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -87,12 +85,12 @@ func (r apiDeleteOrderRequest) Execute() (*_nethttp.Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -113,29 +111,27 @@ func (r apiDeleteOrderRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiGetInventoryRequest struct { +type ApiGetInventoryRequest struct { ctx _context.Context - apiService *StoreApiService } /* -GetInventory Returns pet inventories by status -Returns a map of status codes to quantities + * 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, + * @return apiGetInventoryRequest + */ +func (a *StoreApiService) GetInventoryGetRequest(ctx _context.Context) ApiGetInventoryRequest { + return ApiGetInventoryRequest{ ctx: ctx, } } /* -Execute executes the request -@return map[string]int32 -*/ -func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, error) { + * Execute executes the request + * @return map[string]int32 + */ +func (a *StoreApiService) GetInventoryExecute(r ApiGetInventoryRequest) (map[string]int32, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -145,7 +141,7 @@ func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, localVarReturnValue map[string]int32 ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetInventory") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetInventory") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -187,12 +183,12 @@ func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, } } } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -211,7 +207,7 @@ func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -222,32 +218,30 @@ func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, return localVarReturnValue, localVarHTTPResponse, nil } -type apiGetOrderByIdRequest struct { +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 + * 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, + * @return apiGetOrderByIdRequest + */ +func (a *StoreApiService) GetOrderByIdGetRequest(ctx _context.Context, orderId int64) ApiGetOrderByIdRequest { + return ApiGetOrderByIdRequest{ ctx: ctx, orderId: orderId, } } /* -Execute executes the request -@return Order -*/ -func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { + * Execute executes the request + * @return Order + */ +func (a *StoreApiService) GetOrderByIdExecute(r ApiGetOrderByIdRequest) (Order, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -257,7 +251,7 @@ func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { localVarReturnValue Order ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetOrderById") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetOrderById") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -292,12 +286,12 @@ func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -316,7 +310,7 @@ func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -327,33 +321,31 @@ func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, nil } -type apiPlaceOrderRequest struct { +type ApiPlaceOrderRequest struct { ctx _context.Context - apiService *StoreApiService body *Order } -func (r apiPlaceOrderRequest) Body(body Order) apiPlaceOrderRequest { +func (r ApiPlaceOrderRequest) Body(body Order) ApiPlaceOrderRequest { r.body = &body return r } /* -PlaceOrder Place an order for a pet + * 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, + * @return apiPlaceOrderRequest + */ +func (a *StoreApiService) PlaceOrderGetRequest(ctx _context.Context) ApiPlaceOrderRequest { + return ApiPlaceOrderRequest{ ctx: ctx, } } /* -Execute executes the request -@return Order -*/ -func (r apiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) { + * Execute executes the request + * @return Order + */ +func (a *StoreApiService) PlaceOrderExecute(r ApiPlaceOrderRequest) (Order, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -363,7 +355,7 @@ func (r apiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) { localVarReturnValue Order ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.PlaceOrder") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.PlaceOrder") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -396,12 +388,12 @@ func (r apiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) { } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -420,7 +412,7 @@ func (r apiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, newErr } - 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/samples/client/petstore/go-experimental/go-petstore/api_user.go b/samples/client/petstore/go-experimental/go-petstore/api_user.go index 6bee2f19b7e8..b1055caec5fd 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_user.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_user.go @@ -25,33 +25,31 @@ var ( // UserApiService UserApi service type UserApiService service -type apiCreateUserRequest struct { +type ApiCreateUserRequest struct { ctx _context.Context - apiService *UserApiService body *User } -func (r apiCreateUserRequest) Body(body User) apiCreateUserRequest { +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. + * 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, + * @return apiCreateUserRequest + */ +func (a *UserApiService) CreateUserGetRequest(ctx _context.Context) ApiCreateUserRequest { + return ApiCreateUserRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiCreateUserRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *UserApiService) CreateUserExecute(r ApiCreateUserRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -60,7 +58,7 @@ func (r apiCreateUserRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUser") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -93,12 +91,12 @@ func (r apiCreateUserRequest) Execute() (*_nethttp.Response, error) { } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -119,32 +117,30 @@ func (r apiCreateUserRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiCreateUsersWithArrayInputRequest struct { +type ApiCreateUsersWithArrayInputRequest struct { ctx _context.Context - apiService *UserApiService body *[]User } -func (r apiCreateUsersWithArrayInputRequest) Body(body []User) apiCreateUsersWithArrayInputRequest { +func (r ApiCreateUsersWithArrayInputRequest) Body(body []User) ApiCreateUsersWithArrayInputRequest { r.body = &body return r } /* -CreateUsersWithArrayInput Creates list of users with given input array + * 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, + * @return apiCreateUsersWithArrayInputRequest + */ +func (a *UserApiService) CreateUsersWithArrayInputGetRequest(ctx _context.Context) ApiCreateUsersWithArrayInputRequest { + return ApiCreateUsersWithArrayInputRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *UserApiService) CreateUsersWithArrayInputExecute(r ApiCreateUsersWithArrayInputRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -153,7 +149,7 @@ func (r apiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, erro localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithArrayInput") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithArrayInput") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -186,12 +182,12 @@ func (r apiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, erro } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -212,32 +208,30 @@ func (r apiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, erro return localVarHTTPResponse, nil } -type apiCreateUsersWithListInputRequest struct { +type ApiCreateUsersWithListInputRequest struct { ctx _context.Context - apiService *UserApiService body *[]User } -func (r apiCreateUsersWithListInputRequest) Body(body []User) apiCreateUsersWithListInputRequest { +func (r ApiCreateUsersWithListInputRequest) Body(body []User) ApiCreateUsersWithListInputRequest { r.body = &body return r } /* -CreateUsersWithListInput Creates list of users with given input array + * 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, + * @return apiCreateUsersWithListInputRequest + */ +func (a *UserApiService) CreateUsersWithListInputGetRequest(ctx _context.Context) ApiCreateUsersWithListInputRequest { + return ApiCreateUsersWithListInputRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *UserApiService) CreateUsersWithListInputExecute(r ApiCreateUsersWithListInputRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -246,7 +240,7 @@ func (r apiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithListInput") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithListInput") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -279,12 +273,12 @@ func (r apiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -305,31 +299,29 @@ func (r apiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error return localVarHTTPResponse, nil } -type apiDeleteUserRequest struct { +type ApiDeleteUserRequest struct { ctx _context.Context - apiService *UserApiService username string } /* -DeleteUser Delete user -This can only be done by the logged in user. + * 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, + * @return apiDeleteUserRequest + */ +func (a *UserApiService) DeleteUserGetRequest(ctx _context.Context, username string) ApiDeleteUserRequest { + return ApiDeleteUserRequest{ ctx: ctx, username: username, } } /* -Execute executes the request -*/ -func (r apiDeleteUserRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *UserApiService) DeleteUserExecute(r ApiDeleteUserRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -338,7 +330,7 @@ func (r apiDeleteUserRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.DeleteUser") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.DeleteUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -367,12 +359,12 @@ func (r apiDeleteUserRequest) Execute() (*_nethttp.Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -393,31 +385,29 @@ func (r apiDeleteUserRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiGetUserByNameRequest struct { +type ApiGetUserByNameRequest struct { ctx _context.Context - apiService *UserApiService username string } /* -GetUserByName Get user by user name + * 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, + * @return apiGetUserByNameRequest + */ +func (a *UserApiService) GetUserByNameGetRequest(ctx _context.Context, username string) ApiGetUserByNameRequest { + return ApiGetUserByNameRequest{ ctx: ctx, username: username, } } /* -Execute executes the request -@return User -*/ -func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { + * Execute executes the request + * @return User + */ +func (a *UserApiService) GetUserByNameExecute(r ApiGetUserByNameRequest) (User, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -427,7 +417,7 @@ func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { localVarReturnValue User ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.GetUserByName") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.GetUserByName") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -456,12 +446,12 @@ func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -480,7 +470,7 @@ func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -491,38 +481,36 @@ func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, nil } -type apiLoginUserRequest struct { +type ApiLoginUserRequest struct { ctx _context.Context - apiService *UserApiService username *string password *string } -func (r apiLoginUserRequest) Username(username string) apiLoginUserRequest { +func (r ApiLoginUserRequest) Username(username string) ApiLoginUserRequest { r.username = &username return r } -func (r apiLoginUserRequest) Password(password string) apiLoginUserRequest { +func (r ApiLoginUserRequest) Password(password string) ApiLoginUserRequest { r.password = &password return r } /* -LoginUser Logs user into the system + * 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, + * @return apiLoginUserRequest + */ +func (a *UserApiService) LoginUserGetRequest(ctx _context.Context) ApiLoginUserRequest { + return ApiLoginUserRequest{ ctx: ctx, } } /* -Execute executes the request -@return string -*/ -func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { + * Execute executes the request + * @return string + */ +func (a *UserApiService) LoginUserExecute(r ApiLoginUserRequest) (string, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -532,7 +520,7 @@ func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { localVarReturnValue string ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LoginUser") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LoginUser") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -568,12 +556,12 @@ func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -592,7 +580,7 @@ func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -603,27 +591,25 @@ func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, nil } -type apiLogoutUserRequest struct { +type ApiLogoutUserRequest struct { ctx _context.Context - apiService *UserApiService } /* -LogoutUser Logs out current logged in user session + * 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, + * @return apiLogoutUserRequest + */ +func (a *UserApiService) LogoutUserGetRequest(ctx _context.Context) ApiLogoutUserRequest { + return ApiLogoutUserRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiLogoutUserRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *UserApiService) LogoutUserExecute(r ApiLogoutUserRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -632,7 +618,7 @@ func (r apiLogoutUserRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LogoutUser") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LogoutUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -660,12 +646,12 @@ func (r apiLogoutUserRequest) Execute() (*_nethttp.Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -686,36 +672,34 @@ func (r apiLogoutUserRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiUpdateUserRequest struct { +type ApiUpdateUserRequest struct { ctx _context.Context - apiService *UserApiService username string body *User } -func (r apiUpdateUserRequest) Body(body User) apiUpdateUserRequest { +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. + * 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, + * @return apiUpdateUserRequest + */ +func (a *UserApiService) UpdateUserGetRequest(ctx _context.Context, username string) ApiUpdateUserRequest { + return ApiUpdateUserRequest{ ctx: ctx, username: username, } } /* -Execute executes the request -*/ -func (r apiUpdateUserRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *UserApiService) UpdateUserExecute(r ApiUpdateUserRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -724,7 +708,7 @@ func (r apiUpdateUserRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.UpdateUser") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.UpdateUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -758,12 +742,12 @@ func (r apiUpdateUserRequest) Execute() (*_nethttp.Response, error) { } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } diff --git a/samples/client/petstore/go-experimental/pet_api_test.go b/samples/client/petstore/go-experimental/pet_api_test.go index 57afd2923c50..c10e6e6b2350 100644 --- a/samples/client/petstore/go-experimental/pet_api_test.go +++ b/samples/client/petstore/go-experimental/pet_api_test.go @@ -31,7 +31,8 @@ func TestAddPet(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute() + req := client.PetApi.AddPetGetRequest(context.Background()).Body(newPet) + r, err := client.PetApi.AddPetExecute(req) if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -42,7 +43,8 @@ func TestAddPet(t *testing.T) { } func TestFindPetsByStatusWithMissingParam(t *testing.T) { - _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute() + req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status(nil) + _, r, err := client.PetApi.FindPetsByStatusExecute(req) if err != nil { t.Fatalf("Error while testing TestFindPetsByStatusWithMissingParam: %v", err) @@ -57,7 +59,8 @@ func TestGetPetById(t *testing.T) { } func TestGetPetByIdWithInvalidID(t *testing.T) { - resp, r, err := client.PetApi.GetPetById(context.Background(), 999999999).Execute() + req := client.PetApi.GetPetByIdGetRequest(context.Background(), 999999999) + resp, r, err := client.PetApi.GetPetByIdExecute(req) if r != nil && r.StatusCode == 404 { assertedError, ok := err.(sw.GenericOpenAPIError) a := assert.New(t) @@ -74,7 +77,8 @@ func TestGetPetByIdWithInvalidID(t *testing.T) { } func TestUpdatePetWithForm(t *testing.T) { - r, err := client.PetApi.UpdatePetWithForm(context.Background(), 12830).Name("golang").Status("available").Execute() + req := client.PetApi.UpdatePetWithFormGetRequest(context.Background(), 12830).Name("golang").Status("available") + r, err := client.PetApi.UpdatePetWithFormExecute(req) if err != nil { t.Fatalf("Error while updating pet by id: %v", err) t.Log(r) @@ -89,7 +93,8 @@ func TestUpdatePetWithForm(t *testing.T) { func TestFindPetsByTag(t *testing.T) { var found = false - resp, r, err := client.PetApi.FindPetsByTags(context.Background()).Tags([]string{"tag2"}).Execute() + req := client.PetApi.FindPetsByTagsGetRequest(context.Background()).Tags([]string{"tag2"}) + resp, r, err := client.PetApi.FindPetsByTagsExecute(req) if err != nil { t.Fatalf("Error while getting pet by tag: %v", err) t.Log(r) @@ -118,7 +123,8 @@ func TestFindPetsByTag(t *testing.T) { } func TestFindPetsByStatus(t *testing.T) { - resp, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status([]string{"available"}).Execute() + req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status([]string{"available"}) + resp, r, err := client.PetApi.FindPetsByStatusExecute(req) if err != nil { t.Fatalf("Error while getting pet by id: %v", err) t.Log(r) @@ -144,7 +150,8 @@ func TestUploadFile(t *testing.T) { t.Fatalf("Error opening file: %v", err1) } - _, r, err := client.PetApi.UploadFile(context.Background(), 12830).AdditionalMetadata("golang").File(file).Execute() + req := client.PetApi.UploadFileGetRequest(context.Background(), 12830).AdditionalMetadata("golang").File(file) + _, r, err := client.PetApi.UploadFileExecute(req) if err != nil { t.Fatalf("Error while uploading file: %v", err) @@ -162,7 +169,8 @@ func TestUploadFileRequired(t *testing.T) { t.Fatalf("Error opening file: %v", err1) } - _, r, err := client.PetApi.UploadFileWithRequiredFile(context.Background(), 12830).RequiredFile(file).AdditionalMetadata("golang").Execute() + req := client.PetApi.UploadFileWithRequiredFileGetRequest(context.Background(), 12830).RequiredFile(file).AdditionalMetadata("golang") + _, r, err := client.PetApi.UploadFileWithRequiredFileExecute(req) if err != nil { t.Fatalf("Error while uploading file: %v", err) @@ -174,7 +182,8 @@ func TestUploadFileRequired(t *testing.T) { } func TestDeletePet(t *testing.T) { - r, err := client.PetApi.DeletePet(context.Background(), 12830).Execute() + req := client.PetApi.DeletePetGetRequest(context.Background(), 12830) + r, err := client.PetApi.DeletePetExecute(req) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -264,7 +273,8 @@ func waitOnFunctions(t *testing.T, errc chan error, n int) { } func deletePet(t *testing.T, id int64) { - r, err := client.PetApi.DeletePet(context.Background(), id).Execute() + req := client.PetApi.DeletePetGetRequest(context.Background(), id) + r, err := client.PetApi.DeletePetExecute(req) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -276,7 +286,8 @@ func deletePet(t *testing.T, id int64) { func isPetCorrect(t *testing.T, id int64, name string, status string) { assert := assert.New(t) - resp, r, err := client.PetApi.GetPetById(context.Background(), id).Execute() + req := client.PetApi.GetPetByIdGetRequest(context.Background(), id) + resp, r, err := client.PetApi.GetPetByIdExecute(req) if err != nil { t.Fatalf("Error while getting pet by id: %v", err) } else { diff --git a/samples/client/petstore/go-experimental/store_api_test.go b/samples/client/petstore/go-experimental/store_api_test.go index f9f55273eb92..93dc4fc1de29 100644 --- a/samples/client/petstore/go-experimental/store_api_test.go +++ b/samples/client/petstore/go-experimental/store_api_test.go @@ -18,7 +18,8 @@ func TestPlaceOrder(t *testing.T) { Status: sw.PtrString("placed"), Complete: sw.PtrBool(false)} - _, r, err := client.StoreApi.PlaceOrder(context.Background()).Body(newOrder).Execute() + req := client.StoreApi.PlaceOrderGetRequest(context.Background()).Body(newOrder) + _, r, err := client.StoreApi.PlaceOrderExecute(req) if err != nil { // Skip parsing time error due to error in Petstore Test Server diff --git a/samples/client/petstore/go-experimental/user_api_test.go b/samples/client/petstore/go-experimental/user_api_test.go index 361e77ac9aa7..d13f44fdd1c5 100644 --- a/samples/client/petstore/go-experimental/user_api_test.go +++ b/samples/client/petstore/go-experimental/user_api_test.go @@ -20,7 +20,8 @@ func TestCreateUser(t *testing.T) { Phone: sw.PtrString("5101112222"), UserStatus: sw.PtrInt32(1)} - apiResponse, err := client.UserApi.CreateUser(context.Background()).Body(newUser).Execute() + req := client.UserApi.CreateUserGetRequest(context.Background()).Body(newUser) + apiResponse, err := client.UserApi.CreateUserExecute(req) if err != nil { t.Fatalf("Error while adding user: %v", err) @@ -55,7 +56,8 @@ func TestCreateUsersWithArrayInput(t *testing.T) { }, } - apiResponse, err := client.UserApi.CreateUsersWithArrayInput(context.Background()).Body(newUsers).Execute() + req := client.UserApi.CreateUsersWithArrayInputGetRequest(context.Background()).Body(newUsers) + apiResponse, err := client.UserApi.CreateUsersWithArrayInputExecute(req) if err != nil { t.Fatalf("Error while adding users: %v", err) } @@ -81,7 +83,8 @@ func TestCreateUsersWithArrayInput(t *testing.T) { func TestGetUserByName(t *testing.T) { assert := assert.New(t) - resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher").Execute() + req := client.UserApi.GetUserByNameGetRequest(context.Background(), "gopher") + resp, apiResponse, err := client.UserApi.GetUserByNameExecute(req) if err != nil { t.Fatalf("Error while getting user by id: %v", err) } else { @@ -96,7 +99,8 @@ func TestGetUserByName(t *testing.T) { } func TestGetUserByNameWithInvalidID(t *testing.T) { - resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "999999999").Execute() + req := client.UserApi.GetUserByNameGetRequest(context.Background(), "999999999") + resp, apiResponse, err := client.UserApi.GetUserByNameExecute(req) if apiResponse != nil && apiResponse.StatusCode == 404 { return // This is a pass condition. API will return with a 404 error. } else if err != nil { @@ -123,7 +127,8 @@ func TestUpdateUser(t *testing.T) { Phone: sw.PtrString("5101112222"), UserStatus: sw.PtrInt32(1)} - apiResponse, err := client.UserApi.UpdateUser(context.Background(), "gopher").Body(newUser).Execute() + updateReq := client.UserApi.UpdateUserGetRequest(context.Background(), "gopher").Body(newUser) + apiResponse, err := client.UserApi.UpdateUserExecute(updateReq) if err != nil { t.Fatalf("Error while deleting user by id: %v", err) } @@ -132,7 +137,8 @@ func TestUpdateUser(t *testing.T) { } //verify changings are correct - resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher").Execute() + getReq := client.UserApi.GetUserByNameGetRequest(context.Background(), "gopher") + resp, apiResponse, err := client.UserApi.GetUserByNameExecute(getReq) if err != nil { t.Fatalf("Error while getting user by id: %v", err) } else { diff --git a/samples/openapi3/client/petstore/go-experimental/auth_test.go b/samples/openapi3/client/petstore/go-experimental/auth_test.go index aec544c2f26f..08f628707daa 100644 --- a/samples/openapi3/client/petstore/go-experimental/auth_test.go +++ b/samples/openapi3/client/petstore/go-experimental/auth_test.go @@ -41,7 +41,8 @@ func TestOAuth2(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - r, err := client.PetApi.AddPet(context.Background()).Pet(newPet).Execute() + addReq := client.PetApi.AddPetGetRequest(context.Background()).Pet(newPet) + r, err := client.PetApi.AddPetExecute(addReq) if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -50,7 +51,8 @@ func TestOAuth2(t *testing.T) { t.Log(r) } - r, err = client.PetApi.DeletePet(auth, 12992).Execute() + delReq := client.PetApi.DeletePetGetRequest(auth, 12992) + r, err = client.PetApi.DeletePetExecute(delReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -76,7 +78,8 @@ func TestBasicAuth(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - r, err := client.PetApi.AddPet(auth).Pet(newPet).Execute() + addReq := client.PetApi.AddPetGetRequest(auth).Pet(newPet) + r, err := client.PetApi.AddPetExecute(addReq) if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -85,7 +88,8 @@ func TestBasicAuth(t *testing.T) { t.Log(r) } - r, err = client.PetApi.DeletePet(auth, 12992).Execute() + delReq := client.PetApi.DeletePetGetRequest(auth, 12992) + r, err = client.PetApi.DeletePetExecute(delReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -106,7 +110,8 @@ func TestAccessToken(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - r, err := client.PetApi.AddPet(nil).Pet(newPet).Execute() + addReq := client.PetApi.AddPetGetRequest(nil).Pet(newPet) + r, err := client.PetApi.AddPetExecute(addReq) if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -115,7 +120,8 @@ func TestAccessToken(t *testing.T) { t.Log(r) } - r, err = client.PetApi.DeletePet(auth, 12992).Execute() + delReq := client.PetApi.DeletePetGetRequest(auth, 12992) + r, err = client.PetApi.DeletePetExecute(delReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -136,7 +142,8 @@ func TestAPIKeyNoPrefix(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - r, err := client.PetApi.AddPet(context.Background()).Pet(newPet).Execute() + addReq := client.PetApi.AddPetGetRequest(context.Background()).Pet(newPet) + r, err := client.PetApi.AddPetExecute(addReq) if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -145,7 +152,8 @@ func TestAPIKeyNoPrefix(t *testing.T) { t.Log(r) } - _, r, err = client.PetApi.GetPetById(auth, 12992).Execute() + getReq := client.PetApi.GetPetByIdGetRequest(auth, 12992) + _, r, err = client.PetApi.GetPetByIdExecute(getReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -155,7 +163,8 @@ func TestAPIKeyNoPrefix(t *testing.T) { t.Errorf("APIKey Authentication is missing") } - r, err = client.PetApi.DeletePet(auth, 12992).Execute() + delReq := client.PetApi.DeletePetGetRequest(auth, 12992) + r, err = client.PetApi.DeletePetExecute(delReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -171,7 +180,8 @@ func TestAPIKeyWithPrefix(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - r, err := client.PetApi.AddPet(nil).Pet(newPet).Execute() + addReq := client.PetApi.AddPetGetRequest(nil).Pet(newPet) + r, err := client.PetApi.AddPetExecute(addReq) if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -180,7 +190,8 @@ func TestAPIKeyWithPrefix(t *testing.T) { t.Log(r) } - _, r, err = client.PetApi.GetPetById(auth, 12992).Execute() + getReq := client.PetApi.GetPetByIdGetRequest(auth, 12992) + _, r, err = client.PetApi.GetPetByIdExecute(getReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -190,7 +201,8 @@ func TestAPIKeyWithPrefix(t *testing.T) { t.Errorf("APIKey Authentication is missing") } - r, err = client.PetApi.DeletePet(auth, 12992).Execute() + delReq := client.PetApi.DeletePetGetRequest(auth, 12992) + r, err = client.PetApi.DeletePetExecute(delReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -204,7 +216,8 @@ func TestDefaultHeader(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - r, err := client.PetApi.AddPet(context.Background()).Pet(newPet).Execute() + addReq := client.PetApi.AddPetGetRequest(context.Background()).Pet(newPet) + r, err := client.PetApi.AddPetExecute(addReq) if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -213,7 +226,8 @@ func TestDefaultHeader(t *testing.T) { t.Log(r) } - r, err = client.PetApi.DeletePet(context.Background(), 12992).Execute() + delReq := client.PetApi.DeletePetGetRequest(context.Background(), 12992) + r, err = client.PetApi.DeletePetExecute(delReq) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -228,7 +242,8 @@ func TestDefaultHeader(t *testing.T) { } func TestHostOverride(t *testing.T) { - _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute() + req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status(nil) + _, r, err := client.PetApi.FindPetsByStatusExecute(req) if err != nil { t.Fatalf("Error while finding pets by status: %v", err) @@ -240,7 +255,8 @@ func TestHostOverride(t *testing.T) { } func TestSchemeOverride(t *testing.T) { - _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute() + req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status(nil) + _, r, err := client.PetApi.FindPetsByStatusExecute(req) if err != nil { t.Fatalf("Error while finding pets by status: %v", err) diff --git a/samples/openapi3/client/petstore/go-experimental/fake_api_test.go b/samples/openapi3/client/petstore/go-experimental/fake_api_test.go index 97910bf3cf7b..01a67d6c44b9 100644 --- a/samples/openapi3/client/petstore/go-experimental/fake_api_test.go +++ b/samples/openapi3/client/petstore/go-experimental/fake_api_test.go @@ -17,7 +17,8 @@ func TestPutBodyWithFileSchema(t *testing.T) { File: &sw.File{SourceURI: sw.PtrString("https://example.com/image.png")}, Files: &[]sw.File{{SourceURI: sw.PtrString("https://example.com/image.png")}}} - r, err := client.FakeApi.TestBodyWithFileSchema(context.Background()).FileSchemaTestClass(schema).Execute() + req := client.FakeApi.TestBodyWithFileSchemaGetRequest(context.Background()).FileSchemaTestClass(schema) + r, err := client.FakeApi.TestBodyWithFileSchemaExecute(req) if err != nil { t.Fatalf("Error while adding pet: %v", err) diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_another_fake.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_another_fake.go index 4aed6e7c47c5..0f59910d9081 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_another_fake.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_another_fake.go @@ -24,34 +24,32 @@ var ( // AnotherFakeApiService AnotherFakeApi service type AnotherFakeApiService service -type apiCall123TestSpecialTagsRequest struct { +type ApiCall123TestSpecialTagsRequest struct { ctx _context.Context - apiService *AnotherFakeApiService client *Client } -func (r apiCall123TestSpecialTagsRequest) Client(client Client) apiCall123TestSpecialTagsRequest { +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 + * 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, + * @return apiCall123TestSpecialTagsRequest + */ +func (a *AnotherFakeApiService) Call123TestSpecialTagsGetRequest(ctx _context.Context) ApiCall123TestSpecialTagsRequest { + return ApiCall123TestSpecialTagsRequest{ ctx: ctx, } } /* -Execute executes the request -@return Client -*/ -func (r apiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, error) { + * Execute executes the request + * @return Client + */ +func (a *AnotherFakeApiService) Call123TestSpecialTagsExecute(r ApiCall123TestSpecialTagsRequest) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -61,7 +59,7 @@ func (r apiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, localVarReturnValue Client ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "AnotherFakeApiService.Call123TestSpecialTags") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AnotherFakeApiService.Call123TestSpecialTags") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -94,12 +92,12 @@ func (r apiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, } // body params localVarPostBody = r.client - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -118,7 +116,7 @@ func (r apiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, return localVarReturnValue, localVarHTTPResponse, newErr } - 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/samples/openapi3/client/petstore/go-experimental/go-petstore/api_default.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_default.go index 85cfd5a1b4e7..5b75530a2cfa 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_default.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_default.go @@ -24,28 +24,26 @@ var ( // DefaultApiService DefaultApi service type DefaultApiService service -type apiFooGetRequest struct { +type ApiFooGetRequest struct { ctx _context.Context - apiService *DefaultApiService } /* -FooGet Method for FooGet + * 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, + * @return apiFooGetRequest + */ +func (a *DefaultApiService) FooGetGetRequest(ctx _context.Context) ApiFooGetRequest { + return ApiFooGetRequest{ ctx: ctx, } } /* -Execute executes the request -@return InlineResponseDefault -*/ -func (r apiFooGetRequest) Execute() (InlineResponseDefault, *_nethttp.Response, error) { + * Execute executes the request + * @return InlineResponseDefault + */ +func (a *DefaultApiService) FooGetExecute(r ApiFooGetRequest) (InlineResponseDefault, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -55,7 +53,7 @@ func (r apiFooGetRequest) Execute() (InlineResponseDefault, *_nethttp.Response, localVarReturnValue InlineResponseDefault ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.FooGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.FooGet") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -83,12 +81,12 @@ func (r apiFooGetRequest) Execute() (InlineResponseDefault, *_nethttp.Response, if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -105,7 +103,7 @@ func (r apiFooGetRequest) Execute() (InlineResponseDefault, *_nethttp.Response, error: localVarHTTPResponse.Status, } var v InlineResponseDefault - 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 localVarReturnValue, localVarHTTPResponse, newErr @@ -114,7 +112,7 @@ func (r apiFooGetRequest) Execute() (InlineResponseDefault, *_nethttp.Response, return localVarReturnValue, localVarHTTPResponse, newErr } - 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/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake.go index 4743dcc145ae..e157bea4341c 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake.go @@ -27,28 +27,26 @@ var ( // FakeApiService FakeApi service type FakeApiService service -type apiFakeHealthGetRequest struct { +type ApiFakeHealthGetRequest struct { ctx _context.Context - apiService *FakeApiService } /* -FakeHealthGet Health check endpoint + * 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, + * @return apiFakeHealthGetRequest + */ +func (a *FakeApiService) FakeHealthGetGetRequest(ctx _context.Context) ApiFakeHealthGetRequest { + return ApiFakeHealthGetRequest{ ctx: ctx, } } /* -Execute executes the request -@return HealthCheckResult -*/ -func (r apiFakeHealthGetRequest) Execute() (HealthCheckResult, *_nethttp.Response, error) { + * Execute executes the request + * @return HealthCheckResult + */ +func (a *FakeApiService) FakeHealthGetExecute(r ApiFakeHealthGetRequest) (HealthCheckResult, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -58,7 +56,7 @@ func (r apiFakeHealthGetRequest) Execute() (HealthCheckResult, *_nethttp.Respons localVarReturnValue HealthCheckResult ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeHealthGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeHealthGet") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -86,12 +84,12 @@ func (r apiFakeHealthGetRequest) Execute() (HealthCheckResult, *_nethttp.Respons if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -110,7 +108,7 @@ func (r apiFakeHealthGetRequest) Execute() (HealthCheckResult, *_nethttp.Respons return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -121,34 +119,32 @@ func (r apiFakeHealthGetRequest) Execute() (HealthCheckResult, *_nethttp.Respons return localVarReturnValue, localVarHTTPResponse, nil } -type apiFakeOuterBooleanSerializeRequest struct { +type ApiFakeOuterBooleanSerializeRequest struct { ctx _context.Context - apiService *FakeApiService body *bool } -func (r apiFakeOuterBooleanSerializeRequest) Body(body bool) apiFakeOuterBooleanSerializeRequest { +func (r ApiFakeOuterBooleanSerializeRequest) Body(body bool) ApiFakeOuterBooleanSerializeRequest { r.body = &body return r } /* -FakeOuterBooleanSerialize Method for FakeOuterBooleanSerialize -Test serialization of outer boolean types + * 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, + * @return apiFakeOuterBooleanSerializeRequest + */ +func (a *FakeApiService) FakeOuterBooleanSerializeGetRequest(ctx _context.Context) ApiFakeOuterBooleanSerializeRequest { + return ApiFakeOuterBooleanSerializeRequest{ ctx: ctx, } } /* -Execute executes the request -@return bool -*/ -func (r apiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response, error) { + * Execute executes the request + * @return bool + */ +func (a *FakeApiService) FakeOuterBooleanSerializeExecute(r ApiFakeOuterBooleanSerializeRequest) (bool, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -158,7 +154,7 @@ func (r apiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response localVarReturnValue bool ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterBooleanSerialize") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterBooleanSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -188,12 +184,12 @@ func (r apiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -212,7 +208,7 @@ func (r apiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -223,34 +219,32 @@ func (r apiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response return localVarReturnValue, localVarHTTPResponse, nil } -type apiFakeOuterCompositeSerializeRequest struct { +type ApiFakeOuterCompositeSerializeRequest struct { ctx _context.Context - apiService *FakeApiService outerComposite *OuterComposite } -func (r apiFakeOuterCompositeSerializeRequest) OuterComposite(outerComposite OuterComposite) apiFakeOuterCompositeSerializeRequest { +func (r ApiFakeOuterCompositeSerializeRequest) OuterComposite(outerComposite OuterComposite) ApiFakeOuterCompositeSerializeRequest { r.outerComposite = &outerComposite return r } /* -FakeOuterCompositeSerialize Method for FakeOuterCompositeSerialize -Test serialization of object with outer number type + * 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, + * @return apiFakeOuterCompositeSerializeRequest + */ +func (a *FakeApiService) FakeOuterCompositeSerializeGetRequest(ctx _context.Context) ApiFakeOuterCompositeSerializeRequest { + return ApiFakeOuterCompositeSerializeRequest{ ctx: ctx, } } /* -Execute executes the request -@return OuterComposite -*/ -func (r apiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_nethttp.Response, error) { + * Execute executes the request + * @return OuterComposite + */ +func (a *FakeApiService) FakeOuterCompositeSerializeExecute(r ApiFakeOuterCompositeSerializeRequest) (OuterComposite, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -260,7 +254,7 @@ func (r apiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_neth localVarReturnValue OuterComposite ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterCompositeSerialize") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterCompositeSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -290,12 +284,12 @@ func (r apiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_neth } // body params localVarPostBody = r.outerComposite - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -314,7 +308,7 @@ func (r apiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_neth return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -325,34 +319,32 @@ func (r apiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_neth return localVarReturnValue, localVarHTTPResponse, nil } -type apiFakeOuterNumberSerializeRequest struct { +type ApiFakeOuterNumberSerializeRequest struct { ctx _context.Context - apiService *FakeApiService body *float32 } -func (r apiFakeOuterNumberSerializeRequest) Body(body float32) apiFakeOuterNumberSerializeRequest { +func (r ApiFakeOuterNumberSerializeRequest) Body(body float32) ApiFakeOuterNumberSerializeRequest { r.body = &body return r } /* -FakeOuterNumberSerialize Method for FakeOuterNumberSerialize -Test serialization of outer number types + * 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, + * @return apiFakeOuterNumberSerializeRequest + */ +func (a *FakeApiService) FakeOuterNumberSerializeGetRequest(ctx _context.Context) ApiFakeOuterNumberSerializeRequest { + return ApiFakeOuterNumberSerializeRequest{ ctx: ctx, } } /* -Execute executes the request -@return float32 -*/ -func (r apiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Response, error) { + * Execute executes the request + * @return float32 + */ +func (a *FakeApiService) FakeOuterNumberSerializeExecute(r ApiFakeOuterNumberSerializeRequest) (float32, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -362,7 +354,7 @@ func (r apiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Respon localVarReturnValue float32 ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterNumberSerialize") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterNumberSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -392,12 +384,12 @@ func (r apiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Respon } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -416,7 +408,7 @@ func (r apiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Respon return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -427,34 +419,32 @@ func (r apiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Respon return localVarReturnValue, localVarHTTPResponse, nil } -type apiFakeOuterStringSerializeRequest struct { +type ApiFakeOuterStringSerializeRequest struct { ctx _context.Context - apiService *FakeApiService body *string } -func (r apiFakeOuterStringSerializeRequest) Body(body string) apiFakeOuterStringSerializeRequest { +func (r ApiFakeOuterStringSerializeRequest) Body(body string) ApiFakeOuterStringSerializeRequest { r.body = &body return r } /* -FakeOuterStringSerialize Method for FakeOuterStringSerialize -Test serialization of outer string types + * 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, + * @return apiFakeOuterStringSerializeRequest + */ +func (a *FakeApiService) FakeOuterStringSerializeGetRequest(ctx _context.Context) ApiFakeOuterStringSerializeRequest { + return ApiFakeOuterStringSerializeRequest{ ctx: ctx, } } /* -Execute executes the request -@return string -*/ -func (r apiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Response, error) { + * Execute executes the request + * @return string + */ +func (a *FakeApiService) FakeOuterStringSerializeExecute(r ApiFakeOuterStringSerializeRequest) (string, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -464,7 +454,7 @@ func (r apiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Respons localVarReturnValue string ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterStringSerialize") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterStringSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -494,12 +484,12 @@ func (r apiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Respons } // body params localVarPostBody = r.body - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -518,7 +508,7 @@ func (r apiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Respons return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -529,33 +519,31 @@ func (r apiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Respons return localVarReturnValue, localVarHTTPResponse, nil } -type apiTestBodyWithFileSchemaRequest struct { +type ApiTestBodyWithFileSchemaRequest struct { ctx _context.Context - apiService *FakeApiService fileSchemaTestClass *FileSchemaTestClass } -func (r apiTestBodyWithFileSchemaRequest) FileSchemaTestClass(fileSchemaTestClass FileSchemaTestClass) apiTestBodyWithFileSchemaRequest { +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`. + * 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, + * @return apiTestBodyWithFileSchemaRequest + */ +func (a *FakeApiService) TestBodyWithFileSchemaGetRequest(ctx _context.Context) ApiTestBodyWithFileSchemaRequest { + return ApiTestBodyWithFileSchemaRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestBodyWithFileSchemaRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestBodyWithFileSchemaExecute(r ApiTestBodyWithFileSchemaRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -564,7 +552,7 @@ func (r apiTestBodyWithFileSchemaRequest) Execute() (*_nethttp.Response, error) localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithFileSchema") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithFileSchema") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -597,12 +585,12 @@ func (r apiTestBodyWithFileSchemaRequest) Execute() (*_nethttp.Response, error) } // body params localVarPostBody = r.fileSchemaTestClass - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -623,37 +611,35 @@ func (r apiTestBodyWithFileSchemaRequest) Execute() (*_nethttp.Response, error) return localVarHTTPResponse, nil } -type apiTestBodyWithQueryParamsRequest struct { +type ApiTestBodyWithQueryParamsRequest struct { ctx _context.Context - apiService *FakeApiService query *string user *User } -func (r apiTestBodyWithQueryParamsRequest) Query(query string) apiTestBodyWithQueryParamsRequest { +func (r ApiTestBodyWithQueryParamsRequest) Query(query string) ApiTestBodyWithQueryParamsRequest { r.query = &query return r } -func (r apiTestBodyWithQueryParamsRequest) User(user User) apiTestBodyWithQueryParamsRequest { +func (r ApiTestBodyWithQueryParamsRequest) User(user User) ApiTestBodyWithQueryParamsRequest { r.user = &user return r } /* -TestBodyWithQueryParams Method for TestBodyWithQueryParams + * 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, + * @return apiTestBodyWithQueryParamsRequest + */ +func (a *FakeApiService) TestBodyWithQueryParamsGetRequest(ctx _context.Context) ApiTestBodyWithQueryParamsRequest { + return ApiTestBodyWithQueryParamsRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestBodyWithQueryParamsRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestBodyWithQueryParamsExecute(r ApiTestBodyWithQueryParamsRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -662,7 +648,7 @@ func (r apiTestBodyWithQueryParamsRequest) Execute() (*_nethttp.Response, error) localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithQueryParams") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithQueryParams") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -699,12 +685,12 @@ func (r apiTestBodyWithQueryParamsRequest) Execute() (*_nethttp.Response, error) } // body params localVarPostBody = r.user - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -725,34 +711,32 @@ func (r apiTestBodyWithQueryParamsRequest) Execute() (*_nethttp.Response, error) return localVarHTTPResponse, nil } -type apiTestClientModelRequest struct { +type ApiTestClientModelRequest struct { ctx _context.Context - apiService *FakeApiService client *Client } -func (r apiTestClientModelRequest) Client(client Client) apiTestClientModelRequest { +func (r ApiTestClientModelRequest) Client(client Client) ApiTestClientModelRequest { r.client = &client return r } /* -TestClientModel To test \"client\" model -To test "client" model + * 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, + * @return apiTestClientModelRequest + */ +func (a *FakeApiService) TestClientModelGetRequest(ctx _context.Context) ApiTestClientModelRequest { + return ApiTestClientModelRequest{ ctx: ctx, } } /* -Execute executes the request -@return Client -*/ -func (r apiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) { + * Execute executes the request + * @return Client + */ +func (a *FakeApiService) TestClientModelExecute(r ApiTestClientModelRequest) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -762,7 +746,7 @@ func (r apiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) localVarReturnValue Client ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestClientModel") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestClientModel") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -795,12 +779,12 @@ func (r apiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) } // body params localVarPostBody = r.client - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -819,7 +803,7 @@ func (r apiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -830,9 +814,8 @@ func (r apiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) return localVarReturnValue, localVarHTTPResponse, nil } -type apiTestEndpointParametersRequest struct { +type ApiTestEndpointParametersRequest struct { ctx _context.Context - apiService *FakeApiService number *float32 double *float64 patternWithoutDelimiter *string @@ -849,83 +832,82 @@ type apiTestEndpointParametersRequest struct { callback *string } -func (r apiTestEndpointParametersRequest) Number(number float32) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Number(number float32) ApiTestEndpointParametersRequest { r.number = &number return r } -func (r apiTestEndpointParametersRequest) Double(double float64) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Double(double float64) ApiTestEndpointParametersRequest { r.double = &double return r } -func (r apiTestEndpointParametersRequest) PatternWithoutDelimiter(patternWithoutDelimiter string) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) PatternWithoutDelimiter(patternWithoutDelimiter string) ApiTestEndpointParametersRequest { r.patternWithoutDelimiter = &patternWithoutDelimiter return r } -func (r apiTestEndpointParametersRequest) Byte_(byte_ string) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Byte_(byte_ string) ApiTestEndpointParametersRequest { r.byte_ = &byte_ return r } -func (r apiTestEndpointParametersRequest) Integer(integer int32) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Integer(integer int32) ApiTestEndpointParametersRequest { r.integer = &integer return r } -func (r apiTestEndpointParametersRequest) Int32_(int32_ int32) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Int32_(int32_ int32) ApiTestEndpointParametersRequest { r.int32_ = &int32_ return r } -func (r apiTestEndpointParametersRequest) Int64_(int64_ int64) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Int64_(int64_ int64) ApiTestEndpointParametersRequest { r.int64_ = &int64_ return r } -func (r apiTestEndpointParametersRequest) Float(float float32) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Float(float float32) ApiTestEndpointParametersRequest { r.float = &float return r } -func (r apiTestEndpointParametersRequest) String_(string_ string) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) String_(string_ string) ApiTestEndpointParametersRequest { r.string_ = &string_ return r } -func (r apiTestEndpointParametersRequest) Binary(binary *os.File) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Binary(binary *os.File) ApiTestEndpointParametersRequest { r.binary = &binary return r } -func (r apiTestEndpointParametersRequest) Date(date string) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Date(date string) ApiTestEndpointParametersRequest { r.date = &date return r } -func (r apiTestEndpointParametersRequest) DateTime(dateTime time.Time) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) DateTime(dateTime time.Time) ApiTestEndpointParametersRequest { r.dateTime = &dateTime return r } -func (r apiTestEndpointParametersRequest) Password(password string) apiTestEndpointParametersRequest { +func (r ApiTestEndpointParametersRequest) Password(password string) ApiTestEndpointParametersRequest { r.password = &password return r } -func (r apiTestEndpointParametersRequest) Callback(callback string) apiTestEndpointParametersRequest { +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 + * 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, + * @return apiTestEndpointParametersRequest + */ +func (a *FakeApiService) TestEndpointParametersGetRequest(ctx _context.Context) ApiTestEndpointParametersRequest { + return ApiTestEndpointParametersRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestEndpointParametersRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestEndpointParametersExecute(r ApiTestEndpointParametersRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -934,7 +916,7 @@ func (r apiTestEndpointParametersRequest) Execute() (*_nethttp.Response, error) localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEndpointParameters") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEndpointParameters") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1028,12 +1010,12 @@ func (r apiTestEndpointParametersRequest) Execute() (*_nethttp.Response, error) 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) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1054,9 +1036,8 @@ func (r apiTestEndpointParametersRequest) Execute() (*_nethttp.Response, error) return localVarHTTPResponse, nil } -type apiTestEnumParametersRequest struct { +type ApiTestEnumParametersRequest struct { ctx _context.Context - apiService *FakeApiService enumHeaderStringArray *[]string enumHeaderString *string enumQueryStringArray *[]string @@ -1067,55 +1048,54 @@ type apiTestEnumParametersRequest struct { enumFormString *string } -func (r apiTestEnumParametersRequest) EnumHeaderStringArray(enumHeaderStringArray []string) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumHeaderStringArray(enumHeaderStringArray []string) ApiTestEnumParametersRequest { r.enumHeaderStringArray = &enumHeaderStringArray return r } -func (r apiTestEnumParametersRequest) EnumHeaderString(enumHeaderString string) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumHeaderString(enumHeaderString string) ApiTestEnumParametersRequest { r.enumHeaderString = &enumHeaderString return r } -func (r apiTestEnumParametersRequest) EnumQueryStringArray(enumQueryStringArray []string) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumQueryStringArray(enumQueryStringArray []string) ApiTestEnumParametersRequest { r.enumQueryStringArray = &enumQueryStringArray return r } -func (r apiTestEnumParametersRequest) EnumQueryString(enumQueryString string) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumQueryString(enumQueryString string) ApiTestEnumParametersRequest { r.enumQueryString = &enumQueryString return r } -func (r apiTestEnumParametersRequest) EnumQueryInteger(enumQueryInteger int32) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumQueryInteger(enumQueryInteger int32) ApiTestEnumParametersRequest { r.enumQueryInteger = &enumQueryInteger return r } -func (r apiTestEnumParametersRequest) EnumQueryDouble(enumQueryDouble float64) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumQueryDouble(enumQueryDouble float64) ApiTestEnumParametersRequest { r.enumQueryDouble = &enumQueryDouble return r } -func (r apiTestEnumParametersRequest) EnumFormStringArray(enumFormStringArray []string) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumFormStringArray(enumFormStringArray []string) ApiTestEnumParametersRequest { r.enumFormStringArray = &enumFormStringArray return r } -func (r apiTestEnumParametersRequest) EnumFormString(enumFormString string) apiTestEnumParametersRequest { +func (r ApiTestEnumParametersRequest) EnumFormString(enumFormString string) ApiTestEnumParametersRequest { r.enumFormString = &enumFormString return r } /* -TestEnumParameters To test enum parameters -To test enum parameters + * 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, + * @return apiTestEnumParametersRequest + */ +func (a *FakeApiService) TestEnumParametersGetRequest(ctx _context.Context) ApiTestEnumParametersRequest { + return ApiTestEnumParametersRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestEnumParametersRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestEnumParametersExecute(r ApiTestEnumParametersRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1124,7 +1104,7 @@ func (r apiTestEnumParametersRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEnumParameters") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEnumParameters") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1184,12 +1164,12 @@ func (r apiTestEnumParametersRequest) Execute() (*_nethttp.Response, error) { 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) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1210,9 +1190,8 @@ func (r apiTestEnumParametersRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiTestGroupParametersRequest struct { +type ApiTestGroupParametersRequest struct { ctx _context.Context - apiService *FakeApiService requiredStringGroup *int32 requiredBooleanGroup *bool requiredInt64Group *int64 @@ -1221,47 +1200,46 @@ type apiTestGroupParametersRequest struct { int64Group *int64 } -func (r apiTestGroupParametersRequest) RequiredStringGroup(requiredStringGroup int32) apiTestGroupParametersRequest { +func (r ApiTestGroupParametersRequest) RequiredStringGroup(requiredStringGroup int32) ApiTestGroupParametersRequest { r.requiredStringGroup = &requiredStringGroup return r } -func (r apiTestGroupParametersRequest) RequiredBooleanGroup(requiredBooleanGroup bool) apiTestGroupParametersRequest { +func (r ApiTestGroupParametersRequest) RequiredBooleanGroup(requiredBooleanGroup bool) ApiTestGroupParametersRequest { r.requiredBooleanGroup = &requiredBooleanGroup return r } -func (r apiTestGroupParametersRequest) RequiredInt64Group(requiredInt64Group int64) apiTestGroupParametersRequest { +func (r ApiTestGroupParametersRequest) RequiredInt64Group(requiredInt64Group int64) ApiTestGroupParametersRequest { r.requiredInt64Group = &requiredInt64Group return r } -func (r apiTestGroupParametersRequest) StringGroup(stringGroup int32) apiTestGroupParametersRequest { +func (r ApiTestGroupParametersRequest) StringGroup(stringGroup int32) ApiTestGroupParametersRequest { r.stringGroup = &stringGroup return r } -func (r apiTestGroupParametersRequest) BooleanGroup(booleanGroup bool) apiTestGroupParametersRequest { +func (r ApiTestGroupParametersRequest) BooleanGroup(booleanGroup bool) ApiTestGroupParametersRequest { r.booleanGroup = &booleanGroup return r } -func (r apiTestGroupParametersRequest) Int64Group(int64Group int64) apiTestGroupParametersRequest { +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) + * 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, + * @return apiTestGroupParametersRequest + */ +func (a *FakeApiService) TestGroupParametersGetRequest(ctx _context.Context) ApiTestGroupParametersRequest { + return ApiTestGroupParametersRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestGroupParametersRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestGroupParametersExecute(r ApiTestGroupParametersRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -1270,7 +1248,7 @@ func (r apiTestGroupParametersRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestGroupParameters") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestGroupParameters") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1319,12 +1297,12 @@ func (r apiTestGroupParametersRequest) Execute() (*_nethttp.Response, error) { 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) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1345,32 +1323,30 @@ func (r apiTestGroupParametersRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiTestInlineAdditionalPropertiesRequest struct { +type ApiTestInlineAdditionalPropertiesRequest struct { ctx _context.Context - apiService *FakeApiService requestBody *map[string]string } -func (r apiTestInlineAdditionalPropertiesRequest) RequestBody(requestBody map[string]string) apiTestInlineAdditionalPropertiesRequest { +func (r ApiTestInlineAdditionalPropertiesRequest) RequestBody(requestBody map[string]string) ApiTestInlineAdditionalPropertiesRequest { r.requestBody = &requestBody return r } /* -TestInlineAdditionalProperties test inline additionalProperties + * 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, + * @return apiTestInlineAdditionalPropertiesRequest + */ +func (a *FakeApiService) TestInlineAdditionalPropertiesGetRequest(ctx _context.Context) ApiTestInlineAdditionalPropertiesRequest { + return ApiTestInlineAdditionalPropertiesRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestInlineAdditionalPropertiesRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestInlineAdditionalPropertiesExecute(r ApiTestInlineAdditionalPropertiesRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1379,7 +1355,7 @@ func (r apiTestInlineAdditionalPropertiesRequest) Execute() (*_nethttp.Response, localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestInlineAdditionalProperties") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestInlineAdditionalProperties") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1412,12 +1388,12 @@ func (r apiTestInlineAdditionalPropertiesRequest) Execute() (*_nethttp.Response, } // body params localVarPostBody = r.requestBody - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1438,37 +1414,35 @@ func (r apiTestInlineAdditionalPropertiesRequest) Execute() (*_nethttp.Response, return localVarHTTPResponse, nil } -type apiTestJsonFormDataRequest struct { +type ApiTestJsonFormDataRequest struct { ctx _context.Context - apiService *FakeApiService param *string param2 *string } -func (r apiTestJsonFormDataRequest) Param(param string) apiTestJsonFormDataRequest { +func (r ApiTestJsonFormDataRequest) Param(param string) ApiTestJsonFormDataRequest { r.param = ¶m return r } -func (r apiTestJsonFormDataRequest) Param2(param2 string) apiTestJsonFormDataRequest { +func (r ApiTestJsonFormDataRequest) Param2(param2 string) ApiTestJsonFormDataRequest { r.param2 = ¶m2 return r } /* -TestJsonFormData test json serialization of form data + * 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, + * @return apiTestJsonFormDataRequest + */ +func (a *FakeApiService) TestJsonFormDataGetRequest(ctx _context.Context) ApiTestJsonFormDataRequest { + return ApiTestJsonFormDataRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestJsonFormDataRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestJsonFormDataExecute(r ApiTestJsonFormDataRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1477,7 +1451,7 @@ func (r apiTestJsonFormDataRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestJsonFormData") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestJsonFormData") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1513,12 +1487,12 @@ func (r apiTestJsonFormDataRequest) Execute() (*_nethttp.Response, error) { } 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) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1539,9 +1513,8 @@ func (r apiTestJsonFormDataRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiTestQueryParameterCollectionFormatRequest struct { +type ApiTestQueryParameterCollectionFormatRequest struct { ctx _context.Context - apiService *FakeApiService pipe *[]string ioutil *[]string http *[]string @@ -1549,43 +1522,42 @@ type apiTestQueryParameterCollectionFormatRequest struct { context *[]string } -func (r apiTestQueryParameterCollectionFormatRequest) Pipe(pipe []string) apiTestQueryParameterCollectionFormatRequest { +func (r ApiTestQueryParameterCollectionFormatRequest) Pipe(pipe []string) ApiTestQueryParameterCollectionFormatRequest { r.pipe = &pipe return r } -func (r apiTestQueryParameterCollectionFormatRequest) Ioutil(ioutil []string) apiTestQueryParameterCollectionFormatRequest { +func (r ApiTestQueryParameterCollectionFormatRequest) Ioutil(ioutil []string) ApiTestQueryParameterCollectionFormatRequest { r.ioutil = &ioutil return r } -func (r apiTestQueryParameterCollectionFormatRequest) Http(http []string) apiTestQueryParameterCollectionFormatRequest { +func (r ApiTestQueryParameterCollectionFormatRequest) Http(http []string) ApiTestQueryParameterCollectionFormatRequest { r.http = &http return r } -func (r apiTestQueryParameterCollectionFormatRequest) Url(url []string) apiTestQueryParameterCollectionFormatRequest { +func (r ApiTestQueryParameterCollectionFormatRequest) Url(url []string) ApiTestQueryParameterCollectionFormatRequest { r.url = &url return r } -func (r apiTestQueryParameterCollectionFormatRequest) Context(context []string) apiTestQueryParameterCollectionFormatRequest { +func (r ApiTestQueryParameterCollectionFormatRequest) Context(context []string) ApiTestQueryParameterCollectionFormatRequest { r.context = &context return r } /* -TestQueryParameterCollectionFormat Method for TestQueryParameterCollectionFormat -To test the collection format in query parameters + * 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, + * @return apiTestQueryParameterCollectionFormatRequest + */ +func (a *FakeApiService) TestQueryParameterCollectionFormatGetRequest(ctx _context.Context) ApiTestQueryParameterCollectionFormatRequest { + return ApiTestQueryParameterCollectionFormatRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiTestQueryParameterCollectionFormatRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *FakeApiService) TestQueryParameterCollectionFormatExecute(r ApiTestQueryParameterCollectionFormatRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1594,7 +1566,7 @@ func (r apiTestQueryParameterCollectionFormatRequest) Execute() (*_nethttp.Respo localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestQueryParameterCollectionFormat") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestQueryParameterCollectionFormat") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1662,12 +1634,12 @@ func (r apiTestQueryParameterCollectionFormatRequest) Execute() (*_nethttp.Respo if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go index 4456d5af6e73..1b2095f678c2 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go @@ -24,34 +24,32 @@ var ( // FakeClassnameTags123ApiService FakeClassnameTags123Api service type FakeClassnameTags123ApiService service -type apiTestClassnameRequest struct { +type ApiTestClassnameRequest struct { ctx _context.Context - apiService *FakeClassnameTags123ApiService client *Client } -func (r apiTestClassnameRequest) Client(client Client) apiTestClassnameRequest { +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 + * 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, + * @return apiTestClassnameRequest + */ +func (a *FakeClassnameTags123ApiService) TestClassnameGetRequest(ctx _context.Context) ApiTestClassnameRequest { + return ApiTestClassnameRequest{ ctx: ctx, } } /* -Execute executes the request -@return Client -*/ -func (r apiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) { + * Execute executes the request + * @return Client + */ +func (a *FakeClassnameTags123ApiService) TestClassnameExecute(r ApiTestClassnameRequest) (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -61,7 +59,7 @@ func (r apiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) { localVarReturnValue Client ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeClassnameTags123ApiService.TestClassname") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeClassnameTags123ApiService.TestClassname") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -108,12 +106,12 @@ func (r apiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) { } } } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -132,7 +130,7 @@ func (r apiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, newErr } - 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/samples/openapi3/client/petstore/go-experimental/go-petstore/api_pet.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_pet.go index 31bdd2c3cf87..4379495c0bc3 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_pet.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_pet.go @@ -26,32 +26,30 @@ var ( // PetApiService PetApi service type PetApiService service -type apiAddPetRequest struct { +type ApiAddPetRequest struct { ctx _context.Context - apiService *PetApiService pet *Pet } -func (r apiAddPetRequest) Pet(pet Pet) apiAddPetRequest { +func (r ApiAddPetRequest) Pet(pet Pet) ApiAddPetRequest { r.pet = &pet return r } /* -AddPet Add a new pet to the store + * 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, + * @return apiAddPetRequest + */ +func (a *PetApiService) AddPetGetRequest(ctx _context.Context) ApiAddPetRequest { + return ApiAddPetRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiAddPetRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *PetApiService) AddPetExecute(r ApiAddPetRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -60,7 +58,7 @@ func (r apiAddPetRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.AddPet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.AddPet") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -93,12 +91,12 @@ func (r apiAddPetRequest) Execute() (*_nethttp.Response, error) { } // body params localVarPostBody = r.pet - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -119,35 +117,33 @@ func (r apiAddPetRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiDeletePetRequest struct { +type ApiDeletePetRequest struct { ctx _context.Context - apiService *PetApiService petId int64 apiKey *string } -func (r apiDeletePetRequest) ApiKey(apiKey string) apiDeletePetRequest { +func (r ApiDeletePetRequest) ApiKey(apiKey string) ApiDeletePetRequest { r.apiKey = &apiKey return r } /* -DeletePet Deletes a pet + * 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, + * @return apiDeletePetRequest + */ +func (a *PetApiService) DeletePetGetRequest(ctx _context.Context, petId int64) ApiDeletePetRequest { + return ApiDeletePetRequest{ ctx: ctx, petId: petId, } } /* -Execute executes the request -*/ -func (r apiDeletePetRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *PetApiService) DeletePetExecute(r ApiDeletePetRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -156,7 +152,7 @@ func (r apiDeletePetRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.DeletePet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.DeletePet") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -188,12 +184,12 @@ func (r apiDeletePetRequest) Execute() (*_nethttp.Response, error) { 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) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -214,34 +210,32 @@ func (r apiDeletePetRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiFindPetsByStatusRequest struct { +type ApiFindPetsByStatusRequest struct { ctx _context.Context - apiService *PetApiService status *[]string } -func (r apiFindPetsByStatusRequest) Status(status []string) apiFindPetsByStatusRequest { +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 + * 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, + * @return apiFindPetsByStatusRequest + */ +func (a *PetApiService) FindPetsByStatusGetRequest(ctx _context.Context) ApiFindPetsByStatusRequest { + return ApiFindPetsByStatusRequest{ ctx: ctx, } } /* -Execute executes the request -@return []Pet -*/ -func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) { + * Execute executes the request + * @return []Pet + */ +func (a *PetApiService) FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([]Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -251,7 +245,7 @@ func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) localVarReturnValue []Pet ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByStatus") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByStatus") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -283,12 +277,12 @@ func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -307,7 +301,7 @@ func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -318,34 +312,32 @@ func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) return localVarReturnValue, localVarHTTPResponse, nil } -type apiFindPetsByTagsRequest struct { +type ApiFindPetsByTagsRequest struct { ctx _context.Context - apiService *PetApiService tags *[]string } -func (r apiFindPetsByTagsRequest) Tags(tags []string) apiFindPetsByTagsRequest { +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. + * 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, + * @return apiFindPetsByTagsRequest + */ +func (a *PetApiService) FindPetsByTagsGetRequest(ctx _context.Context) ApiFindPetsByTagsRequest { + return ApiFindPetsByTagsRequest{ ctx: ctx, } } /* -Execute executes the request -@return []Pet -*/ -func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { + * Execute executes the request + * @return []Pet + */ +func (a *PetApiService) FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -355,7 +347,7 @@ func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { localVarReturnValue []Pet ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByTags") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByTags") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -387,12 +379,12 @@ func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -411,7 +403,7 @@ func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -422,32 +414,30 @@ func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, nil } -type apiGetPetByIdRequest struct { +type ApiGetPetByIdRequest struct { ctx _context.Context - apiService *PetApiService petId int64 } /* -GetPetById Find pet by ID -Returns a single pet + * 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, + * @return apiGetPetByIdRequest + */ +func (a *PetApiService) GetPetByIdGetRequest(ctx _context.Context, petId int64) ApiGetPetByIdRequest { + return ApiGetPetByIdRequest{ ctx: ctx, petId: petId, } } /* -Execute executes the request -@return Pet -*/ -func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { + * Execute executes the request + * @return Pet + */ +func (a *PetApiService) GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -457,7 +447,7 @@ func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { localVarReturnValue Pet ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.GetPetById") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.GetPetById") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -500,12 +490,12 @@ func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { } } } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -524,7 +514,7 @@ func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -535,32 +525,30 @@ func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, nil } -type apiUpdatePetRequest struct { +type ApiUpdatePetRequest struct { ctx _context.Context - apiService *PetApiService pet *Pet } -func (r apiUpdatePetRequest) Pet(pet Pet) apiUpdatePetRequest { +func (r ApiUpdatePetRequest) Pet(pet Pet) ApiUpdatePetRequest { r.pet = &pet return r } /* -UpdatePet Update an existing pet + * 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, + * @return apiUpdatePetRequest + */ +func (a *PetApiService) UpdatePetGetRequest(ctx _context.Context) ApiUpdatePetRequest { + return ApiUpdatePetRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiUpdatePetRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *PetApiService) UpdatePetExecute(r ApiUpdatePetRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -569,7 +557,7 @@ func (r apiUpdatePetRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePet") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -602,12 +590,12 @@ func (r apiUpdatePetRequest) Execute() (*_nethttp.Response, error) { } // body params localVarPostBody = r.pet - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -628,40 +616,38 @@ func (r apiUpdatePetRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiUpdatePetWithFormRequest struct { +type ApiUpdatePetWithFormRequest struct { ctx _context.Context - apiService *PetApiService petId int64 name *string status *string } -func (r apiUpdatePetWithFormRequest) Name(name string) apiUpdatePetWithFormRequest { +func (r ApiUpdatePetWithFormRequest) Name(name string) ApiUpdatePetWithFormRequest { r.name = &name return r } -func (r apiUpdatePetWithFormRequest) Status(status string) apiUpdatePetWithFormRequest { +func (r ApiUpdatePetWithFormRequest) Status(status string) ApiUpdatePetWithFormRequest { r.status = &status return r } /* -UpdatePetWithForm Updates a pet in the store with form data + * 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, + * @return apiUpdatePetWithFormRequest + */ +func (a *PetApiService) UpdatePetWithFormGetRequest(ctx _context.Context, petId int64) ApiUpdatePetWithFormRequest { + return ApiUpdatePetWithFormRequest{ ctx: ctx, petId: petId, } } /* -Execute executes the request -*/ -func (r apiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *PetApiService) UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -670,7 +656,7 @@ func (r apiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePetWithForm") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePetWithForm") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -705,12 +691,12 @@ func (r apiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) { 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) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -731,41 +717,39 @@ func (r apiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiUploadFileRequest struct { +type ApiUploadFileRequest struct { ctx _context.Context - apiService *PetApiService petId int64 additionalMetadata *string file **os.File } -func (r apiUploadFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileRequest { +func (r ApiUploadFileRequest) AdditionalMetadata(additionalMetadata string) ApiUploadFileRequest { r.additionalMetadata = &additionalMetadata return r } -func (r apiUploadFileRequest) File(file *os.File) apiUploadFileRequest { +func (r ApiUploadFileRequest) File(file *os.File) ApiUploadFileRequest { r.file = &file return r } /* -UploadFile uploads an image + * 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, + * @return apiUploadFileRequest + */ +func (a *PetApiService) UploadFileGetRequest(ctx _context.Context, petId int64) ApiUploadFileRequest { + return ApiUploadFileRequest{ ctx: ctx, petId: petId, } } /* -Execute executes the request -@return ApiResponse -*/ -func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { + * Execute executes the request + * @return ApiResponse + */ +func (a *PetApiService) UploadFileExecute(r ApiUploadFileRequest) (ApiResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -775,7 +759,7 @@ func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) localVarReturnValue ApiResponse ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFile") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFile") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -818,12 +802,12 @@ func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) localVarFileName = localVarFile.Name() localVarFile.Close() } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -842,7 +826,7 @@ func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -853,41 +837,39 @@ func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) return localVarReturnValue, localVarHTTPResponse, nil } -type apiUploadFileWithRequiredFileRequest struct { +type ApiUploadFileWithRequiredFileRequest struct { ctx _context.Context - apiService *PetApiService petId int64 requiredFile **os.File additionalMetadata *string } -func (r apiUploadFileWithRequiredFileRequest) RequiredFile(requiredFile *os.File) apiUploadFileWithRequiredFileRequest { +func (r ApiUploadFileWithRequiredFileRequest) RequiredFile(requiredFile *os.File) ApiUploadFileWithRequiredFileRequest { r.requiredFile = &requiredFile return r } -func (r apiUploadFileWithRequiredFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileWithRequiredFileRequest { +func (r ApiUploadFileWithRequiredFileRequest) AdditionalMetadata(additionalMetadata string) ApiUploadFileWithRequiredFileRequest { r.additionalMetadata = &additionalMetadata return r } /* -UploadFileWithRequiredFile uploads an image (required) + * 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, + * @return apiUploadFileWithRequiredFileRequest + */ +func (a *PetApiService) UploadFileWithRequiredFileGetRequest(ctx _context.Context, petId int64) ApiUploadFileWithRequiredFileRequest { + return ApiUploadFileWithRequiredFileRequest{ ctx: ctx, petId: petId, } } /* -Execute executes the request -@return ApiResponse -*/ -func (r apiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { + * Execute executes the request + * @return ApiResponse + */ +func (a *PetApiService) UploadFileWithRequiredFileExecute(r ApiUploadFileWithRequiredFileRequest) (ApiResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -897,7 +879,7 @@ func (r apiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp. localVarReturnValue ApiResponse ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFileWithRequiredFile") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFileWithRequiredFile") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -940,12 +922,12 @@ func (r apiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp. localVarFileName = localVarFile.Name() localVarFile.Close() } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -964,7 +946,7 @@ func (r apiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp. return localVarReturnValue, localVarHTTPResponse, newErr } - 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/samples/openapi3/client/petstore/go-experimental/go-petstore/api_store.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_store.go index 6d48bf45defb..897d996135ec 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_store.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_store.go @@ -25,31 +25,29 @@ var ( // StoreApiService StoreApi service type StoreApiService service -type apiDeleteOrderRequest struct { +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 + * 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, + * @return apiDeleteOrderRequest + */ +func (a *StoreApiService) DeleteOrderGetRequest(ctx _context.Context, orderId string) ApiDeleteOrderRequest { + return ApiDeleteOrderRequest{ ctx: ctx, orderId: orderId, } } /* -Execute executes the request -*/ -func (r apiDeleteOrderRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *StoreApiService) DeleteOrderExecute(r ApiDeleteOrderRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -58,7 +56,7 @@ func (r apiDeleteOrderRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.DeleteOrder") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.DeleteOrder") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -87,12 +85,12 @@ func (r apiDeleteOrderRequest) Execute() (*_nethttp.Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -113,29 +111,27 @@ func (r apiDeleteOrderRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiGetInventoryRequest struct { +type ApiGetInventoryRequest struct { ctx _context.Context - apiService *StoreApiService } /* -GetInventory Returns pet inventories by status -Returns a map of status codes to quantities + * 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, + * @return apiGetInventoryRequest + */ +func (a *StoreApiService) GetInventoryGetRequest(ctx _context.Context) ApiGetInventoryRequest { + return ApiGetInventoryRequest{ ctx: ctx, } } /* -Execute executes the request -@return map[string]int32 -*/ -func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, error) { + * Execute executes the request + * @return map[string]int32 + */ +func (a *StoreApiService) GetInventoryExecute(r ApiGetInventoryRequest) (map[string]int32, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -145,7 +141,7 @@ func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, localVarReturnValue map[string]int32 ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetInventory") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetInventory") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -187,12 +183,12 @@ func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, } } } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -211,7 +207,7 @@ func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -222,32 +218,30 @@ func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, return localVarReturnValue, localVarHTTPResponse, nil } -type apiGetOrderByIdRequest struct { +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 + * 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, + * @return apiGetOrderByIdRequest + */ +func (a *StoreApiService) GetOrderByIdGetRequest(ctx _context.Context, orderId int64) ApiGetOrderByIdRequest { + return ApiGetOrderByIdRequest{ ctx: ctx, orderId: orderId, } } /* -Execute executes the request -@return Order -*/ -func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { + * Execute executes the request + * @return Order + */ +func (a *StoreApiService) GetOrderByIdExecute(r ApiGetOrderByIdRequest) (Order, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -257,7 +251,7 @@ func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { localVarReturnValue Order ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetOrderById") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetOrderById") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -292,12 +286,12 @@ func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -316,7 +310,7 @@ func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -327,33 +321,31 @@ func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, nil } -type apiPlaceOrderRequest struct { +type ApiPlaceOrderRequest struct { ctx _context.Context - apiService *StoreApiService order *Order } -func (r apiPlaceOrderRequest) Order(order Order) apiPlaceOrderRequest { +func (r ApiPlaceOrderRequest) Order(order Order) ApiPlaceOrderRequest { r.order = &order return r } /* -PlaceOrder Place an order for a pet + * 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, + * @return apiPlaceOrderRequest + */ +func (a *StoreApiService) PlaceOrderGetRequest(ctx _context.Context) ApiPlaceOrderRequest { + return ApiPlaceOrderRequest{ ctx: ctx, } } /* -Execute executes the request -@return Order -*/ -func (r apiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) { + * Execute executes the request + * @return Order + */ +func (a *StoreApiService) PlaceOrderExecute(r ApiPlaceOrderRequest) (Order, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -363,7 +355,7 @@ func (r apiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) { localVarReturnValue Order ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.PlaceOrder") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.PlaceOrder") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -396,12 +388,12 @@ func (r apiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) { } // body params localVarPostBody = r.order - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -420,7 +412,7 @@ func (r apiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, newErr } - 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/samples/openapi3/client/petstore/go-experimental/go-petstore/api_user.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_user.go index 4a8a6ac10c53..c7c32835e4d9 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_user.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_user.go @@ -25,33 +25,31 @@ var ( // UserApiService UserApi service type UserApiService service -type apiCreateUserRequest struct { +type ApiCreateUserRequest struct { ctx _context.Context - apiService *UserApiService user *User } -func (r apiCreateUserRequest) User(user User) apiCreateUserRequest { +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. + * 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, + * @return apiCreateUserRequest + */ +func (a *UserApiService) CreateUserGetRequest(ctx _context.Context) ApiCreateUserRequest { + return ApiCreateUserRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiCreateUserRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *UserApiService) CreateUserExecute(r ApiCreateUserRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -60,7 +58,7 @@ func (r apiCreateUserRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUser") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -93,12 +91,12 @@ func (r apiCreateUserRequest) Execute() (*_nethttp.Response, error) { } // body params localVarPostBody = r.user - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -119,32 +117,30 @@ func (r apiCreateUserRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiCreateUsersWithArrayInputRequest struct { +type ApiCreateUsersWithArrayInputRequest struct { ctx _context.Context - apiService *UserApiService user *[]User } -func (r apiCreateUsersWithArrayInputRequest) User(user []User) apiCreateUsersWithArrayInputRequest { +func (r ApiCreateUsersWithArrayInputRequest) User(user []User) ApiCreateUsersWithArrayInputRequest { r.user = &user return r } /* -CreateUsersWithArrayInput Creates list of users with given input array + * 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, + * @return apiCreateUsersWithArrayInputRequest + */ +func (a *UserApiService) CreateUsersWithArrayInputGetRequest(ctx _context.Context) ApiCreateUsersWithArrayInputRequest { + return ApiCreateUsersWithArrayInputRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *UserApiService) CreateUsersWithArrayInputExecute(r ApiCreateUsersWithArrayInputRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -153,7 +149,7 @@ func (r apiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, erro localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithArrayInput") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithArrayInput") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -186,12 +182,12 @@ func (r apiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, erro } // body params localVarPostBody = r.user - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -212,32 +208,30 @@ func (r apiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, erro return localVarHTTPResponse, nil } -type apiCreateUsersWithListInputRequest struct { +type ApiCreateUsersWithListInputRequest struct { ctx _context.Context - apiService *UserApiService user *[]User } -func (r apiCreateUsersWithListInputRequest) User(user []User) apiCreateUsersWithListInputRequest { +func (r ApiCreateUsersWithListInputRequest) User(user []User) ApiCreateUsersWithListInputRequest { r.user = &user return r } /* -CreateUsersWithListInput Creates list of users with given input array + * 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, + * @return apiCreateUsersWithListInputRequest + */ +func (a *UserApiService) CreateUsersWithListInputGetRequest(ctx _context.Context) ApiCreateUsersWithListInputRequest { + return ApiCreateUsersWithListInputRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *UserApiService) CreateUsersWithListInputExecute(r ApiCreateUsersWithListInputRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -246,7 +240,7 @@ func (r apiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithListInput") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithListInput") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -279,12 +273,12 @@ func (r apiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error } // body params localVarPostBody = r.user - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -305,31 +299,29 @@ func (r apiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error return localVarHTTPResponse, nil } -type apiDeleteUserRequest struct { +type ApiDeleteUserRequest struct { ctx _context.Context - apiService *UserApiService username string } /* -DeleteUser Delete user -This can only be done by the logged in user. + * 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, + * @return apiDeleteUserRequest + */ +func (a *UserApiService) DeleteUserGetRequest(ctx _context.Context, username string) ApiDeleteUserRequest { + return ApiDeleteUserRequest{ ctx: ctx, username: username, } } /* -Execute executes the request -*/ -func (r apiDeleteUserRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *UserApiService) DeleteUserExecute(r ApiDeleteUserRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -338,7 +330,7 @@ func (r apiDeleteUserRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.DeleteUser") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.DeleteUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -367,12 +359,12 @@ func (r apiDeleteUserRequest) Execute() (*_nethttp.Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -393,31 +385,29 @@ func (r apiDeleteUserRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiGetUserByNameRequest struct { +type ApiGetUserByNameRequest struct { ctx _context.Context - apiService *UserApiService username string } /* -GetUserByName Get user by user name + * 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, + * @return apiGetUserByNameRequest + */ +func (a *UserApiService) GetUserByNameGetRequest(ctx _context.Context, username string) ApiGetUserByNameRequest { + return ApiGetUserByNameRequest{ ctx: ctx, username: username, } } /* -Execute executes the request -@return User -*/ -func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { + * Execute executes the request + * @return User + */ +func (a *UserApiService) GetUserByNameExecute(r ApiGetUserByNameRequest) (User, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -427,7 +417,7 @@ func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { localVarReturnValue User ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.GetUserByName") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.GetUserByName") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -456,12 +446,12 @@ func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -480,7 +470,7 @@ func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -491,38 +481,36 @@ func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, nil } -type apiLoginUserRequest struct { +type ApiLoginUserRequest struct { ctx _context.Context - apiService *UserApiService username *string password *string } -func (r apiLoginUserRequest) Username(username string) apiLoginUserRequest { +func (r ApiLoginUserRequest) Username(username string) ApiLoginUserRequest { r.username = &username return r } -func (r apiLoginUserRequest) Password(password string) apiLoginUserRequest { +func (r ApiLoginUserRequest) Password(password string) ApiLoginUserRequest { r.password = &password return r } /* -LoginUser Logs user into the system + * 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, + * @return apiLoginUserRequest + */ +func (a *UserApiService) LoginUserGetRequest(ctx _context.Context) ApiLoginUserRequest { + return ApiLoginUserRequest{ ctx: ctx, } } /* -Execute executes the request -@return string -*/ -func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { + * Execute executes the request + * @return string + */ +func (a *UserApiService) LoginUserExecute(r ApiLoginUserRequest) (string, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -532,7 +520,7 @@ func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { localVarReturnValue string ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LoginUser") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LoginUser") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -568,12 +556,12 @@ func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := r.apiService.client.callAPI(req) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -592,7 +580,7 @@ func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, newErr } - 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, @@ -603,27 +591,25 @@ func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, nil } -type apiLogoutUserRequest struct { +type ApiLogoutUserRequest struct { ctx _context.Context - apiService *UserApiService } /* -LogoutUser Logs out current logged in user session + * 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, + * @return apiLogoutUserRequest + */ +func (a *UserApiService) LogoutUserGetRequest(ctx _context.Context) ApiLogoutUserRequest { + return ApiLogoutUserRequest{ ctx: ctx, } } /* -Execute executes the request -*/ -func (r apiLogoutUserRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *UserApiService) LogoutUserExecute(r ApiLogoutUserRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -632,7 +618,7 @@ func (r apiLogoutUserRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LogoutUser") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LogoutUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -660,12 +646,12 @@ func (r apiLogoutUserRequest) Execute() (*_nethttp.Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -686,36 +672,34 @@ func (r apiLogoutUserRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, nil } -type apiUpdateUserRequest struct { +type ApiUpdateUserRequest struct { ctx _context.Context - apiService *UserApiService username string user *User } -func (r apiUpdateUserRequest) User(user User) apiUpdateUserRequest { +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. + * 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, + * @return apiUpdateUserRequest + */ +func (a *UserApiService) UpdateUserGetRequest(ctx _context.Context, username string) ApiUpdateUserRequest { + return ApiUpdateUserRequest{ ctx: ctx, username: username, } } /* -Execute executes the request -*/ -func (r apiUpdateUserRequest) Execute() (*_nethttp.Response, error) { + * Execute executes the request + */ +func (a *UserApiService) UpdateUserExecute(r ApiUpdateUserRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -724,7 +708,7 @@ func (r apiUpdateUserRequest) Execute() (*_nethttp.Response, error) { localVarFileBytes []byte ) - localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.UpdateUser") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.UpdateUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -758,12 +742,12 @@ func (r apiUpdateUserRequest) Execute() (*_nethttp.Response, error) { } // body params localVarPostBody = r.user - req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := a.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) + localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } diff --git a/samples/openapi3/client/petstore/go-experimental/http_signature_test.go b/samples/openapi3/client/petstore/go-experimental/http_signature_test.go index 6348599111a6..ba87c6eeb6f9 100644 --- a/samples/openapi3/client/petstore/go-experimental/http_signature_test.go +++ b/samples/openapi3/client/petstore/go-experimental/http_signature_test.go @@ -281,7 +281,8 @@ func executeHttpSignatureAuth(t *testing.T, authConfig *sw.HttpSignatureAuth, ex fmt.Printf("Request with HTTP signature. Scheme: '%s'. Algorithm: '%s'. MaxValidity: %v. Headers: '%v'\n", authConfig.SigningScheme, authConfig.SigningAlgorithm, authConfig.SignatureMaxValidity, authConfig.SignedHeaders) - r, err2 := apiClient.PetApi.AddPet(authCtx).Pet(newPet).Execute() + addReq := apiClient.PetApi.AddPetGetRequest(authCtx).Pet(newPet) + r, err2 := apiClient.PetApi.AddPetExecute(addReq) if expectSuccess && err2 != nil { t.Fatalf("Error while adding pet: %v", err2) } @@ -297,7 +298,8 @@ func executeHttpSignatureAuth(t *testing.T, authConfig *sw.HttpSignatureAuth, ex t.Log(r) } - _, r, err = apiClient.PetApi.GetPetById(authCtx, 12992).Execute() + getReq := apiClient.PetApi.GetPetByIdGetRequest(authCtx, 12992) + _, r, err = apiClient.PetApi.GetPetByIdExecute(getReq) if expectSuccess && err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } diff --git a/samples/openapi3/client/petstore/go-experimental/pet_api_test.go b/samples/openapi3/client/petstore/go-experimental/pet_api_test.go index 9f0a154f96a0..fb609c50eefb 100644 --- a/samples/openapi3/client/petstore/go-experimental/pet_api_test.go +++ b/samples/openapi3/client/petstore/go-experimental/pet_api_test.go @@ -31,7 +31,8 @@ func TestAddPet(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - r, err := client.PetApi.AddPet(context.Background()).Pet(newPet).Execute() + req := client.PetApi.AddPetGetRequest(context.Background()).Pet(newPet) + r, err := client.PetApi.AddPetExecute(req) if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -42,7 +43,8 @@ func TestAddPet(t *testing.T) { } func TestFindPetsByStatusWithMissingParam(t *testing.T) { - _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute() + req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status(nil) + _, r, err := client.PetApi.FindPetsByStatusExecute(req) if err != nil { t.Fatalf("Error while testing TestFindPetsByStatusWithMissingParam: %v", err) @@ -57,7 +59,8 @@ func TestGetPetById(t *testing.T) { } func TestGetPetByIdWithInvalidID(t *testing.T) { - resp, r, err := client.PetApi.GetPetById(context.Background(), 999999999).Execute() + req := client.PetApi.GetPetByIdGetRequest(context.Background(), 999999999) + resp, r, err := client.PetApi.GetPetByIdExecute(req) if r != nil && r.StatusCode == 404 { assertedError, ok := err.(sw.GenericOpenAPIError) a := assert.New(t) @@ -74,7 +77,8 @@ func TestGetPetByIdWithInvalidID(t *testing.T) { } func TestUpdatePetWithForm(t *testing.T) { - r, err := client.PetApi.UpdatePetWithForm(context.Background(), 12830).Name("golang").Status("available").Execute() + req := client.PetApi.UpdatePetWithFormGetRequest(context.Background(), 12830).Name("golang").Status("available") + r, err := client.PetApi.UpdatePetWithFormExecute(req) if err != nil { t.Fatalf("Error while updating pet by id: %v", err) t.Log(r) @@ -89,7 +93,8 @@ func TestUpdatePetWithForm(t *testing.T) { func TestFindPetsByTag(t *testing.T) { var found = false - resp, r, err := client.PetApi.FindPetsByTags(context.Background()).Tags([]string{"tag2"}).Execute() + req := client.PetApi.FindPetsByTagsGetRequest(context.Background()).Tags([]string{"tag2"}) + resp, r, err := client.PetApi.FindPetsByTagsExecute(req) if err != nil { t.Fatalf("Error while getting pet by tag: %v", err) t.Log(r) @@ -118,7 +123,8 @@ func TestFindPetsByTag(t *testing.T) { } func TestFindPetsByStatus(t *testing.T) { - resp, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status([]string{"available"}).Execute() + req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status([]string{"available"}) + resp, r, err := client.PetApi.FindPetsByStatusExecute(req) if err != nil { t.Fatalf("Error while getting pet by id: %v", err) t.Log(r) @@ -144,7 +150,8 @@ func TestUploadFile(t *testing.T) { t.Fatalf("Error opening file: %v", err1) } - _, r, err := client.PetApi.UploadFile(context.Background(), 12830).AdditionalMetadata("golang").File(file).Execute() + req := client.PetApi.UploadFileGetRequest(context.Background(), 12830).AdditionalMetadata("golang").File(file) + _, r, err := client.PetApi.UploadFileExecute(req) if err != nil { t.Fatalf("Error while uploading file: %v", err) @@ -162,7 +169,8 @@ func TestUploadFileRequired(t *testing.T) { t.Fatalf("Error opening file: %v", err1) } - _, r, err := client.PetApi.UploadFileWithRequiredFile(context.Background(), 12830).RequiredFile(file).AdditionalMetadata("golang").Execute() + req := client.PetApi.UploadFileWithRequiredFileGetRequest(context.Background(), 12830).RequiredFile(file).AdditionalMetadata("golang") + _, r, err := client.PetApi.UploadFileWithRequiredFileExecute(req) if err != nil { t.Fatalf("Error while uploading file: %v", err) @@ -174,7 +182,8 @@ func TestUploadFileRequired(t *testing.T) { } func TestDeletePet(t *testing.T) { - r, err := client.PetApi.DeletePet(context.Background(), 12830).Execute() + req := client.PetApi.DeletePetGetRequest(context.Background(), 12830) + r, err := client.PetApi.DeletePetExecute(req) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -264,7 +273,8 @@ func waitOnFunctions(t *testing.T, errc chan error, n int) { } func deletePet(t *testing.T, id int64) { - r, err := client.PetApi.DeletePet(context.Background(), id).Execute() + req := client.PetApi.DeletePetGetRequest(context.Background(), id) + r, err := client.PetApi.DeletePetExecute(req) if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -276,7 +286,8 @@ func deletePet(t *testing.T, id int64) { func isPetCorrect(t *testing.T, id int64, name string, status string) { assert := assert.New(t) - resp, r, err := client.PetApi.GetPetById(context.Background(), id).Execute() + req := client.PetApi.GetPetByIdGetRequest(context.Background(), id) + resp, r, err := client.PetApi.GetPetByIdExecute(req) if err != nil { t.Fatalf("Error while getting pet by id: %v", err) } else { diff --git a/samples/openapi3/client/petstore/go-experimental/store_api_test.go b/samples/openapi3/client/petstore/go-experimental/store_api_test.go index fc0cdec9699a..e222aed6880c 100644 --- a/samples/openapi3/client/petstore/go-experimental/store_api_test.go +++ b/samples/openapi3/client/petstore/go-experimental/store_api_test.go @@ -18,7 +18,8 @@ func TestPlaceOrder(t *testing.T) { Status: sw.PtrString("placed"), Complete: sw.PtrBool(false)} - _, r, err := client.StoreApi.PlaceOrder(context.Background()).Order(newOrder).Execute() + req := client.StoreApi.PlaceOrderGetRequest(context.Background()).Order(newOrder) + _, r, err := client.StoreApi.PlaceOrderExecute(req) if err != nil { // Skip parsing time error due to error in Petstore Test Server diff --git a/samples/openapi3/client/petstore/go-experimental/user_api_test.go b/samples/openapi3/client/petstore/go-experimental/user_api_test.go index ef66e2410c06..3f83666d1fcc 100644 --- a/samples/openapi3/client/petstore/go-experimental/user_api_test.go +++ b/samples/openapi3/client/petstore/go-experimental/user_api_test.go @@ -20,7 +20,8 @@ func TestCreateUser(t *testing.T) { Phone: sw.PtrString("5101112222"), UserStatus: sw.PtrInt32(1)} - apiResponse, err := client.UserApi.CreateUser(context.Background()).User(newUser).Execute() + req := client.UserApi.CreateUserGetRequest(context.Background()).User(newUser) + apiResponse, err := client.UserApi.CreateUserExecute(req) if err != nil { t.Fatalf("Error while adding user: %v", err) @@ -55,7 +56,8 @@ func TestCreateUsersWithArrayInput(t *testing.T) { }, } - apiResponse, err := client.UserApi.CreateUsersWithArrayInput(context.Background()).User(newUsers).Execute() + req := client.UserApi.CreateUsersWithArrayInputGetRequest(context.Background()).User(newUsers) + apiResponse, err := client.UserApi.CreateUsersWithArrayInputExecute(req) if err != nil { t.Fatalf("Error while adding users: %v", err) } @@ -82,7 +84,8 @@ func TestCreateUsersWithArrayInput(t *testing.T) { func TestGetUserByName(t *testing.T) { assert := assert.New(t) - resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher").Execute() + req := client.UserApi.GetUserByNameGetRequest(context.Background(), "gopher") + resp, apiResponse, err := client.UserApi.GetUserByNameExecute(req) if err != nil { t.Fatalf("Error while getting user by id: %v", err) } else { @@ -97,7 +100,8 @@ func TestGetUserByName(t *testing.T) { } func TestGetUserByNameWithInvalidID(t *testing.T) { - resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "999999999").Execute() + req := client.UserApi.GetUserByNameGetRequest(context.Background(), "999999999") + resp, apiResponse, err := client.UserApi.GetUserByNameExecute(req) if apiResponse != nil && apiResponse.StatusCode == 404 { return // This is a pass condition. API will return with a 404 error. } else if err != nil { @@ -124,7 +128,8 @@ func TestUpdateUser(t *testing.T) { Phone: sw.PtrString("5101112222"), UserStatus: sw.PtrInt32(1)} - apiResponse, err := client.UserApi.UpdateUser(context.Background(), "gopher").User(newUser).Execute() + updateReq := client.UserApi.UpdateUserGetRequest(context.Background(), "gopher").User(newUser) + apiResponse, err := client.UserApi.UpdateUserExecute(updateReq) if err != nil { t.Fatalf("Error while deleting user by id: %v", err) } @@ -133,7 +138,8 @@ func TestUpdateUser(t *testing.T) { } //verify changings are correct - resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher").Execute() + getReq := client.UserApi.GetUserByNameGetRequest(context.Background(), "gopher") + resp, apiResponse, err := client.UserApi.GetUserByNameExecute(getReq) if err != nil { t.Fatalf("Error while getting user by id: %v", err) } else { From 16c2141ab56194664d8f2494868d0839439bbbcb Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Tue, 12 May 2020 19:16:25 -0500 Subject: [PATCH 11/16] Enable generateInterfaces for go-experimental samples * Samples now contain interfaces, using backward incompatible method signatures. * Add one test for mocked methods * Switch to go 1.14 for circleci to allow generating mocks --- CI/circle_parallel.sh | 6 + .../go-petstore/api_another_fake.go | 17 + .../go-experimental/go-petstore/api_fake.go | 190 +++++++++++ .../go-petstore/api_fake_classname_tags123.go | 17 + .../go-experimental/go-petstore/api_pet.go | 124 ++++++++ .../go-experimental/go-petstore/api_store.go | 59 ++++ .../go-experimental/go-petstore/api_user.go | 107 +++++++ .../go-experimental/go-petstore/client.go | 12 +- .../go-experimental/go-petstore/go.mod | 1 + .../go-experimental/go-petstore/go.sum | 12 + .../go-petstore/mock_api_pet.go | 301 ++++++++++++++++++ .../petstore/go-experimental/pet_api_test.go | 23 ++ .../client/petstore/go-experimental/pom.xml | 14 + 13 files changed, 877 insertions(+), 6 deletions(-) create mode 100644 samples/client/petstore/go-experimental/go-petstore/mock_api_pet.go diff --git a/CI/circle_parallel.sh b/CI/circle_parallel.sh index 70b541743d8b..84fdbe182498 100755 --- a/CI/circle_parallel.sh +++ b/CI/circle_parallel.sh @@ -29,6 +29,12 @@ elif [ "$NODE_INDEX" = "2" ]; then if [[ $project_version == *"-SNAPSHOT" ]]; then echo "Running node $NODE_INDEX to test ensure-up-to-date" java -version + # Install golang version 1.14 + go version + sudo mkdir /usr/local/go1.14 + wget -c https://dl.google.com/go/go1.14.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.14 + export PATH="/usr/local/go1.14/go/bin:$PATH" + go version # clear any changes to the samples git checkout -- . diff --git a/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go index e056b8e60b42..64bdce19dbea 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go @@ -21,6 +21,23 @@ var ( _ _context.Context ) + type AnotherFakeApi interface { + /* + * 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 + */ + Call123TestSpecialTagsGetRequest(ctx _context.Context) ApiCall123TestSpecialTagsRequest + + /* + * Execute executes the request + * @return Client + */ + Call123TestSpecialTagsExecute(r ApiCall123TestSpecialTagsRequest) (Client, *_nethttp.Response, error) + + } + // AnotherFakeApiService AnotherFakeApi service type AnotherFakeApiService service diff --git a/samples/client/petstore/go-experimental/go-petstore/api_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_fake.go index a7436012ccb1..b2c0acfc2990 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_fake.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_fake.go @@ -24,6 +24,196 @@ var ( _ _context.Context ) + type FakeApi interface { + /* + * 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 + */ + CreateXmlItemGetRequest(ctx _context.Context) ApiCreateXmlItemRequest + + /* + * Execute executes the request + */ + CreateXmlItemExecute(r ApiCreateXmlItemRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + FakeOuterBooleanSerializeGetRequest(ctx _context.Context) ApiFakeOuterBooleanSerializeRequest + + /* + * Execute executes the request + * @return bool + */ + FakeOuterBooleanSerializeExecute(r ApiFakeOuterBooleanSerializeRequest) (bool, *_nethttp.Response, error) + + /* + * 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 + */ + FakeOuterCompositeSerializeGetRequest(ctx _context.Context) ApiFakeOuterCompositeSerializeRequest + + /* + * Execute executes the request + * @return OuterComposite + */ + FakeOuterCompositeSerializeExecute(r ApiFakeOuterCompositeSerializeRequest) (OuterComposite, *_nethttp.Response, error) + + /* + * 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 + */ + FakeOuterNumberSerializeGetRequest(ctx _context.Context) ApiFakeOuterNumberSerializeRequest + + /* + * Execute executes the request + * @return float32 + */ + FakeOuterNumberSerializeExecute(r ApiFakeOuterNumberSerializeRequest) (float32, *_nethttp.Response, error) + + /* + * 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 + */ + FakeOuterStringSerializeGetRequest(ctx _context.Context) ApiFakeOuterStringSerializeRequest + + /* + * Execute executes the request + * @return string + */ + FakeOuterStringSerializeExecute(r ApiFakeOuterStringSerializeRequest) (string, *_nethttp.Response, error) + + /* + * 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 + */ + TestBodyWithFileSchemaGetRequest(ctx _context.Context) ApiTestBodyWithFileSchemaRequest + + /* + * Execute executes the request + */ + TestBodyWithFileSchemaExecute(r ApiTestBodyWithFileSchemaRequest) (*_nethttp.Response, error) + + /* + * TestBodyWithQueryParams Method for TestBodyWithQueryParams + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return apiTestBodyWithQueryParamsRequest + */ + TestBodyWithQueryParamsGetRequest(ctx _context.Context) ApiTestBodyWithQueryParamsRequest + + /* + * Execute executes the request + */ + TestBodyWithQueryParamsExecute(r ApiTestBodyWithQueryParamsRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestClientModelGetRequest(ctx _context.Context) ApiTestClientModelRequest + + /* + * Execute executes the request + * @return Client + */ + TestClientModelExecute(r ApiTestClientModelRequest) (Client, *_nethttp.Response, error) + + /* + * 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 + */ + TestEndpointParametersGetRequest(ctx _context.Context) ApiTestEndpointParametersRequest + + /* + * Execute executes the request + */ + TestEndpointParametersExecute(r ApiTestEndpointParametersRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestEnumParametersGetRequest(ctx _context.Context) ApiTestEnumParametersRequest + + /* + * Execute executes the request + */ + TestEnumParametersExecute(r ApiTestEnumParametersRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestGroupParametersGetRequest(ctx _context.Context) ApiTestGroupParametersRequest + + /* + * Execute executes the request + */ + TestGroupParametersExecute(r ApiTestGroupParametersRequest) (*_nethttp.Response, error) + + /* + * TestInlineAdditionalProperties test inline additionalProperties + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return apiTestInlineAdditionalPropertiesRequest + */ + TestInlineAdditionalPropertiesGetRequest(ctx _context.Context) ApiTestInlineAdditionalPropertiesRequest + + /* + * Execute executes the request + */ + TestInlineAdditionalPropertiesExecute(r ApiTestInlineAdditionalPropertiesRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestJsonFormDataGetRequest(ctx _context.Context) ApiTestJsonFormDataRequest + + /* + * Execute executes the request + */ + TestJsonFormDataExecute(r ApiTestJsonFormDataRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestQueryParameterCollectionFormatGetRequest(ctx _context.Context) ApiTestQueryParameterCollectionFormatRequest + + /* + * Execute executes the request + */ + TestQueryParameterCollectionFormatExecute(r ApiTestQueryParameterCollectionFormatRequest) (*_nethttp.Response, error) + + } + // FakeApiService FakeApi service type FakeApiService service diff --git a/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go b/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go index afb29bedf8fd..2df9fecaee07 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go @@ -21,6 +21,23 @@ var ( _ _context.Context ) + type FakeClassnameTags123Api interface { + /* + * 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 + */ + TestClassnameGetRequest(ctx _context.Context) ApiTestClassnameRequest + + /* + * Execute executes the request + * @return Client + */ + TestClassnameExecute(r ApiTestClassnameRequest) (Client, *_nethttp.Response, error) + + } + // FakeClassnameTags123ApiService FakeClassnameTags123Api service type FakeClassnameTags123ApiService service diff --git a/samples/client/petstore/go-experimental/go-petstore/api_pet.go b/samples/client/petstore/go-experimental/go-petstore/api_pet.go index 1709d29b98ce..860410cf5d48 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_pet.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_pet.go @@ -23,6 +23,130 @@ var ( _ _context.Context ) + type PetApi interface { + /* + * 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 + */ + AddPetGetRequest(ctx _context.Context) ApiAddPetRequest + + /* + * Execute executes the request + */ + AddPetExecute(r ApiAddPetRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + DeletePetGetRequest(ctx _context.Context, petId int64) ApiDeletePetRequest + + /* + * Execute executes the request + */ + DeletePetExecute(r ApiDeletePetRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + FindPetsByStatusGetRequest(ctx _context.Context) ApiFindPetsByStatusRequest + + /* + * Execute executes the request + * @return []Pet + */ + FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([]Pet, *_nethttp.Response, error) + + /* + * 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 + */ + FindPetsByTagsGetRequest(ctx _context.Context) ApiFindPetsByTagsRequest + + /* + * Execute executes the request + * @return []Pet + */ + FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet, *_nethttp.Response, error) + + /* + * 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 + */ + GetPetByIdGetRequest(ctx _context.Context, petId int64) ApiGetPetByIdRequest + + /* + * Execute executes the request + * @return Pet + */ + GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *_nethttp.Response, error) + + /* + * 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 + */ + UpdatePetGetRequest(ctx _context.Context) ApiUpdatePetRequest + + /* + * Execute executes the request + */ + UpdatePetExecute(r ApiUpdatePetRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + UpdatePetWithFormGetRequest(ctx _context.Context, petId int64) ApiUpdatePetWithFormRequest + + /* + * Execute executes the request + */ + UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + UploadFileGetRequest(ctx _context.Context, petId int64) ApiUploadFileRequest + + /* + * Execute executes the request + * @return ApiResponse + */ + UploadFileExecute(r ApiUploadFileRequest) (ApiResponse, *_nethttp.Response, error) + + /* + * 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 + */ + UploadFileWithRequiredFileGetRequest(ctx _context.Context, petId int64) ApiUploadFileWithRequiredFileRequest + + /* + * Execute executes the request + * @return ApiResponse + */ + UploadFileWithRequiredFileExecute(r ApiUploadFileWithRequiredFileRequest) (ApiResponse, *_nethttp.Response, error) + + } + // PetApiService PetApi service type PetApiService service diff --git a/samples/client/petstore/go-experimental/go-petstore/api_store.go b/samples/client/petstore/go-experimental/go-petstore/api_store.go index 6eac7f21e211..10510107472a 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_store.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_store.go @@ -22,6 +22,65 @@ var ( _ _context.Context ) + type StoreApi interface { + /* + * 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 + */ + DeleteOrderGetRequest(ctx _context.Context, orderId string) ApiDeleteOrderRequest + + /* + * Execute executes the request + */ + DeleteOrderExecute(r ApiDeleteOrderRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + GetInventoryGetRequest(ctx _context.Context) ApiGetInventoryRequest + + /* + * Execute executes the request + * @return map[string]int32 + */ + GetInventoryExecute(r ApiGetInventoryRequest) (map[string]int32, *_nethttp.Response, error) + + /* + * 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 + */ + GetOrderByIdGetRequest(ctx _context.Context, orderId int64) ApiGetOrderByIdRequest + + /* + * Execute executes the request + * @return Order + */ + GetOrderByIdExecute(r ApiGetOrderByIdRequest) (Order, *_nethttp.Response, error) + + /* + * 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 + */ + PlaceOrderGetRequest(ctx _context.Context) ApiPlaceOrderRequest + + /* + * Execute executes the request + * @return Order + */ + PlaceOrderExecute(r ApiPlaceOrderRequest) (Order, *_nethttp.Response, error) + + } + // StoreApiService StoreApi service type StoreApiService service diff --git a/samples/client/petstore/go-experimental/go-petstore/api_user.go b/samples/client/petstore/go-experimental/go-petstore/api_user.go index b1055caec5fd..ff7a1e5d2b24 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_user.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_user.go @@ -22,6 +22,113 @@ var ( _ _context.Context ) + type UserApi interface { + /* + * 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 + */ + CreateUserGetRequest(ctx _context.Context) ApiCreateUserRequest + + /* + * Execute executes the request + */ + CreateUserExecute(r ApiCreateUserRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + CreateUsersWithArrayInputGetRequest(ctx _context.Context) ApiCreateUsersWithArrayInputRequest + + /* + * Execute executes the request + */ + CreateUsersWithArrayInputExecute(r ApiCreateUsersWithArrayInputRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + CreateUsersWithListInputGetRequest(ctx _context.Context) ApiCreateUsersWithListInputRequest + + /* + * Execute executes the request + */ + CreateUsersWithListInputExecute(r ApiCreateUsersWithListInputRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + DeleteUserGetRequest(ctx _context.Context, username string) ApiDeleteUserRequest + + /* + * Execute executes the request + */ + DeleteUserExecute(r ApiDeleteUserRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + GetUserByNameGetRequest(ctx _context.Context, username string) ApiGetUserByNameRequest + + /* + * Execute executes the request + * @return User + */ + GetUserByNameExecute(r ApiGetUserByNameRequest) (User, *_nethttp.Response, error) + + /* + * 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 + */ + LoginUserGetRequest(ctx _context.Context) ApiLoginUserRequest + + /* + * Execute executes the request + * @return string + */ + LoginUserExecute(r ApiLoginUserRequest) (string, *_nethttp.Response, error) + + /* + * 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 + */ + LogoutUserGetRequest(ctx _context.Context) ApiLogoutUserRequest + + /* + * Execute executes the request + */ + LogoutUserExecute(r ApiLogoutUserRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + UpdateUserGetRequest(ctx _context.Context, username string) ApiUpdateUserRequest + + /* + * Execute executes the request + */ + UpdateUserExecute(r ApiUpdateUserRequest) (*_nethttp.Response, error) + + } + // UserApiService UserApi service type UserApiService service diff --git a/samples/client/petstore/go-experimental/go-petstore/client.go b/samples/client/petstore/go-experimental/go-petstore/client.go index a9bd76d61238..09eb6b64596c 100644 --- a/samples/client/petstore/go-experimental/go-petstore/client.go +++ b/samples/client/petstore/go-experimental/go-petstore/client.go @@ -47,17 +47,17 @@ type APIClient struct { // API Services - AnotherFakeApi *AnotherFakeApiService + AnotherFakeApi AnotherFakeApi - FakeApi *FakeApiService + FakeApi FakeApi - FakeClassnameTags123Api *FakeClassnameTags123ApiService + FakeClassnameTags123Api FakeClassnameTags123Api - PetApi *PetApiService + PetApi PetApi - StoreApi *StoreApiService + StoreApi StoreApi - UserApi *UserApiService + UserApi UserApi } type service struct { diff --git a/samples/client/petstore/go-experimental/go-petstore/go.mod b/samples/client/petstore/go-experimental/go-petstore/go.mod index f9811556cc5a..c17600c50962 100644 --- a/samples/client/petstore/go-experimental/go-petstore/go.mod +++ b/samples/client/petstore/go-experimental/go-petstore/go.mod @@ -3,5 +3,6 @@ module github.com/GIT_USER_ID/GIT_REPO_ID go 1.13 require ( + github.com/golang/mock v1.4.3 // indirect golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 ) diff --git a/samples/client/petstore/go-experimental/go-petstore/go.sum b/samples/client/petstore/go-experimental/go-petstore/go.sum index ce55b3c6a08f..06e8c00bd81a 100644 --- a/samples/client/petstore/go-experimental/go-petstore/go.sum +++ b/samples/client/petstore/go-experimental/go-petstore/go.sum @@ -1,15 +1,27 @@ 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/mock v1.4.3 h1:GV+pQPG/EUUbkh47niozDcADz6go/dUwhVzdUQHIVRw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= 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/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 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/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 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/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262 h1:qsl9y/CJx34tuA7QCPNp86JNJe4spst6Ff8MjvPUdPg= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 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= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/samples/client/petstore/go-experimental/go-petstore/mock_api_pet.go b/samples/client/petstore/go-experimental/go-petstore/mock_api_pet.go new file mode 100644 index 000000000000..5bd6718ad4aa --- /dev/null +++ b/samples/client/petstore/go-experimental/go-petstore/mock_api_pet.go @@ -0,0 +1,301 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: api_pet.go + +// Package petstore is a generated GoMock package. +package petstore + +import ( + context "context" + gomock "github.com/golang/mock/gomock" + http "net/http" + reflect "reflect" +) + +// MockPetApi is a mock of PetApi interface +type MockPetApi struct { + ctrl *gomock.Controller + recorder *MockPetApiMockRecorder +} + +// MockPetApiMockRecorder is the mock recorder for MockPetApi +type MockPetApiMockRecorder struct { + mock *MockPetApi +} + +// NewMockPetApi creates a new mock instance +func NewMockPetApi(ctrl *gomock.Controller) *MockPetApi { + mock := &MockPetApi{ctrl: ctrl} + mock.recorder = &MockPetApiMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockPetApi) EXPECT() *MockPetApiMockRecorder { + return m.recorder +} + +// AddPetGetRequest mocks base method +func (m *MockPetApi) AddPetGetRequest(ctx context.Context) ApiAddPetRequest { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddPetGetRequest", ctx) + ret0, _ := ret[0].(ApiAddPetRequest) + return ret0 +} + +// AddPetGetRequest indicates an expected call of AddPetGetRequest +func (mr *MockPetApiMockRecorder) AddPetGetRequest(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddPetGetRequest", reflect.TypeOf((*MockPetApi)(nil).AddPetGetRequest), ctx) +} + +// AddPetExecute mocks base method +func (m *MockPetApi) AddPetExecute(r ApiAddPetRequest) (*http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddPetExecute", r) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddPetExecute indicates an expected call of AddPetExecute +func (mr *MockPetApiMockRecorder) AddPetExecute(r interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddPetExecute", reflect.TypeOf((*MockPetApi)(nil).AddPetExecute), r) +} + +// DeletePetGetRequest mocks base method +func (m *MockPetApi) DeletePetGetRequest(ctx context.Context, petId int64) ApiDeletePetRequest { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeletePetGetRequest", ctx, petId) + ret0, _ := ret[0].(ApiDeletePetRequest) + return ret0 +} + +// DeletePetGetRequest indicates an expected call of DeletePetGetRequest +func (mr *MockPetApiMockRecorder) DeletePetGetRequest(ctx, petId interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePetGetRequest", reflect.TypeOf((*MockPetApi)(nil).DeletePetGetRequest), ctx, petId) +} + +// DeletePetExecute mocks base method +func (m *MockPetApi) DeletePetExecute(r ApiDeletePetRequest) (*http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeletePetExecute", r) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeletePetExecute indicates an expected call of DeletePetExecute +func (mr *MockPetApiMockRecorder) DeletePetExecute(r interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePetExecute", reflect.TypeOf((*MockPetApi)(nil).DeletePetExecute), r) +} + +// FindPetsByStatusGetRequest mocks base method +func (m *MockPetApi) FindPetsByStatusGetRequest(ctx context.Context) ApiFindPetsByStatusRequest { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FindPetsByStatusGetRequest", ctx) + ret0, _ := ret[0].(ApiFindPetsByStatusRequest) + return ret0 +} + +// FindPetsByStatusGetRequest indicates an expected call of FindPetsByStatusGetRequest +func (mr *MockPetApiMockRecorder) FindPetsByStatusGetRequest(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindPetsByStatusGetRequest", reflect.TypeOf((*MockPetApi)(nil).FindPetsByStatusGetRequest), ctx) +} + +// FindPetsByStatusExecute mocks base method +func (m *MockPetApi) FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([]Pet, *http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FindPetsByStatusExecute", r) + ret0, _ := ret[0].([]Pet) + ret1, _ := ret[1].(*http.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// FindPetsByStatusExecute indicates an expected call of FindPetsByStatusExecute +func (mr *MockPetApiMockRecorder) FindPetsByStatusExecute(r interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindPetsByStatusExecute", reflect.TypeOf((*MockPetApi)(nil).FindPetsByStatusExecute), r) +} + +// FindPetsByTagsGetRequest mocks base method +func (m *MockPetApi) FindPetsByTagsGetRequest(ctx context.Context) ApiFindPetsByTagsRequest { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FindPetsByTagsGetRequest", ctx) + ret0, _ := ret[0].(ApiFindPetsByTagsRequest) + return ret0 +} + +// FindPetsByTagsGetRequest indicates an expected call of FindPetsByTagsGetRequest +func (mr *MockPetApiMockRecorder) FindPetsByTagsGetRequest(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindPetsByTagsGetRequest", reflect.TypeOf((*MockPetApi)(nil).FindPetsByTagsGetRequest), ctx) +} + +// FindPetsByTagsExecute mocks base method +func (m *MockPetApi) FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet, *http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FindPetsByTagsExecute", r) + ret0, _ := ret[0].([]Pet) + ret1, _ := ret[1].(*http.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// FindPetsByTagsExecute indicates an expected call of FindPetsByTagsExecute +func (mr *MockPetApiMockRecorder) FindPetsByTagsExecute(r interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindPetsByTagsExecute", reflect.TypeOf((*MockPetApi)(nil).FindPetsByTagsExecute), r) +} + +// GetPetByIdGetRequest mocks base method +func (m *MockPetApi) GetPetByIdGetRequest(ctx context.Context, petId int64) ApiGetPetByIdRequest { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPetByIdGetRequest", ctx, petId) + ret0, _ := ret[0].(ApiGetPetByIdRequest) + return ret0 +} + +// GetPetByIdGetRequest indicates an expected call of GetPetByIdGetRequest +func (mr *MockPetApiMockRecorder) GetPetByIdGetRequest(ctx, petId interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPetByIdGetRequest", reflect.TypeOf((*MockPetApi)(nil).GetPetByIdGetRequest), ctx, petId) +} + +// GetPetByIdExecute mocks base method +func (m *MockPetApi) GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPetByIdExecute", r) + ret0, _ := ret[0].(Pet) + ret1, _ := ret[1].(*http.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetPetByIdExecute indicates an expected call of GetPetByIdExecute +func (mr *MockPetApiMockRecorder) GetPetByIdExecute(r interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPetByIdExecute", reflect.TypeOf((*MockPetApi)(nil).GetPetByIdExecute), r) +} + +// UpdatePetGetRequest mocks base method +func (m *MockPetApi) UpdatePetGetRequest(ctx context.Context) ApiUpdatePetRequest { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdatePetGetRequest", ctx) + ret0, _ := ret[0].(ApiUpdatePetRequest) + return ret0 +} + +// UpdatePetGetRequest indicates an expected call of UpdatePetGetRequest +func (mr *MockPetApiMockRecorder) UpdatePetGetRequest(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePetGetRequest", reflect.TypeOf((*MockPetApi)(nil).UpdatePetGetRequest), ctx) +} + +// UpdatePetExecute mocks base method +func (m *MockPetApi) UpdatePetExecute(r ApiUpdatePetRequest) (*http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdatePetExecute", r) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdatePetExecute indicates an expected call of UpdatePetExecute +func (mr *MockPetApiMockRecorder) UpdatePetExecute(r interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePetExecute", reflect.TypeOf((*MockPetApi)(nil).UpdatePetExecute), r) +} + +// UpdatePetWithFormGetRequest mocks base method +func (m *MockPetApi) UpdatePetWithFormGetRequest(ctx context.Context, petId int64) ApiUpdatePetWithFormRequest { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdatePetWithFormGetRequest", ctx, petId) + ret0, _ := ret[0].(ApiUpdatePetWithFormRequest) + return ret0 +} + +// UpdatePetWithFormGetRequest indicates an expected call of UpdatePetWithFormGetRequest +func (mr *MockPetApiMockRecorder) UpdatePetWithFormGetRequest(ctx, petId interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePetWithFormGetRequest", reflect.TypeOf((*MockPetApi)(nil).UpdatePetWithFormGetRequest), ctx, petId) +} + +// UpdatePetWithFormExecute mocks base method +func (m *MockPetApi) UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest) (*http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdatePetWithFormExecute", r) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdatePetWithFormExecute indicates an expected call of UpdatePetWithFormExecute +func (mr *MockPetApiMockRecorder) UpdatePetWithFormExecute(r interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePetWithFormExecute", reflect.TypeOf((*MockPetApi)(nil).UpdatePetWithFormExecute), r) +} + +// UploadFileGetRequest mocks base method +func (m *MockPetApi) UploadFileGetRequest(ctx context.Context, petId int64) ApiUploadFileRequest { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UploadFileGetRequest", ctx, petId) + ret0, _ := ret[0].(ApiUploadFileRequest) + return ret0 +} + +// UploadFileGetRequest indicates an expected call of UploadFileGetRequest +func (mr *MockPetApiMockRecorder) UploadFileGetRequest(ctx, petId interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadFileGetRequest", reflect.TypeOf((*MockPetApi)(nil).UploadFileGetRequest), ctx, petId) +} + +// UploadFileExecute mocks base method +func (m *MockPetApi) UploadFileExecute(r ApiUploadFileRequest) (ApiResponse, *http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UploadFileExecute", r) + ret0, _ := ret[0].(ApiResponse) + ret1, _ := ret[1].(*http.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// UploadFileExecute indicates an expected call of UploadFileExecute +func (mr *MockPetApiMockRecorder) UploadFileExecute(r interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadFileExecute", reflect.TypeOf((*MockPetApi)(nil).UploadFileExecute), r) +} + +// UploadFileWithRequiredFileGetRequest mocks base method +func (m *MockPetApi) UploadFileWithRequiredFileGetRequest(ctx context.Context, petId int64) ApiUploadFileWithRequiredFileRequest { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UploadFileWithRequiredFileGetRequest", ctx, petId) + ret0, _ := ret[0].(ApiUploadFileWithRequiredFileRequest) + return ret0 +} + +// UploadFileWithRequiredFileGetRequest indicates an expected call of UploadFileWithRequiredFileGetRequest +func (mr *MockPetApiMockRecorder) UploadFileWithRequiredFileGetRequest(ctx, petId interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadFileWithRequiredFileGetRequest", reflect.TypeOf((*MockPetApi)(nil).UploadFileWithRequiredFileGetRequest), ctx, petId) +} + +// UploadFileWithRequiredFileExecute mocks base method +func (m *MockPetApi) UploadFileWithRequiredFileExecute(r ApiUploadFileWithRequiredFileRequest) (ApiResponse, *http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UploadFileWithRequiredFileExecute", r) + ret0, _ := ret[0].(ApiResponse) + ret1, _ := ret[1].(*http.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// UploadFileWithRequiredFileExecute indicates an expected call of UploadFileWithRequiredFileExecute +func (mr *MockPetApiMockRecorder) UploadFileWithRequiredFileExecute(r interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadFileWithRequiredFileExecute", reflect.TypeOf((*MockPetApi)(nil).UploadFileWithRequiredFileExecute), r) +} diff --git a/samples/client/petstore/go-experimental/pet_api_test.go b/samples/client/petstore/go-experimental/pet_api_test.go index c10e6e6b2350..a3f5bf3562f7 100644 --- a/samples/client/petstore/go-experimental/pet_api_test.go +++ b/samples/client/petstore/go-experimental/pet_api_test.go @@ -3,9 +3,11 @@ package main import ( "context" "fmt" + "net/http" "os" "testing" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" sw "./go-petstore" @@ -42,6 +44,27 @@ func TestAddPet(t *testing.T) { } } +func TestAddPetMock(t *testing.T) { + ctrl := gomock.NewController(t) + defer ctrl.Finish() // Only needed for go versions < 1.14 + mockApi := sw.NewMockPetApi(ctrl) + + mockApi.EXPECT(). + AddPetGetRequest(gomock.Any()). + Return(sw.ApiAddPetRequest{}). + MinTimes(1) // ensure mock method is called at least once + + mockApi.EXPECT(). + AddPetExecute(gomock.Any()). + Return(&http.Response{StatusCode:200}, nil). + MinTimes(1) + + actualApi := client.PetApi + client.PetApi = mockApi + TestAddPet(t) + client.PetApi = actualApi +} + func TestFindPetsByStatusWithMissingParam(t *testing.T) { req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status(nil) _, r, err := client.PetApi.FindPetsByStatusExecute(req) diff --git a/samples/client/petstore/go-experimental/pom.xml b/samples/client/petstore/go-experimental/pom.xml index 9c62bbb95543..c3cff3da6fba 100644 --- a/samples/client/petstore/go-experimental/pom.xml +++ b/samples/client/petstore/go-experimental/pom.xml @@ -68,6 +68,20 @@ + + go-get-gomock + pre-integration-test + + exec + + + go + + get + github.com/golang/mock/gomock + + + go-test integration-test From 9ac3de2f81cb79fe137bf4dd6b8d19280f5f7330 Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Sat, 22 Aug 2020 18:36:38 -0500 Subject: [PATCH 12/16] Undo mock additions in CI/backward incompatibility in tests --- CI/circle_parallel.sh | 6 - .../petstore/go-experimental/auth_test.go | 48 +-- .../petstore/go-experimental/fake_api_test.go | 3 +- .../go-experimental/go-petstore/go.mod | 1 - .../go-experimental/go-petstore/go.sum | 12 - .../go-petstore/mock_api_pet.go | 301 ------------------ .../petstore/go-experimental/pet_api_test.go | 56 +--- .../client/petstore/go-experimental/pom.xml | 14 - .../go-experimental/store_api_test.go | 3 +- .../petstore/go-experimental/user_api_test.go | 18 +- .../petstore/go-experimental/auth_test.go | 48 +-- .../petstore/go-experimental/fake_api_test.go | 3 +- .../go-experimental/http_signature_test.go | 6 +- .../petstore/go-experimental/pet_api_test.go | 33 +- .../go-experimental/store_api_test.go | 3 +- .../petstore/go-experimental/user_api_test.go | 18 +- 16 files changed, 72 insertions(+), 501 deletions(-) delete mode 100644 samples/client/petstore/go-experimental/go-petstore/mock_api_pet.go diff --git a/CI/circle_parallel.sh b/CI/circle_parallel.sh index 84fdbe182498..70b541743d8b 100755 --- a/CI/circle_parallel.sh +++ b/CI/circle_parallel.sh @@ -29,12 +29,6 @@ elif [ "$NODE_INDEX" = "2" ]; then if [[ $project_version == *"-SNAPSHOT" ]]; then echo "Running node $NODE_INDEX to test ensure-up-to-date" java -version - # Install golang version 1.14 - go version - sudo mkdir /usr/local/go1.14 - wget -c https://dl.google.com/go/go1.14.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.14 - export PATH="/usr/local/go1.14/go/bin:$PATH" - go version # clear any changes to the samples git checkout -- . diff --git a/samples/client/petstore/go-experimental/auth_test.go b/samples/client/petstore/go-experimental/auth_test.go index a8c7b7205678..0e532aeff3ac 100644 --- a/samples/client/petstore/go-experimental/auth_test.go +++ b/samples/client/petstore/go-experimental/auth_test.go @@ -41,8 +41,7 @@ func TestOAuth2(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - addReq := client.PetApi.AddPetGetRequest(context.Background()).Body(newPet) - r, err := client.PetApi.AddPetExecute(addReq) + r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -51,8 +50,7 @@ func TestOAuth2(t *testing.T) { t.Log(r) } - delReq := client.PetApi.DeletePetGetRequest(auth, 12992) - r, err = client.PetApi.DeletePetExecute(delReq) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -78,8 +76,7 @@ func TestBasicAuth(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - addReq := client.PetApi.AddPetGetRequest(auth).Body(newPet) - r, err := client.PetApi.AddPetExecute(addReq) + r, err := client.PetApi.AddPet(auth).Body(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -88,8 +85,7 @@ func TestBasicAuth(t *testing.T) { t.Log(r) } - delReq := client.PetApi.DeletePetGetRequest(auth, 12992) - r, err = client.PetApi.DeletePetExecute(delReq) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -110,8 +106,7 @@ func TestAccessToken(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - addReq := client.PetApi.AddPetGetRequest(nil).Body(newPet) - r, err := client.PetApi.AddPetExecute(addReq) + r, err := client.PetApi.AddPet(nil).Body(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -120,8 +115,7 @@ func TestAccessToken(t *testing.T) { t.Log(r) } - delReq := client.PetApi.DeletePetGetRequest(auth, 12992) - r, err = client.PetApi.DeletePetExecute(delReq) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -142,8 +136,7 @@ func TestAPIKeyNoPrefix(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - addReq := client.PetApi.AddPetGetRequest(context.Background()).Body(newPet) - r, err := client.PetApi.AddPetExecute(addReq) + r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -152,8 +145,7 @@ func TestAPIKeyNoPrefix(t *testing.T) { t.Log(r) } - getReq := client.PetApi.GetPetByIdGetRequest(auth, 12992) - _, r, err = client.PetApi.GetPetByIdExecute(getReq) + _, r, err = client.PetApi.GetPetById(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -163,8 +155,7 @@ func TestAPIKeyNoPrefix(t *testing.T) { t.Errorf("APIKey Authentication is missing") } - delReq := client.PetApi.DeletePetGetRequest(auth, 12992) - r, err = client.PetApi.DeletePetExecute(delReq) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -180,8 +171,7 @@ func TestAPIKeyWithPrefix(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - addReq := client.PetApi.AddPetGetRequest(nil).Body(newPet) - r, err := client.PetApi.AddPetExecute(addReq) + r, err := client.PetApi.AddPet(nil).Body(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -190,8 +180,7 @@ func TestAPIKeyWithPrefix(t *testing.T) { t.Log(r) } - getReq := client.PetApi.GetPetByIdGetRequest(auth, 12992) - _, r, err = client.PetApi.GetPetByIdExecute(getReq) + _, r, err = client.PetApi.GetPetById(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -201,8 +190,7 @@ func TestAPIKeyWithPrefix(t *testing.T) { t.Errorf("APIKey Authentication is missing") } - delReq := client.PetApi.DeletePetGetRequest(auth, 12992) - r, err = client.PetApi.DeletePetExecute(delReq) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -216,8 +204,7 @@ func TestDefaultHeader(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - addReq := client.PetApi.AddPetGetRequest(context.Background()).Body(newPet) - r, err := client.PetApi.AddPetExecute(addReq) + r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -226,8 +213,7 @@ func TestDefaultHeader(t *testing.T) { t.Log(r) } - delReq := client.PetApi.DeletePetGetRequest(context.Background(), 12992) - r, err = client.PetApi.DeletePetExecute(delReq) + r, err = client.PetApi.DeletePet(context.Background(), 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -242,8 +228,7 @@ func TestDefaultHeader(t *testing.T) { } func TestHostOverride(t *testing.T) { - req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status(nil) - _, r, err := client.PetApi.FindPetsByStatusExecute(req) + _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute() if err != nil { t.Fatalf("Error while finding pets by status: %v", err) @@ -255,8 +240,7 @@ func TestHostOverride(t *testing.T) { } func TestSchemeOverride(t *testing.T) { - req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status(nil) - _, r, err := client.PetApi.FindPetsByStatusExecute(req) + _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute() if err != nil { t.Fatalf("Error while finding pets by status: %v", err) diff --git a/samples/client/petstore/go-experimental/fake_api_test.go b/samples/client/petstore/go-experimental/fake_api_test.go index 99c0ff29531b..d27137eeacfa 100644 --- a/samples/client/petstore/go-experimental/fake_api_test.go +++ b/samples/client/petstore/go-experimental/fake_api_test.go @@ -17,8 +17,7 @@ func TestPutBodyWithFileSchema(t *testing.T) { File: &sw.File{SourceURI: sw.PtrString("https://example.com/image.png")}, Files: &[]sw.File{{SourceURI: sw.PtrString("https://example.com/image.png")}}} - req := client.FakeApi.TestBodyWithFileSchemaGetRequest(context.Background()).Body(schema) - r, err := client.FakeApi.TestBodyWithFileSchemaExecute(req) + r, err := client.FakeApi.TestBodyWithFileSchema(context.Background()).Body(schema).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) diff --git a/samples/client/petstore/go-experimental/go-petstore/go.mod b/samples/client/petstore/go-experimental/go-petstore/go.mod index c17600c50962..f9811556cc5a 100644 --- a/samples/client/petstore/go-experimental/go-petstore/go.mod +++ b/samples/client/petstore/go-experimental/go-petstore/go.mod @@ -3,6 +3,5 @@ module github.com/GIT_USER_ID/GIT_REPO_ID go 1.13 require ( - github.com/golang/mock v1.4.3 // indirect golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 ) diff --git a/samples/client/petstore/go-experimental/go-petstore/go.sum b/samples/client/petstore/go-experimental/go-petstore/go.sum index 06e8c00bd81a..ce55b3c6a08f 100644 --- a/samples/client/petstore/go-experimental/go-petstore/go.sum +++ b/samples/client/petstore/go-experimental/go-petstore/go.sum @@ -1,27 +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/mock v1.4.3 h1:GV+pQPG/EUUbkh47niozDcADz6go/dUwhVzdUQHIVRw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= 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/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 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/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 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/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262 h1:qsl9y/CJx34tuA7QCPNp86JNJe4spst6Ff8MjvPUdPg= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 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= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/samples/client/petstore/go-experimental/go-petstore/mock_api_pet.go b/samples/client/petstore/go-experimental/go-petstore/mock_api_pet.go deleted file mode 100644 index 5bd6718ad4aa..000000000000 --- a/samples/client/petstore/go-experimental/go-petstore/mock_api_pet.go +++ /dev/null @@ -1,301 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: api_pet.go - -// Package petstore is a generated GoMock package. -package petstore - -import ( - context "context" - gomock "github.com/golang/mock/gomock" - http "net/http" - reflect "reflect" -) - -// MockPetApi is a mock of PetApi interface -type MockPetApi struct { - ctrl *gomock.Controller - recorder *MockPetApiMockRecorder -} - -// MockPetApiMockRecorder is the mock recorder for MockPetApi -type MockPetApiMockRecorder struct { - mock *MockPetApi -} - -// NewMockPetApi creates a new mock instance -func NewMockPetApi(ctrl *gomock.Controller) *MockPetApi { - mock := &MockPetApi{ctrl: ctrl} - mock.recorder = &MockPetApiMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use -func (m *MockPetApi) EXPECT() *MockPetApiMockRecorder { - return m.recorder -} - -// AddPetGetRequest mocks base method -func (m *MockPetApi) AddPetGetRequest(ctx context.Context) ApiAddPetRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddPetGetRequest", ctx) - ret0, _ := ret[0].(ApiAddPetRequest) - return ret0 -} - -// AddPetGetRequest indicates an expected call of AddPetGetRequest -func (mr *MockPetApiMockRecorder) AddPetGetRequest(ctx interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddPetGetRequest", reflect.TypeOf((*MockPetApi)(nil).AddPetGetRequest), ctx) -} - -// AddPetExecute mocks base method -func (m *MockPetApi) AddPetExecute(r ApiAddPetRequest) (*http.Response, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddPetExecute", r) - ret0, _ := ret[0].(*http.Response) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// AddPetExecute indicates an expected call of AddPetExecute -func (mr *MockPetApiMockRecorder) AddPetExecute(r interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddPetExecute", reflect.TypeOf((*MockPetApi)(nil).AddPetExecute), r) -} - -// DeletePetGetRequest mocks base method -func (m *MockPetApi) DeletePetGetRequest(ctx context.Context, petId int64) ApiDeletePetRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeletePetGetRequest", ctx, petId) - ret0, _ := ret[0].(ApiDeletePetRequest) - return ret0 -} - -// DeletePetGetRequest indicates an expected call of DeletePetGetRequest -func (mr *MockPetApiMockRecorder) DeletePetGetRequest(ctx, petId interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePetGetRequest", reflect.TypeOf((*MockPetApi)(nil).DeletePetGetRequest), ctx, petId) -} - -// DeletePetExecute mocks base method -func (m *MockPetApi) DeletePetExecute(r ApiDeletePetRequest) (*http.Response, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeletePetExecute", r) - ret0, _ := ret[0].(*http.Response) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// DeletePetExecute indicates an expected call of DeletePetExecute -func (mr *MockPetApiMockRecorder) DeletePetExecute(r interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePetExecute", reflect.TypeOf((*MockPetApi)(nil).DeletePetExecute), r) -} - -// FindPetsByStatusGetRequest mocks base method -func (m *MockPetApi) FindPetsByStatusGetRequest(ctx context.Context) ApiFindPetsByStatusRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FindPetsByStatusGetRequest", ctx) - ret0, _ := ret[0].(ApiFindPetsByStatusRequest) - return ret0 -} - -// FindPetsByStatusGetRequest indicates an expected call of FindPetsByStatusGetRequest -func (mr *MockPetApiMockRecorder) FindPetsByStatusGetRequest(ctx interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindPetsByStatusGetRequest", reflect.TypeOf((*MockPetApi)(nil).FindPetsByStatusGetRequest), ctx) -} - -// FindPetsByStatusExecute mocks base method -func (m *MockPetApi) FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([]Pet, *http.Response, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FindPetsByStatusExecute", r) - ret0, _ := ret[0].([]Pet) - ret1, _ := ret[1].(*http.Response) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// FindPetsByStatusExecute indicates an expected call of FindPetsByStatusExecute -func (mr *MockPetApiMockRecorder) FindPetsByStatusExecute(r interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindPetsByStatusExecute", reflect.TypeOf((*MockPetApi)(nil).FindPetsByStatusExecute), r) -} - -// FindPetsByTagsGetRequest mocks base method -func (m *MockPetApi) FindPetsByTagsGetRequest(ctx context.Context) ApiFindPetsByTagsRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FindPetsByTagsGetRequest", ctx) - ret0, _ := ret[0].(ApiFindPetsByTagsRequest) - return ret0 -} - -// FindPetsByTagsGetRequest indicates an expected call of FindPetsByTagsGetRequest -func (mr *MockPetApiMockRecorder) FindPetsByTagsGetRequest(ctx interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindPetsByTagsGetRequest", reflect.TypeOf((*MockPetApi)(nil).FindPetsByTagsGetRequest), ctx) -} - -// FindPetsByTagsExecute mocks base method -func (m *MockPetApi) FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet, *http.Response, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FindPetsByTagsExecute", r) - ret0, _ := ret[0].([]Pet) - ret1, _ := ret[1].(*http.Response) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// FindPetsByTagsExecute indicates an expected call of FindPetsByTagsExecute -func (mr *MockPetApiMockRecorder) FindPetsByTagsExecute(r interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindPetsByTagsExecute", reflect.TypeOf((*MockPetApi)(nil).FindPetsByTagsExecute), r) -} - -// GetPetByIdGetRequest mocks base method -func (m *MockPetApi) GetPetByIdGetRequest(ctx context.Context, petId int64) ApiGetPetByIdRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetPetByIdGetRequest", ctx, petId) - ret0, _ := ret[0].(ApiGetPetByIdRequest) - return ret0 -} - -// GetPetByIdGetRequest indicates an expected call of GetPetByIdGetRequest -func (mr *MockPetApiMockRecorder) GetPetByIdGetRequest(ctx, petId interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPetByIdGetRequest", reflect.TypeOf((*MockPetApi)(nil).GetPetByIdGetRequest), ctx, petId) -} - -// GetPetByIdExecute mocks base method -func (m *MockPetApi) GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *http.Response, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetPetByIdExecute", r) - ret0, _ := ret[0].(Pet) - ret1, _ := ret[1].(*http.Response) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// GetPetByIdExecute indicates an expected call of GetPetByIdExecute -func (mr *MockPetApiMockRecorder) GetPetByIdExecute(r interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPetByIdExecute", reflect.TypeOf((*MockPetApi)(nil).GetPetByIdExecute), r) -} - -// UpdatePetGetRequest mocks base method -func (m *MockPetApi) UpdatePetGetRequest(ctx context.Context) ApiUpdatePetRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdatePetGetRequest", ctx) - ret0, _ := ret[0].(ApiUpdatePetRequest) - return ret0 -} - -// UpdatePetGetRequest indicates an expected call of UpdatePetGetRequest -func (mr *MockPetApiMockRecorder) UpdatePetGetRequest(ctx interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePetGetRequest", reflect.TypeOf((*MockPetApi)(nil).UpdatePetGetRequest), ctx) -} - -// UpdatePetExecute mocks base method -func (m *MockPetApi) UpdatePetExecute(r ApiUpdatePetRequest) (*http.Response, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdatePetExecute", r) - ret0, _ := ret[0].(*http.Response) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// UpdatePetExecute indicates an expected call of UpdatePetExecute -func (mr *MockPetApiMockRecorder) UpdatePetExecute(r interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePetExecute", reflect.TypeOf((*MockPetApi)(nil).UpdatePetExecute), r) -} - -// UpdatePetWithFormGetRequest mocks base method -func (m *MockPetApi) UpdatePetWithFormGetRequest(ctx context.Context, petId int64) ApiUpdatePetWithFormRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdatePetWithFormGetRequest", ctx, petId) - ret0, _ := ret[0].(ApiUpdatePetWithFormRequest) - return ret0 -} - -// UpdatePetWithFormGetRequest indicates an expected call of UpdatePetWithFormGetRequest -func (mr *MockPetApiMockRecorder) UpdatePetWithFormGetRequest(ctx, petId interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePetWithFormGetRequest", reflect.TypeOf((*MockPetApi)(nil).UpdatePetWithFormGetRequest), ctx, petId) -} - -// UpdatePetWithFormExecute mocks base method -func (m *MockPetApi) UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest) (*http.Response, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdatePetWithFormExecute", r) - ret0, _ := ret[0].(*http.Response) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// UpdatePetWithFormExecute indicates an expected call of UpdatePetWithFormExecute -func (mr *MockPetApiMockRecorder) UpdatePetWithFormExecute(r interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePetWithFormExecute", reflect.TypeOf((*MockPetApi)(nil).UpdatePetWithFormExecute), r) -} - -// UploadFileGetRequest mocks base method -func (m *MockPetApi) UploadFileGetRequest(ctx context.Context, petId int64) ApiUploadFileRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UploadFileGetRequest", ctx, petId) - ret0, _ := ret[0].(ApiUploadFileRequest) - return ret0 -} - -// UploadFileGetRequest indicates an expected call of UploadFileGetRequest -func (mr *MockPetApiMockRecorder) UploadFileGetRequest(ctx, petId interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadFileGetRequest", reflect.TypeOf((*MockPetApi)(nil).UploadFileGetRequest), ctx, petId) -} - -// UploadFileExecute mocks base method -func (m *MockPetApi) UploadFileExecute(r ApiUploadFileRequest) (ApiResponse, *http.Response, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UploadFileExecute", r) - ret0, _ := ret[0].(ApiResponse) - ret1, _ := ret[1].(*http.Response) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// UploadFileExecute indicates an expected call of UploadFileExecute -func (mr *MockPetApiMockRecorder) UploadFileExecute(r interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadFileExecute", reflect.TypeOf((*MockPetApi)(nil).UploadFileExecute), r) -} - -// UploadFileWithRequiredFileGetRequest mocks base method -func (m *MockPetApi) UploadFileWithRequiredFileGetRequest(ctx context.Context, petId int64) ApiUploadFileWithRequiredFileRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UploadFileWithRequiredFileGetRequest", ctx, petId) - ret0, _ := ret[0].(ApiUploadFileWithRequiredFileRequest) - return ret0 -} - -// UploadFileWithRequiredFileGetRequest indicates an expected call of UploadFileWithRequiredFileGetRequest -func (mr *MockPetApiMockRecorder) UploadFileWithRequiredFileGetRequest(ctx, petId interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadFileWithRequiredFileGetRequest", reflect.TypeOf((*MockPetApi)(nil).UploadFileWithRequiredFileGetRequest), ctx, petId) -} - -// UploadFileWithRequiredFileExecute mocks base method -func (m *MockPetApi) UploadFileWithRequiredFileExecute(r ApiUploadFileWithRequiredFileRequest) (ApiResponse, *http.Response, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UploadFileWithRequiredFileExecute", r) - ret0, _ := ret[0].(ApiResponse) - ret1, _ := ret[1].(*http.Response) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// UploadFileWithRequiredFileExecute indicates an expected call of UploadFileWithRequiredFileExecute -func (mr *MockPetApiMockRecorder) UploadFileWithRequiredFileExecute(r interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadFileWithRequiredFileExecute", reflect.TypeOf((*MockPetApi)(nil).UploadFileWithRequiredFileExecute), r) -} diff --git a/samples/client/petstore/go-experimental/pet_api_test.go b/samples/client/petstore/go-experimental/pet_api_test.go index a3f5bf3562f7..57afd2923c50 100644 --- a/samples/client/petstore/go-experimental/pet_api_test.go +++ b/samples/client/petstore/go-experimental/pet_api_test.go @@ -3,11 +3,9 @@ package main import ( "context" "fmt" - "net/http" "os" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" sw "./go-petstore" @@ -33,8 +31,7 @@ func TestAddPet(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - req := client.PetApi.AddPetGetRequest(context.Background()).Body(newPet) - r, err := client.PetApi.AddPetExecute(req) + r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -44,30 +41,8 @@ func TestAddPet(t *testing.T) { } } -func TestAddPetMock(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() // Only needed for go versions < 1.14 - mockApi := sw.NewMockPetApi(ctrl) - - mockApi.EXPECT(). - AddPetGetRequest(gomock.Any()). - Return(sw.ApiAddPetRequest{}). - MinTimes(1) // ensure mock method is called at least once - - mockApi.EXPECT(). - AddPetExecute(gomock.Any()). - Return(&http.Response{StatusCode:200}, nil). - MinTimes(1) - - actualApi := client.PetApi - client.PetApi = mockApi - TestAddPet(t) - client.PetApi = actualApi -} - func TestFindPetsByStatusWithMissingParam(t *testing.T) { - req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status(nil) - _, r, err := client.PetApi.FindPetsByStatusExecute(req) + _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute() if err != nil { t.Fatalf("Error while testing TestFindPetsByStatusWithMissingParam: %v", err) @@ -82,8 +57,7 @@ func TestGetPetById(t *testing.T) { } func TestGetPetByIdWithInvalidID(t *testing.T) { - req := client.PetApi.GetPetByIdGetRequest(context.Background(), 999999999) - resp, r, err := client.PetApi.GetPetByIdExecute(req) + resp, r, err := client.PetApi.GetPetById(context.Background(), 999999999).Execute() if r != nil && r.StatusCode == 404 { assertedError, ok := err.(sw.GenericOpenAPIError) a := assert.New(t) @@ -100,8 +74,7 @@ func TestGetPetByIdWithInvalidID(t *testing.T) { } func TestUpdatePetWithForm(t *testing.T) { - req := client.PetApi.UpdatePetWithFormGetRequest(context.Background(), 12830).Name("golang").Status("available") - r, err := client.PetApi.UpdatePetWithFormExecute(req) + r, err := client.PetApi.UpdatePetWithForm(context.Background(), 12830).Name("golang").Status("available").Execute() if err != nil { t.Fatalf("Error while updating pet by id: %v", err) t.Log(r) @@ -116,8 +89,7 @@ func TestUpdatePetWithForm(t *testing.T) { func TestFindPetsByTag(t *testing.T) { var found = false - req := client.PetApi.FindPetsByTagsGetRequest(context.Background()).Tags([]string{"tag2"}) - resp, r, err := client.PetApi.FindPetsByTagsExecute(req) + resp, r, err := client.PetApi.FindPetsByTags(context.Background()).Tags([]string{"tag2"}).Execute() if err != nil { t.Fatalf("Error while getting pet by tag: %v", err) t.Log(r) @@ -146,8 +118,7 @@ func TestFindPetsByTag(t *testing.T) { } func TestFindPetsByStatus(t *testing.T) { - req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status([]string{"available"}) - resp, r, err := client.PetApi.FindPetsByStatusExecute(req) + resp, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status([]string{"available"}).Execute() if err != nil { t.Fatalf("Error while getting pet by id: %v", err) t.Log(r) @@ -173,8 +144,7 @@ func TestUploadFile(t *testing.T) { t.Fatalf("Error opening file: %v", err1) } - req := client.PetApi.UploadFileGetRequest(context.Background(), 12830).AdditionalMetadata("golang").File(file) - _, r, err := client.PetApi.UploadFileExecute(req) + _, r, err := client.PetApi.UploadFile(context.Background(), 12830).AdditionalMetadata("golang").File(file).Execute() if err != nil { t.Fatalf("Error while uploading file: %v", err) @@ -192,8 +162,7 @@ func TestUploadFileRequired(t *testing.T) { t.Fatalf("Error opening file: %v", err1) } - req := client.PetApi.UploadFileWithRequiredFileGetRequest(context.Background(), 12830).RequiredFile(file).AdditionalMetadata("golang") - _, r, err := client.PetApi.UploadFileWithRequiredFileExecute(req) + _, r, err := client.PetApi.UploadFileWithRequiredFile(context.Background(), 12830).RequiredFile(file).AdditionalMetadata("golang").Execute() if err != nil { t.Fatalf("Error while uploading file: %v", err) @@ -205,8 +174,7 @@ func TestUploadFileRequired(t *testing.T) { } func TestDeletePet(t *testing.T) { - req := client.PetApi.DeletePetGetRequest(context.Background(), 12830) - r, err := client.PetApi.DeletePetExecute(req) + r, err := client.PetApi.DeletePet(context.Background(), 12830).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -296,8 +264,7 @@ func waitOnFunctions(t *testing.T, errc chan error, n int) { } func deletePet(t *testing.T, id int64) { - req := client.PetApi.DeletePetGetRequest(context.Background(), id) - r, err := client.PetApi.DeletePetExecute(req) + r, err := client.PetApi.DeletePet(context.Background(), id).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -309,8 +276,7 @@ func deletePet(t *testing.T, id int64) { func isPetCorrect(t *testing.T, id int64, name string, status string) { assert := assert.New(t) - req := client.PetApi.GetPetByIdGetRequest(context.Background(), id) - resp, r, err := client.PetApi.GetPetByIdExecute(req) + resp, r, err := client.PetApi.GetPetById(context.Background(), id).Execute() if err != nil { t.Fatalf("Error while getting pet by id: %v", err) } else { diff --git a/samples/client/petstore/go-experimental/pom.xml b/samples/client/petstore/go-experimental/pom.xml index c3cff3da6fba..9c62bbb95543 100644 --- a/samples/client/petstore/go-experimental/pom.xml +++ b/samples/client/petstore/go-experimental/pom.xml @@ -68,20 +68,6 @@ - - go-get-gomock - pre-integration-test - - exec - - - go - - get - github.com/golang/mock/gomock - - - go-test integration-test diff --git a/samples/client/petstore/go-experimental/store_api_test.go b/samples/client/petstore/go-experimental/store_api_test.go index 93dc4fc1de29..f9f55273eb92 100644 --- a/samples/client/petstore/go-experimental/store_api_test.go +++ b/samples/client/petstore/go-experimental/store_api_test.go @@ -18,8 +18,7 @@ func TestPlaceOrder(t *testing.T) { Status: sw.PtrString("placed"), Complete: sw.PtrBool(false)} - req := client.StoreApi.PlaceOrderGetRequest(context.Background()).Body(newOrder) - _, r, err := client.StoreApi.PlaceOrderExecute(req) + _, r, err := client.StoreApi.PlaceOrder(context.Background()).Body(newOrder).Execute() if err != nil { // Skip parsing time error due to error in Petstore Test Server diff --git a/samples/client/petstore/go-experimental/user_api_test.go b/samples/client/petstore/go-experimental/user_api_test.go index d13f44fdd1c5..361e77ac9aa7 100644 --- a/samples/client/petstore/go-experimental/user_api_test.go +++ b/samples/client/petstore/go-experimental/user_api_test.go @@ -20,8 +20,7 @@ func TestCreateUser(t *testing.T) { Phone: sw.PtrString("5101112222"), UserStatus: sw.PtrInt32(1)} - req := client.UserApi.CreateUserGetRequest(context.Background()).Body(newUser) - apiResponse, err := client.UserApi.CreateUserExecute(req) + apiResponse, err := client.UserApi.CreateUser(context.Background()).Body(newUser).Execute() if err != nil { t.Fatalf("Error while adding user: %v", err) @@ -56,8 +55,7 @@ func TestCreateUsersWithArrayInput(t *testing.T) { }, } - req := client.UserApi.CreateUsersWithArrayInputGetRequest(context.Background()).Body(newUsers) - apiResponse, err := client.UserApi.CreateUsersWithArrayInputExecute(req) + apiResponse, err := client.UserApi.CreateUsersWithArrayInput(context.Background()).Body(newUsers).Execute() if err != nil { t.Fatalf("Error while adding users: %v", err) } @@ -83,8 +81,7 @@ func TestCreateUsersWithArrayInput(t *testing.T) { func TestGetUserByName(t *testing.T) { assert := assert.New(t) - req := client.UserApi.GetUserByNameGetRequest(context.Background(), "gopher") - resp, apiResponse, err := client.UserApi.GetUserByNameExecute(req) + resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher").Execute() if err != nil { t.Fatalf("Error while getting user by id: %v", err) } else { @@ -99,8 +96,7 @@ func TestGetUserByName(t *testing.T) { } func TestGetUserByNameWithInvalidID(t *testing.T) { - req := client.UserApi.GetUserByNameGetRequest(context.Background(), "999999999") - resp, apiResponse, err := client.UserApi.GetUserByNameExecute(req) + resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "999999999").Execute() if apiResponse != nil && apiResponse.StatusCode == 404 { return // This is a pass condition. API will return with a 404 error. } else if err != nil { @@ -127,8 +123,7 @@ func TestUpdateUser(t *testing.T) { Phone: sw.PtrString("5101112222"), UserStatus: sw.PtrInt32(1)} - updateReq := client.UserApi.UpdateUserGetRequest(context.Background(), "gopher").Body(newUser) - apiResponse, err := client.UserApi.UpdateUserExecute(updateReq) + apiResponse, err := client.UserApi.UpdateUser(context.Background(), "gopher").Body(newUser).Execute() if err != nil { t.Fatalf("Error while deleting user by id: %v", err) } @@ -137,8 +132,7 @@ func TestUpdateUser(t *testing.T) { } //verify changings are correct - getReq := client.UserApi.GetUserByNameGetRequest(context.Background(), "gopher") - resp, apiResponse, err := client.UserApi.GetUserByNameExecute(getReq) + resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher").Execute() if err != nil { t.Fatalf("Error while getting user by id: %v", err) } else { diff --git a/samples/openapi3/client/petstore/go-experimental/auth_test.go b/samples/openapi3/client/petstore/go-experimental/auth_test.go index 08f628707daa..aec544c2f26f 100644 --- a/samples/openapi3/client/petstore/go-experimental/auth_test.go +++ b/samples/openapi3/client/petstore/go-experimental/auth_test.go @@ -41,8 +41,7 @@ func TestOAuth2(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - addReq := client.PetApi.AddPetGetRequest(context.Background()).Pet(newPet) - r, err := client.PetApi.AddPetExecute(addReq) + r, err := client.PetApi.AddPet(context.Background()).Pet(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -51,8 +50,7 @@ func TestOAuth2(t *testing.T) { t.Log(r) } - delReq := client.PetApi.DeletePetGetRequest(auth, 12992) - r, err = client.PetApi.DeletePetExecute(delReq) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -78,8 +76,7 @@ func TestBasicAuth(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - addReq := client.PetApi.AddPetGetRequest(auth).Pet(newPet) - r, err := client.PetApi.AddPetExecute(addReq) + r, err := client.PetApi.AddPet(auth).Pet(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -88,8 +85,7 @@ func TestBasicAuth(t *testing.T) { t.Log(r) } - delReq := client.PetApi.DeletePetGetRequest(auth, 12992) - r, err = client.PetApi.DeletePetExecute(delReq) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -110,8 +106,7 @@ func TestAccessToken(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - addReq := client.PetApi.AddPetGetRequest(nil).Pet(newPet) - r, err := client.PetApi.AddPetExecute(addReq) + r, err := client.PetApi.AddPet(nil).Pet(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -120,8 +115,7 @@ func TestAccessToken(t *testing.T) { t.Log(r) } - delReq := client.PetApi.DeletePetGetRequest(auth, 12992) - r, err = client.PetApi.DeletePetExecute(delReq) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -142,8 +136,7 @@ func TestAPIKeyNoPrefix(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - addReq := client.PetApi.AddPetGetRequest(context.Background()).Pet(newPet) - r, err := client.PetApi.AddPetExecute(addReq) + r, err := client.PetApi.AddPet(context.Background()).Pet(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -152,8 +145,7 @@ func TestAPIKeyNoPrefix(t *testing.T) { t.Log(r) } - getReq := client.PetApi.GetPetByIdGetRequest(auth, 12992) - _, r, err = client.PetApi.GetPetByIdExecute(getReq) + _, r, err = client.PetApi.GetPetById(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -163,8 +155,7 @@ func TestAPIKeyNoPrefix(t *testing.T) { t.Errorf("APIKey Authentication is missing") } - delReq := client.PetApi.DeletePetGetRequest(auth, 12992) - r, err = client.PetApi.DeletePetExecute(delReq) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -180,8 +171,7 @@ func TestAPIKeyWithPrefix(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - addReq := client.PetApi.AddPetGetRequest(nil).Pet(newPet) - r, err := client.PetApi.AddPetExecute(addReq) + r, err := client.PetApi.AddPet(nil).Pet(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -190,8 +180,7 @@ func TestAPIKeyWithPrefix(t *testing.T) { t.Log(r) } - getReq := client.PetApi.GetPetByIdGetRequest(auth, 12992) - _, r, err = client.PetApi.GetPetByIdExecute(getReq) + _, r, err = client.PetApi.GetPetById(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -201,8 +190,7 @@ func TestAPIKeyWithPrefix(t *testing.T) { t.Errorf("APIKey Authentication is missing") } - delReq := client.PetApi.DeletePetGetRequest(auth, 12992) - r, err = client.PetApi.DeletePetExecute(delReq) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -216,8 +204,7 @@ func TestDefaultHeader(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - addReq := client.PetApi.AddPetGetRequest(context.Background()).Pet(newPet) - r, err := client.PetApi.AddPetExecute(addReq) + r, err := client.PetApi.AddPet(context.Background()).Pet(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -226,8 +213,7 @@ func TestDefaultHeader(t *testing.T) { t.Log(r) } - delReq := client.PetApi.DeletePetGetRequest(context.Background(), 12992) - r, err = client.PetApi.DeletePetExecute(delReq) + r, err = client.PetApi.DeletePet(context.Background(), 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -242,8 +228,7 @@ func TestDefaultHeader(t *testing.T) { } func TestHostOverride(t *testing.T) { - req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status(nil) - _, r, err := client.PetApi.FindPetsByStatusExecute(req) + _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute() if err != nil { t.Fatalf("Error while finding pets by status: %v", err) @@ -255,8 +240,7 @@ func TestHostOverride(t *testing.T) { } func TestSchemeOverride(t *testing.T) { - req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status(nil) - _, r, err := client.PetApi.FindPetsByStatusExecute(req) + _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute() if err != nil { t.Fatalf("Error while finding pets by status: %v", err) diff --git a/samples/openapi3/client/petstore/go-experimental/fake_api_test.go b/samples/openapi3/client/petstore/go-experimental/fake_api_test.go index 01a67d6c44b9..97910bf3cf7b 100644 --- a/samples/openapi3/client/petstore/go-experimental/fake_api_test.go +++ b/samples/openapi3/client/petstore/go-experimental/fake_api_test.go @@ -17,8 +17,7 @@ func TestPutBodyWithFileSchema(t *testing.T) { File: &sw.File{SourceURI: sw.PtrString("https://example.com/image.png")}, Files: &[]sw.File{{SourceURI: sw.PtrString("https://example.com/image.png")}}} - req := client.FakeApi.TestBodyWithFileSchemaGetRequest(context.Background()).FileSchemaTestClass(schema) - r, err := client.FakeApi.TestBodyWithFileSchemaExecute(req) + r, err := client.FakeApi.TestBodyWithFileSchema(context.Background()).FileSchemaTestClass(schema).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) diff --git a/samples/openapi3/client/petstore/go-experimental/http_signature_test.go b/samples/openapi3/client/petstore/go-experimental/http_signature_test.go index ba87c6eeb6f9..6348599111a6 100644 --- a/samples/openapi3/client/petstore/go-experimental/http_signature_test.go +++ b/samples/openapi3/client/petstore/go-experimental/http_signature_test.go @@ -281,8 +281,7 @@ func executeHttpSignatureAuth(t *testing.T, authConfig *sw.HttpSignatureAuth, ex fmt.Printf("Request with HTTP signature. Scheme: '%s'. Algorithm: '%s'. MaxValidity: %v. Headers: '%v'\n", authConfig.SigningScheme, authConfig.SigningAlgorithm, authConfig.SignatureMaxValidity, authConfig.SignedHeaders) - addReq := apiClient.PetApi.AddPetGetRequest(authCtx).Pet(newPet) - r, err2 := apiClient.PetApi.AddPetExecute(addReq) + r, err2 := apiClient.PetApi.AddPet(authCtx).Pet(newPet).Execute() if expectSuccess && err2 != nil { t.Fatalf("Error while adding pet: %v", err2) } @@ -298,8 +297,7 @@ func executeHttpSignatureAuth(t *testing.T, authConfig *sw.HttpSignatureAuth, ex t.Log(r) } - getReq := apiClient.PetApi.GetPetByIdGetRequest(authCtx, 12992) - _, r, err = apiClient.PetApi.GetPetByIdExecute(getReq) + _, r, err = apiClient.PetApi.GetPetById(authCtx, 12992).Execute() if expectSuccess && err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } diff --git a/samples/openapi3/client/petstore/go-experimental/pet_api_test.go b/samples/openapi3/client/petstore/go-experimental/pet_api_test.go index fb609c50eefb..9f0a154f96a0 100644 --- a/samples/openapi3/client/petstore/go-experimental/pet_api_test.go +++ b/samples/openapi3/client/petstore/go-experimental/pet_api_test.go @@ -31,8 +31,7 @@ func TestAddPet(t *testing.T) { PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}}) - req := client.PetApi.AddPetGetRequest(context.Background()).Pet(newPet) - r, err := client.PetApi.AddPetExecute(req) + r, err := client.PetApi.AddPet(context.Background()).Pet(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -43,8 +42,7 @@ func TestAddPet(t *testing.T) { } func TestFindPetsByStatusWithMissingParam(t *testing.T) { - req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status(nil) - _, r, err := client.PetApi.FindPetsByStatusExecute(req) + _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute() if err != nil { t.Fatalf("Error while testing TestFindPetsByStatusWithMissingParam: %v", err) @@ -59,8 +57,7 @@ func TestGetPetById(t *testing.T) { } func TestGetPetByIdWithInvalidID(t *testing.T) { - req := client.PetApi.GetPetByIdGetRequest(context.Background(), 999999999) - resp, r, err := client.PetApi.GetPetByIdExecute(req) + resp, r, err := client.PetApi.GetPetById(context.Background(), 999999999).Execute() if r != nil && r.StatusCode == 404 { assertedError, ok := err.(sw.GenericOpenAPIError) a := assert.New(t) @@ -77,8 +74,7 @@ func TestGetPetByIdWithInvalidID(t *testing.T) { } func TestUpdatePetWithForm(t *testing.T) { - req := client.PetApi.UpdatePetWithFormGetRequest(context.Background(), 12830).Name("golang").Status("available") - r, err := client.PetApi.UpdatePetWithFormExecute(req) + r, err := client.PetApi.UpdatePetWithForm(context.Background(), 12830).Name("golang").Status("available").Execute() if err != nil { t.Fatalf("Error while updating pet by id: %v", err) t.Log(r) @@ -93,8 +89,7 @@ func TestUpdatePetWithForm(t *testing.T) { func TestFindPetsByTag(t *testing.T) { var found = false - req := client.PetApi.FindPetsByTagsGetRequest(context.Background()).Tags([]string{"tag2"}) - resp, r, err := client.PetApi.FindPetsByTagsExecute(req) + resp, r, err := client.PetApi.FindPetsByTags(context.Background()).Tags([]string{"tag2"}).Execute() if err != nil { t.Fatalf("Error while getting pet by tag: %v", err) t.Log(r) @@ -123,8 +118,7 @@ func TestFindPetsByTag(t *testing.T) { } func TestFindPetsByStatus(t *testing.T) { - req := client.PetApi.FindPetsByStatusGetRequest(context.Background()).Status([]string{"available"}) - resp, r, err := client.PetApi.FindPetsByStatusExecute(req) + resp, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status([]string{"available"}).Execute() if err != nil { t.Fatalf("Error while getting pet by id: %v", err) t.Log(r) @@ -150,8 +144,7 @@ func TestUploadFile(t *testing.T) { t.Fatalf("Error opening file: %v", err1) } - req := client.PetApi.UploadFileGetRequest(context.Background(), 12830).AdditionalMetadata("golang").File(file) - _, r, err := client.PetApi.UploadFileExecute(req) + _, r, err := client.PetApi.UploadFile(context.Background(), 12830).AdditionalMetadata("golang").File(file).Execute() if err != nil { t.Fatalf("Error while uploading file: %v", err) @@ -169,8 +162,7 @@ func TestUploadFileRequired(t *testing.T) { t.Fatalf("Error opening file: %v", err1) } - req := client.PetApi.UploadFileWithRequiredFileGetRequest(context.Background(), 12830).RequiredFile(file).AdditionalMetadata("golang") - _, r, err := client.PetApi.UploadFileWithRequiredFileExecute(req) + _, r, err := client.PetApi.UploadFileWithRequiredFile(context.Background(), 12830).RequiredFile(file).AdditionalMetadata("golang").Execute() if err != nil { t.Fatalf("Error while uploading file: %v", err) @@ -182,8 +174,7 @@ func TestUploadFileRequired(t *testing.T) { } func TestDeletePet(t *testing.T) { - req := client.PetApi.DeletePetGetRequest(context.Background(), 12830) - r, err := client.PetApi.DeletePetExecute(req) + r, err := client.PetApi.DeletePet(context.Background(), 12830).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -273,8 +264,7 @@ func waitOnFunctions(t *testing.T, errc chan error, n int) { } func deletePet(t *testing.T, id int64) { - req := client.PetApi.DeletePetGetRequest(context.Background(), id) - r, err := client.PetApi.DeletePetExecute(req) + r, err := client.PetApi.DeletePet(context.Background(), id).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -286,8 +276,7 @@ func deletePet(t *testing.T, id int64) { func isPetCorrect(t *testing.T, id int64, name string, status string) { assert := assert.New(t) - req := client.PetApi.GetPetByIdGetRequest(context.Background(), id) - resp, r, err := client.PetApi.GetPetByIdExecute(req) + resp, r, err := client.PetApi.GetPetById(context.Background(), id).Execute() if err != nil { t.Fatalf("Error while getting pet by id: %v", err) } else { diff --git a/samples/openapi3/client/petstore/go-experimental/store_api_test.go b/samples/openapi3/client/petstore/go-experimental/store_api_test.go index e222aed6880c..fc0cdec9699a 100644 --- a/samples/openapi3/client/petstore/go-experimental/store_api_test.go +++ b/samples/openapi3/client/petstore/go-experimental/store_api_test.go @@ -18,8 +18,7 @@ func TestPlaceOrder(t *testing.T) { Status: sw.PtrString("placed"), Complete: sw.PtrBool(false)} - req := client.StoreApi.PlaceOrderGetRequest(context.Background()).Order(newOrder) - _, r, err := client.StoreApi.PlaceOrderExecute(req) + _, r, err := client.StoreApi.PlaceOrder(context.Background()).Order(newOrder).Execute() if err != nil { // Skip parsing time error due to error in Petstore Test Server diff --git a/samples/openapi3/client/petstore/go-experimental/user_api_test.go b/samples/openapi3/client/petstore/go-experimental/user_api_test.go index 3f83666d1fcc..ef66e2410c06 100644 --- a/samples/openapi3/client/petstore/go-experimental/user_api_test.go +++ b/samples/openapi3/client/petstore/go-experimental/user_api_test.go @@ -20,8 +20,7 @@ func TestCreateUser(t *testing.T) { Phone: sw.PtrString("5101112222"), UserStatus: sw.PtrInt32(1)} - req := client.UserApi.CreateUserGetRequest(context.Background()).User(newUser) - apiResponse, err := client.UserApi.CreateUserExecute(req) + apiResponse, err := client.UserApi.CreateUser(context.Background()).User(newUser).Execute() if err != nil { t.Fatalf("Error while adding user: %v", err) @@ -56,8 +55,7 @@ func TestCreateUsersWithArrayInput(t *testing.T) { }, } - req := client.UserApi.CreateUsersWithArrayInputGetRequest(context.Background()).User(newUsers) - apiResponse, err := client.UserApi.CreateUsersWithArrayInputExecute(req) + apiResponse, err := client.UserApi.CreateUsersWithArrayInput(context.Background()).User(newUsers).Execute() if err != nil { t.Fatalf("Error while adding users: %v", err) } @@ -84,8 +82,7 @@ func TestCreateUsersWithArrayInput(t *testing.T) { func TestGetUserByName(t *testing.T) { assert := assert.New(t) - req := client.UserApi.GetUserByNameGetRequest(context.Background(), "gopher") - resp, apiResponse, err := client.UserApi.GetUserByNameExecute(req) + resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher").Execute() if err != nil { t.Fatalf("Error while getting user by id: %v", err) } else { @@ -100,8 +97,7 @@ func TestGetUserByName(t *testing.T) { } func TestGetUserByNameWithInvalidID(t *testing.T) { - req := client.UserApi.GetUserByNameGetRequest(context.Background(), "999999999") - resp, apiResponse, err := client.UserApi.GetUserByNameExecute(req) + resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "999999999").Execute() if apiResponse != nil && apiResponse.StatusCode == 404 { return // This is a pass condition. API will return with a 404 error. } else if err != nil { @@ -128,8 +124,7 @@ func TestUpdateUser(t *testing.T) { Phone: sw.PtrString("5101112222"), UserStatus: sw.PtrInt32(1)} - updateReq := client.UserApi.UpdateUserGetRequest(context.Background(), "gopher").User(newUser) - apiResponse, err := client.UserApi.UpdateUserExecute(updateReq) + apiResponse, err := client.UserApi.UpdateUser(context.Background(), "gopher").User(newUser).Execute() if err != nil { t.Fatalf("Error while deleting user by id: %v", err) } @@ -138,8 +133,7 @@ func TestUpdateUser(t *testing.T) { } //verify changings are correct - getReq := client.UserApi.GetUserByNameGetRequest(context.Background(), "gopher") - resp, apiResponse, err := client.UserApi.GetUserByNameExecute(getReq) + resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher").Execute() if err != nil { t.Fatalf("Error while getting user by id: %v", err) } else { From 339849280b61ec9e063436dd8fe04ee6d6898430 Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Sat, 22 Aug 2020 07:49:46 -0500 Subject: [PATCH 13/16] Address PR comments: fix backward incompatibility in templates - add Execute redirection from request back up to service --- .../resources/go-experimental/api.mustache | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/go-experimental/api.mustache b/modules/openapi-generator/src/main/resources/go-experimental/api.mustache index e48ae14fdd87..d1512c9b4101 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/api.mustache +++ b/modules/openapi-generator/src/main/resources/go-experimental/api.mustache @@ -15,10 +15,11 @@ import ( var ( _ _context.Context ) - {{#generateInterfaces}} - type {{classname}} interface { + +type {{classname}} interface { {{#operation}} + /* * {{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} {{#notes}} @@ -26,35 +27,43 @@ var ( {{/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 + * @return Api{{operationId}}Request */ - {{{nickname}}}GetRequest(ctx _context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) Api{{operationId}}Request + {{{nickname}}}(ctx _context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) Api{{operationId}}Request /* - * Execute executes the request{{#returnType}} + * {{nickname}}Execute executes the request{{#returnType}} * @return {{{.}}}{{/returnType}} */ {{nickname}}Execute(r Api{{operationId}}Request) ({{#returnType}}{{{.}}}, {{/returnType}}*_nethttp.Response, error) - {{/operation}} - } - +} {{/generateInterfaces}} + // {{classname}}Service {{classname}} service type {{classname}}Service service - {{#operation}} + type Api{{operationId}}Request struct { - ctx _context.Context{{#allParams}} - {{paramName}} {{^isPathParam}}*{{/isPathParam}}{{{dataType}}}{{/allParams}} + ctx _context.Context{{#generateInterfaces}} + ApiService {{classname}} +{{/generateInterfaces}}{{^generateInterfaces}} + ApiService *{{classname}}Service +{{/generateInterfaces}} +{{#allParams}} + {{paramName}} {{^isPathParam}}*{{/isPathParam}}{{{dataType}}} +{{/allParams}} } - {{#allParams}}{{^isPathParam}} func (r Api{{operationId}}Request) {{vendorExtensions.x-export-param-name}}({{paramName}} {{{dataType}}}) Api{{operationId}}Request { r.{{paramName}} = &{{paramName}} return r +}{{/isPathParam}}{{/allParams}} + +func (r Api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnType}}*_nethttp.Response, error) { + return r.ApiService.{{nickname}}Execute(r) } -{{/isPathParam}}{{/allParams}} + /* * {{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} {{#notes}} @@ -62,10 +71,11 @@ func (r Api{{operationId}}Request) {{vendorExtensions.x-export-param-name}}({{pa {{/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 + * @return Api{{operationId}}Request */ -func (a *{{{classname}}}Service) {{{nickname}}}GetRequest(ctx _context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) 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}} } From 4945c11ac779c829d1f7ee25da749ae9a9de69b8 Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Sun, 23 Aug 2020 08:11:37 -0500 Subject: [PATCH 14/16] Regenerate go-experimental/oas2 samples w/o interfaces --- .../go-petstore/api_another_fake.go | 28 +- .../go-experimental/go-petstore/api_fake.go | 357 +++++++----------- .../go-petstore/api_fake_classname_tags123.go | 28 +- .../go-experimental/go-petstore/api_pet.go | 231 +++++------- .../go-experimental/go-petstore/api_store.go | 106 ++---- .../go-experimental/go-petstore/api_user.go | 202 ++++------ .../go-experimental/go-petstore/client.go | 12 +- .../go-petstore/api_another_fake.go | 11 +- .../go-petstore/api_default.go | 11 +- .../go-experimental/go-petstore/api_fake.go | 169 +++++++-- .../go-petstore/api_fake_classname_tags123.go | 11 +- .../go-experimental/go-petstore/api_pet.go | 107 +++++- .../go-experimental/go-petstore/api_store.go | 47 ++- .../go-experimental/go-petstore/api_user.go | 95 ++++- 14 files changed, 744 insertions(+), 671 deletions(-) diff --git a/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go index 64bdce19dbea..7c30fb4ae74c 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go @@ -21,28 +21,12 @@ var ( _ _context.Context ) - type AnotherFakeApi interface { - /* - * 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 - */ - Call123TestSpecialTagsGetRequest(ctx _context.Context) ApiCall123TestSpecialTagsRequest - - /* - * Execute executes the request - * @return Client - */ - Call123TestSpecialTagsExecute(r ApiCall123TestSpecialTagsRequest) (Client, *_nethttp.Response, error) - - } - // AnotherFakeApiService AnotherFakeApi service type AnotherFakeApiService service type ApiCall123TestSpecialTagsRequest struct { ctx _context.Context + ApiService *AnotherFakeApiService body *Client } @@ -50,14 +34,20 @@ func (r ApiCall123TestSpecialTagsRequest) Body(body Client) ApiCall123TestSpecia r.body = &body return r } + +func (r ApiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, error) { + return r.ApiService.Call123TestSpecialTagsExecute(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 + * @return ApiCall123TestSpecialTagsRequest */ -func (a *AnotherFakeApiService) Call123TestSpecialTagsGetRequest(ctx _context.Context) ApiCall123TestSpecialTagsRequest { +func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context) ApiCall123TestSpecialTagsRequest { return ApiCall123TestSpecialTagsRequest{ + ApiService: a, ctx: ctx, } } diff --git a/samples/client/petstore/go-experimental/go-petstore/api_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_fake.go index b2c0acfc2990..34e82339599c 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_fake.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_fake.go @@ -24,201 +24,12 @@ var ( _ _context.Context ) - type FakeApi interface { - /* - * 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 - */ - CreateXmlItemGetRequest(ctx _context.Context) ApiCreateXmlItemRequest - - /* - * Execute executes the request - */ - CreateXmlItemExecute(r ApiCreateXmlItemRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - FakeOuterBooleanSerializeGetRequest(ctx _context.Context) ApiFakeOuterBooleanSerializeRequest - - /* - * Execute executes the request - * @return bool - */ - FakeOuterBooleanSerializeExecute(r ApiFakeOuterBooleanSerializeRequest) (bool, *_nethttp.Response, error) - - /* - * 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 - */ - FakeOuterCompositeSerializeGetRequest(ctx _context.Context) ApiFakeOuterCompositeSerializeRequest - - /* - * Execute executes the request - * @return OuterComposite - */ - FakeOuterCompositeSerializeExecute(r ApiFakeOuterCompositeSerializeRequest) (OuterComposite, *_nethttp.Response, error) - - /* - * 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 - */ - FakeOuterNumberSerializeGetRequest(ctx _context.Context) ApiFakeOuterNumberSerializeRequest - - /* - * Execute executes the request - * @return float32 - */ - FakeOuterNumberSerializeExecute(r ApiFakeOuterNumberSerializeRequest) (float32, *_nethttp.Response, error) - - /* - * 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 - */ - FakeOuterStringSerializeGetRequest(ctx _context.Context) ApiFakeOuterStringSerializeRequest - - /* - * Execute executes the request - * @return string - */ - FakeOuterStringSerializeExecute(r ApiFakeOuterStringSerializeRequest) (string, *_nethttp.Response, error) - - /* - * 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 - */ - TestBodyWithFileSchemaGetRequest(ctx _context.Context) ApiTestBodyWithFileSchemaRequest - - /* - * Execute executes the request - */ - TestBodyWithFileSchemaExecute(r ApiTestBodyWithFileSchemaRequest) (*_nethttp.Response, error) - - /* - * TestBodyWithQueryParams Method for TestBodyWithQueryParams - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return apiTestBodyWithQueryParamsRequest - */ - TestBodyWithQueryParamsGetRequest(ctx _context.Context) ApiTestBodyWithQueryParamsRequest - - /* - * Execute executes the request - */ - TestBodyWithQueryParamsExecute(r ApiTestBodyWithQueryParamsRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - TestClientModelGetRequest(ctx _context.Context) ApiTestClientModelRequest - - /* - * Execute executes the request - * @return Client - */ - TestClientModelExecute(r ApiTestClientModelRequest) (Client, *_nethttp.Response, error) - - /* - * 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 - */ - TestEndpointParametersGetRequest(ctx _context.Context) ApiTestEndpointParametersRequest - - /* - * Execute executes the request - */ - TestEndpointParametersExecute(r ApiTestEndpointParametersRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - TestEnumParametersGetRequest(ctx _context.Context) ApiTestEnumParametersRequest - - /* - * Execute executes the request - */ - TestEnumParametersExecute(r ApiTestEnumParametersRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - TestGroupParametersGetRequest(ctx _context.Context) ApiTestGroupParametersRequest - - /* - * Execute executes the request - */ - TestGroupParametersExecute(r ApiTestGroupParametersRequest) (*_nethttp.Response, error) - - /* - * TestInlineAdditionalProperties test inline additionalProperties - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return apiTestInlineAdditionalPropertiesRequest - */ - TestInlineAdditionalPropertiesGetRequest(ctx _context.Context) ApiTestInlineAdditionalPropertiesRequest - - /* - * Execute executes the request - */ - TestInlineAdditionalPropertiesExecute(r ApiTestInlineAdditionalPropertiesRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - TestJsonFormDataGetRequest(ctx _context.Context) ApiTestJsonFormDataRequest - - /* - * Execute executes the request - */ - TestJsonFormDataExecute(r ApiTestJsonFormDataRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - TestQueryParameterCollectionFormatGetRequest(ctx _context.Context) ApiTestQueryParameterCollectionFormatRequest - - /* - * Execute executes the request - */ - TestQueryParameterCollectionFormatExecute(r ApiTestQueryParameterCollectionFormatRequest) (*_nethttp.Response, error) - - } - // FakeApiService FakeApi service type FakeApiService service type ApiCreateXmlItemRequest struct { ctx _context.Context + ApiService *FakeApiService xmlItem *XmlItem } @@ -226,14 +37,20 @@ func (r ApiCreateXmlItemRequest) XmlItem(xmlItem XmlItem) ApiCreateXmlItemReques r.xmlItem = &xmlItem return r } + +func (r ApiCreateXmlItemRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.CreateXmlItemExecute(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 + * @return ApiCreateXmlItemRequest */ -func (a *FakeApiService) CreateXmlItemGetRequest(ctx _context.Context) ApiCreateXmlItemRequest { +func (a *FakeApiService) CreateXmlItem(ctx _context.Context) ApiCreateXmlItemRequest { return ApiCreateXmlItemRequest{ + ApiService: a, ctx: ctx, } } @@ -309,8 +126,10 @@ func (a *FakeApiService) CreateXmlItemExecute(r ApiCreateXmlItemRequest) (*_neth return localVarHTTPResponse, nil } + type ApiFakeOuterBooleanSerializeRequest struct { ctx _context.Context + ApiService *FakeApiService body *bool } @@ -318,14 +137,20 @@ func (r ApiFakeOuterBooleanSerializeRequest) Body(body bool) ApiFakeOuterBoolean r.body = &body return r } + +func (r ApiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response, error) { + return r.ApiService.FakeOuterBooleanSerializeExecute(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 + * @return ApiFakeOuterBooleanSerializeRequest */ -func (a *FakeApiService) FakeOuterBooleanSerializeGetRequest(ctx _context.Context) ApiFakeOuterBooleanSerializeRequest { +func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context) ApiFakeOuterBooleanSerializeRequest { return ApiFakeOuterBooleanSerializeRequest{ + ApiService: a, ctx: ctx, } } @@ -409,8 +234,10 @@ func (a *FakeApiService) FakeOuterBooleanSerializeExecute(r ApiFakeOuterBooleanS return localVarReturnValue, localVarHTTPResponse, nil } + type ApiFakeOuterCompositeSerializeRequest struct { ctx _context.Context + ApiService *FakeApiService body *OuterComposite } @@ -418,14 +245,20 @@ func (r ApiFakeOuterCompositeSerializeRequest) Body(body OuterComposite) ApiFake r.body = &body return r } + +func (r ApiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_nethttp.Response, error) { + return r.ApiService.FakeOuterCompositeSerializeExecute(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 + * @return ApiFakeOuterCompositeSerializeRequest */ -func (a *FakeApiService) FakeOuterCompositeSerializeGetRequest(ctx _context.Context) ApiFakeOuterCompositeSerializeRequest { +func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context) ApiFakeOuterCompositeSerializeRequest { return ApiFakeOuterCompositeSerializeRequest{ + ApiService: a, ctx: ctx, } } @@ -509,8 +342,10 @@ func (a *FakeApiService) FakeOuterCompositeSerializeExecute(r ApiFakeOuterCompos return localVarReturnValue, localVarHTTPResponse, nil } + type ApiFakeOuterNumberSerializeRequest struct { ctx _context.Context + ApiService *FakeApiService body *float32 } @@ -518,14 +353,20 @@ func (r ApiFakeOuterNumberSerializeRequest) Body(body float32) ApiFakeOuterNumbe r.body = &body return r } + +func (r ApiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Response, error) { + return r.ApiService.FakeOuterNumberSerializeExecute(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 + * @return ApiFakeOuterNumberSerializeRequest */ -func (a *FakeApiService) FakeOuterNumberSerializeGetRequest(ctx _context.Context) ApiFakeOuterNumberSerializeRequest { +func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context) ApiFakeOuterNumberSerializeRequest { return ApiFakeOuterNumberSerializeRequest{ + ApiService: a, ctx: ctx, } } @@ -609,8 +450,10 @@ func (a *FakeApiService) FakeOuterNumberSerializeExecute(r ApiFakeOuterNumberSer return localVarReturnValue, localVarHTTPResponse, nil } + type ApiFakeOuterStringSerializeRequest struct { ctx _context.Context + ApiService *FakeApiService body *string } @@ -618,14 +461,20 @@ func (r ApiFakeOuterStringSerializeRequest) Body(body string) ApiFakeOuterString r.body = &body return r } + +func (r ApiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Response, error) { + return r.ApiService.FakeOuterStringSerializeExecute(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 + * @return ApiFakeOuterStringSerializeRequest */ -func (a *FakeApiService) FakeOuterStringSerializeGetRequest(ctx _context.Context) ApiFakeOuterStringSerializeRequest { +func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context) ApiFakeOuterStringSerializeRequest { return ApiFakeOuterStringSerializeRequest{ + ApiService: a, ctx: ctx, } } @@ -709,8 +558,10 @@ func (a *FakeApiService) FakeOuterStringSerializeExecute(r ApiFakeOuterStringSer return localVarReturnValue, localVarHTTPResponse, nil } + type ApiTestBodyWithFileSchemaRequest struct { ctx _context.Context + ApiService *FakeApiService body *FileSchemaTestClass } @@ -718,14 +569,20 @@ func (r ApiTestBodyWithFileSchemaRequest) Body(body FileSchemaTestClass) ApiTest r.body = &body return r } + +func (r ApiTestBodyWithFileSchemaRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestBodyWithFileSchemaExecute(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 + * @return ApiTestBodyWithFileSchemaRequest */ -func (a *FakeApiService) TestBodyWithFileSchemaGetRequest(ctx _context.Context) ApiTestBodyWithFileSchemaRequest { +func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context) ApiTestBodyWithFileSchemaRequest { return ApiTestBodyWithFileSchemaRequest{ + ApiService: a, ctx: ctx, } } @@ -801,8 +658,10 @@ func (a *FakeApiService) TestBodyWithFileSchemaExecute(r ApiTestBodyWithFileSche return localVarHTTPResponse, nil } + type ApiTestBodyWithQueryParamsRequest struct { ctx _context.Context + ApiService *FakeApiService query *string body *User } @@ -815,13 +674,19 @@ func (r ApiTestBodyWithQueryParamsRequest) Body(body User) ApiTestBodyWithQueryP r.body = &body return r } + +func (r ApiTestBodyWithQueryParamsRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestBodyWithQueryParamsExecute(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 + * @return ApiTestBodyWithQueryParamsRequest */ -func (a *FakeApiService) TestBodyWithQueryParamsGetRequest(ctx _context.Context) ApiTestBodyWithQueryParamsRequest { +func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context) ApiTestBodyWithQueryParamsRequest { return ApiTestBodyWithQueryParamsRequest{ + ApiService: a, ctx: ctx, } } @@ -901,8 +766,10 @@ func (a *FakeApiService) TestBodyWithQueryParamsExecute(r ApiTestBodyWithQueryPa return localVarHTTPResponse, nil } + type ApiTestClientModelRequest struct { ctx _context.Context + ApiService *FakeApiService body *Client } @@ -910,14 +777,20 @@ func (r ApiTestClientModelRequest) Body(body Client) ApiTestClientModelRequest { r.body = &body return r } + +func (r ApiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) { + return r.ApiService.TestClientModelExecute(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 + * @return ApiTestClientModelRequest */ -func (a *FakeApiService) TestClientModelGetRequest(ctx _context.Context) ApiTestClientModelRequest { +func (a *FakeApiService) TestClientModel(ctx _context.Context) ApiTestClientModelRequest { return ApiTestClientModelRequest{ + ApiService: a, ctx: ctx, } } @@ -1004,8 +877,10 @@ func (a *FakeApiService) TestClientModelExecute(r ApiTestClientModelRequest) (Cl return localVarReturnValue, localVarHTTPResponse, nil } + type ApiTestEndpointParametersRequest struct { ctx _context.Context + ApiService *FakeApiService number *float32 double *float64 patternWithoutDelimiter *string @@ -1078,6 +953,11 @@ func (r ApiTestEndpointParametersRequest) Callback(callback string) ApiTestEndpo r.callback = &callback return r } + +func (r ApiTestEndpointParametersRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestEndpointParametersExecute(r) +} + /* * TestEndpointParameters Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Fake endpoint for testing various parameters @@ -1085,10 +965,11 @@ func (r ApiTestEndpointParametersRequest) Callback(callback string) ApiTestEndpo 偽のエンドポイント 가짜 엔드 포인트 * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return apiTestEndpointParametersRequest + * @return ApiTestEndpointParametersRequest */ -func (a *FakeApiService) TestEndpointParametersGetRequest(ctx _context.Context) ApiTestEndpointParametersRequest { +func (a *FakeApiService) TestEndpointParameters(ctx _context.Context) ApiTestEndpointParametersRequest { return ApiTestEndpointParametersRequest{ + ApiService: a, ctx: ctx, } } @@ -1225,8 +1106,10 @@ func (a *FakeApiService) TestEndpointParametersExecute(r ApiTestEndpointParamete return localVarHTTPResponse, nil } + type ApiTestEnumParametersRequest struct { ctx _context.Context + ApiService *FakeApiService enumHeaderStringArray *[]string enumHeaderString *string enumQueryStringArray *[]string @@ -1269,14 +1152,20 @@ func (r ApiTestEnumParametersRequest) EnumFormString(enumFormString string) ApiT r.enumFormString = &enumFormString return r } + +func (r ApiTestEnumParametersRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestEnumParametersExecute(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 + * @return ApiTestEnumParametersRequest */ -func (a *FakeApiService) TestEnumParametersGetRequest(ctx _context.Context) ApiTestEnumParametersRequest { +func (a *FakeApiService) TestEnumParameters(ctx _context.Context) ApiTestEnumParametersRequest { return ApiTestEnumParametersRequest{ + ApiService: a, ctx: ctx, } } @@ -1371,8 +1260,10 @@ func (a *FakeApiService) TestEnumParametersExecute(r ApiTestEnumParametersReques return localVarHTTPResponse, nil } + type ApiTestGroupParametersRequest struct { ctx _context.Context + ApiService *FakeApiService requiredStringGroup *int32 requiredBooleanGroup *bool requiredInt64Group *int64 @@ -1405,14 +1296,20 @@ func (r ApiTestGroupParametersRequest) Int64Group(int64Group int64) ApiTestGroup r.int64Group = &int64Group return r } + +func (r ApiTestGroupParametersRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestGroupParametersExecute(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 + * @return ApiTestGroupParametersRequest */ -func (a *FakeApiService) TestGroupParametersGetRequest(ctx _context.Context) ApiTestGroupParametersRequest { +func (a *FakeApiService) TestGroupParameters(ctx _context.Context) ApiTestGroupParametersRequest { return ApiTestGroupParametersRequest{ + ApiService: a, ctx: ctx, } } @@ -1504,8 +1401,10 @@ func (a *FakeApiService) TestGroupParametersExecute(r ApiTestGroupParametersRequ return localVarHTTPResponse, nil } + type ApiTestInlineAdditionalPropertiesRequest struct { ctx _context.Context + ApiService *FakeApiService param *map[string]string } @@ -1513,13 +1412,19 @@ func (r ApiTestInlineAdditionalPropertiesRequest) Param(param map[string]string) r.param = ¶m return r } + +func (r ApiTestInlineAdditionalPropertiesRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestInlineAdditionalPropertiesExecute(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 + * @return ApiTestInlineAdditionalPropertiesRequest */ -func (a *FakeApiService) TestInlineAdditionalPropertiesGetRequest(ctx _context.Context) ApiTestInlineAdditionalPropertiesRequest { +func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context) ApiTestInlineAdditionalPropertiesRequest { return ApiTestInlineAdditionalPropertiesRequest{ + ApiService: a, ctx: ctx, } } @@ -1595,8 +1500,10 @@ func (a *FakeApiService) TestInlineAdditionalPropertiesExecute(r ApiTestInlineAd return localVarHTTPResponse, nil } + type ApiTestJsonFormDataRequest struct { ctx _context.Context + ApiService *FakeApiService param *string param2 *string } @@ -1609,13 +1516,19 @@ func (r ApiTestJsonFormDataRequest) Param2(param2 string) ApiTestJsonFormDataReq r.param2 = ¶m2 return r } + +func (r ApiTestJsonFormDataRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestJsonFormDataExecute(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 + * @return ApiTestJsonFormDataRequest */ -func (a *FakeApiService) TestJsonFormDataGetRequest(ctx _context.Context) ApiTestJsonFormDataRequest { +func (a *FakeApiService) TestJsonFormData(ctx _context.Context) ApiTestJsonFormDataRequest { return ApiTestJsonFormDataRequest{ + ApiService: a, ctx: ctx, } } @@ -1694,8 +1607,10 @@ func (a *FakeApiService) TestJsonFormDataExecute(r ApiTestJsonFormDataRequest) ( return localVarHTTPResponse, nil } + type ApiTestQueryParameterCollectionFormatRequest struct { ctx _context.Context + ApiService *FakeApiService pipe *[]string ioutil *[]string http *[]string @@ -1723,14 +1638,20 @@ func (r ApiTestQueryParameterCollectionFormatRequest) Context(context []string) r.context = &context return r } + +func (r ApiTestQueryParameterCollectionFormatRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestQueryParameterCollectionFormatExecute(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 + * @return ApiTestQueryParameterCollectionFormatRequest */ -func (a *FakeApiService) TestQueryParameterCollectionFormatGetRequest(ctx _context.Context) ApiTestQueryParameterCollectionFormatRequest { +func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context) ApiTestQueryParameterCollectionFormatRequest { return ApiTestQueryParameterCollectionFormatRequest{ + ApiService: a, ctx: ctx, } } diff --git a/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go b/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go index 2df9fecaee07..f3196ff2bd80 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go @@ -21,28 +21,12 @@ var ( _ _context.Context ) - type FakeClassnameTags123Api interface { - /* - * 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 - */ - TestClassnameGetRequest(ctx _context.Context) ApiTestClassnameRequest - - /* - * Execute executes the request - * @return Client - */ - TestClassnameExecute(r ApiTestClassnameRequest) (Client, *_nethttp.Response, error) - - } - // FakeClassnameTags123ApiService FakeClassnameTags123Api service type FakeClassnameTags123ApiService service type ApiTestClassnameRequest struct { ctx _context.Context + ApiService *FakeClassnameTags123ApiService body *Client } @@ -50,14 +34,20 @@ func (r ApiTestClassnameRequest) Body(body Client) ApiTestClassnameRequest { r.body = &body return r } + +func (r ApiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) { + return r.ApiService.TestClassnameExecute(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 + * @return ApiTestClassnameRequest */ -func (a *FakeClassnameTags123ApiService) TestClassnameGetRequest(ctx _context.Context) ApiTestClassnameRequest { +func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context) ApiTestClassnameRequest { return ApiTestClassnameRequest{ + ApiService: a, ctx: ctx, } } diff --git a/samples/client/petstore/go-experimental/go-petstore/api_pet.go b/samples/client/petstore/go-experimental/go-petstore/api_pet.go index 860410cf5d48..8482a367de29 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_pet.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_pet.go @@ -23,135 +23,12 @@ var ( _ _context.Context ) - type PetApi interface { - /* - * 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 - */ - AddPetGetRequest(ctx _context.Context) ApiAddPetRequest - - /* - * Execute executes the request - */ - AddPetExecute(r ApiAddPetRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - DeletePetGetRequest(ctx _context.Context, petId int64) ApiDeletePetRequest - - /* - * Execute executes the request - */ - DeletePetExecute(r ApiDeletePetRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - FindPetsByStatusGetRequest(ctx _context.Context) ApiFindPetsByStatusRequest - - /* - * Execute executes the request - * @return []Pet - */ - FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([]Pet, *_nethttp.Response, error) - - /* - * 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 - */ - FindPetsByTagsGetRequest(ctx _context.Context) ApiFindPetsByTagsRequest - - /* - * Execute executes the request - * @return []Pet - */ - FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet, *_nethttp.Response, error) - - /* - * 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 - */ - GetPetByIdGetRequest(ctx _context.Context, petId int64) ApiGetPetByIdRequest - - /* - * Execute executes the request - * @return Pet - */ - GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *_nethttp.Response, error) - - /* - * 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 - */ - UpdatePetGetRequest(ctx _context.Context) ApiUpdatePetRequest - - /* - * Execute executes the request - */ - UpdatePetExecute(r ApiUpdatePetRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - UpdatePetWithFormGetRequest(ctx _context.Context, petId int64) ApiUpdatePetWithFormRequest - - /* - * Execute executes the request - */ - UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - UploadFileGetRequest(ctx _context.Context, petId int64) ApiUploadFileRequest - - /* - * Execute executes the request - * @return ApiResponse - */ - UploadFileExecute(r ApiUploadFileRequest) (ApiResponse, *_nethttp.Response, error) - - /* - * 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 - */ - UploadFileWithRequiredFileGetRequest(ctx _context.Context, petId int64) ApiUploadFileWithRequiredFileRequest - - /* - * Execute executes the request - * @return ApiResponse - */ - UploadFileWithRequiredFileExecute(r ApiUploadFileWithRequiredFileRequest) (ApiResponse, *_nethttp.Response, error) - - } - // PetApiService PetApi service type PetApiService service type ApiAddPetRequest struct { ctx _context.Context + ApiService *PetApiService body *Pet } @@ -159,13 +36,19 @@ func (r ApiAddPetRequest) Body(body Pet) ApiAddPetRequest { r.body = &body return r } + +func (r ApiAddPetRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.AddPetExecute(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 + * @return ApiAddPetRequest */ -func (a *PetApiService) AddPetGetRequest(ctx _context.Context) ApiAddPetRequest { +func (a *PetApiService) AddPet(ctx _context.Context) ApiAddPetRequest { return ApiAddPetRequest{ + ApiService: a, ctx: ctx, } } @@ -241,8 +124,10 @@ func (a *PetApiService) AddPetExecute(r ApiAddPetRequest) (*_nethttp.Response, e return localVarHTTPResponse, nil } + type ApiDeletePetRequest struct { ctx _context.Context + ApiService *PetApiService petId int64 apiKey *string } @@ -251,14 +136,20 @@ func (r ApiDeletePetRequest) ApiKey(apiKey string) ApiDeletePetRequest { r.apiKey = &apiKey return r } + +func (r ApiDeletePetRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.DeletePetExecute(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 + * @return ApiDeletePetRequest */ -func (a *PetApiService) DeletePetGetRequest(ctx _context.Context, petId int64) ApiDeletePetRequest { +func (a *PetApiService) DeletePet(ctx _context.Context, petId int64) ApiDeletePetRequest { return ApiDeletePetRequest{ + ApiService: a, ctx: ctx, petId: petId, } @@ -334,8 +225,10 @@ func (a *PetApiService) DeletePetExecute(r ApiDeletePetRequest) (*_nethttp.Respo return localVarHTTPResponse, nil } + type ApiFindPetsByStatusRequest struct { ctx _context.Context + ApiService *PetApiService status *[]string } @@ -343,14 +236,20 @@ func (r ApiFindPetsByStatusRequest) Status(status []string) ApiFindPetsByStatusR r.status = &status return r } + +func (r ApiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) { + return r.ApiService.FindPetsByStatusExecute(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 + * @return ApiFindPetsByStatusRequest */ -func (a *PetApiService) FindPetsByStatusGetRequest(ctx _context.Context) ApiFindPetsByStatusRequest { +func (a *PetApiService) FindPetsByStatus(ctx _context.Context) ApiFindPetsByStatusRequest { return ApiFindPetsByStatusRequest{ + ApiService: a, ctx: ctx, } } @@ -436,8 +335,10 @@ func (a *PetApiService) FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([ return localVarReturnValue, localVarHTTPResponse, nil } + type ApiFindPetsByTagsRequest struct { ctx _context.Context + ApiService *PetApiService tags *[]string } @@ -445,14 +346,20 @@ func (r ApiFindPetsByTagsRequest) Tags(tags []string) ApiFindPetsByTagsRequest { r.tags = &tags return r } + +func (r ApiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { + return r.ApiService.FindPetsByTagsExecute(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 + * @return ApiFindPetsByTagsRequest */ -func (a *PetApiService) FindPetsByTagsGetRequest(ctx _context.Context) ApiFindPetsByTagsRequest { +func (a *PetApiService) FindPetsByTags(ctx _context.Context) ApiFindPetsByTagsRequest { return ApiFindPetsByTagsRequest{ + ApiService: a, ctx: ctx, } } @@ -538,20 +445,28 @@ func (a *PetApiService) FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet return localVarReturnValue, localVarHTTPResponse, nil } + type ApiGetPetByIdRequest struct { ctx _context.Context + ApiService *PetApiService petId int64 } + +func (r ApiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { + return r.ApiService.GetPetByIdExecute(r) +} + /* * 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 + * @return ApiGetPetByIdRequest */ -func (a *PetApiService) GetPetByIdGetRequest(ctx _context.Context, petId int64) ApiGetPetByIdRequest { +func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) ApiGetPetByIdRequest { return ApiGetPetByIdRequest{ + ApiService: a, ctx: ctx, petId: petId, } @@ -649,8 +564,10 @@ func (a *PetApiService) GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *_nethtt return localVarReturnValue, localVarHTTPResponse, nil } + type ApiUpdatePetRequest struct { ctx _context.Context + ApiService *PetApiService body *Pet } @@ -658,13 +575,19 @@ func (r ApiUpdatePetRequest) Body(body Pet) ApiUpdatePetRequest { r.body = &body return r } + +func (r ApiUpdatePetRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.UpdatePetExecute(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 + * @return ApiUpdatePetRequest */ -func (a *PetApiService) UpdatePetGetRequest(ctx _context.Context) ApiUpdatePetRequest { +func (a *PetApiService) UpdatePet(ctx _context.Context) ApiUpdatePetRequest { return ApiUpdatePetRequest{ + ApiService: a, ctx: ctx, } } @@ -740,8 +663,10 @@ func (a *PetApiService) UpdatePetExecute(r ApiUpdatePetRequest) (*_nethttp.Respo return localVarHTTPResponse, nil } + type ApiUpdatePetWithFormRequest struct { ctx _context.Context + ApiService *PetApiService petId int64 name *string status *string @@ -755,14 +680,20 @@ func (r ApiUpdatePetWithFormRequest) Status(status string) ApiUpdatePetWithFormR r.status = &status return r } + +func (r ApiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.UpdatePetWithFormExecute(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 + * @return ApiUpdatePetWithFormRequest */ -func (a *PetApiService) UpdatePetWithFormGetRequest(ctx _context.Context, petId int64) ApiUpdatePetWithFormRequest { +func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64) ApiUpdatePetWithFormRequest { return ApiUpdatePetWithFormRequest{ + ApiService: a, ctx: ctx, petId: petId, } @@ -841,8 +772,10 @@ func (a *PetApiService) UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest) return localVarHTTPResponse, nil } + type ApiUploadFileRequest struct { ctx _context.Context + ApiService *PetApiService petId int64 additionalMetadata *string file **os.File @@ -856,14 +789,20 @@ func (r ApiUploadFileRequest) File(file *os.File) ApiUploadFileRequest { r.file = &file return r } + +func (r ApiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { + return r.ApiService.UploadFileExecute(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 + * @return ApiUploadFileRequest */ -func (a *PetApiService) UploadFileGetRequest(ctx _context.Context, petId int64) ApiUploadFileRequest { +func (a *PetApiService) UploadFile(ctx _context.Context, petId int64) ApiUploadFileRequest { return ApiUploadFileRequest{ + ApiService: a, ctx: ctx, petId: petId, } @@ -961,8 +900,10 @@ func (a *PetApiService) UploadFileExecute(r ApiUploadFileRequest) (ApiResponse, return localVarReturnValue, localVarHTTPResponse, nil } + type ApiUploadFileWithRequiredFileRequest struct { ctx _context.Context + ApiService *PetApiService petId int64 requiredFile **os.File additionalMetadata *string @@ -976,14 +917,20 @@ func (r ApiUploadFileWithRequiredFileRequest) AdditionalMetadata(additionalMetad r.additionalMetadata = &additionalMetadata return r } + +func (r ApiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { + return r.ApiService.UploadFileWithRequiredFileExecute(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 + * @return ApiUploadFileWithRequiredFileRequest */ -func (a *PetApiService) UploadFileWithRequiredFileGetRequest(ctx _context.Context, petId int64) ApiUploadFileWithRequiredFileRequest { +func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64) ApiUploadFileWithRequiredFileRequest { return ApiUploadFileWithRequiredFileRequest{ + ApiService: a, ctx: ctx, petId: petId, } diff --git a/samples/client/petstore/go-experimental/go-petstore/api_store.go b/samples/client/petstore/go-experimental/go-petstore/api_store.go index 10510107472a..8b6b11215c6f 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_store.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_store.go @@ -22,82 +22,30 @@ var ( _ _context.Context ) - type StoreApi interface { - /* - * 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 - */ - DeleteOrderGetRequest(ctx _context.Context, orderId string) ApiDeleteOrderRequest - - /* - * Execute executes the request - */ - DeleteOrderExecute(r ApiDeleteOrderRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - GetInventoryGetRequest(ctx _context.Context) ApiGetInventoryRequest - - /* - * Execute executes the request - * @return map[string]int32 - */ - GetInventoryExecute(r ApiGetInventoryRequest) (map[string]int32, *_nethttp.Response, error) - - /* - * 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 - */ - GetOrderByIdGetRequest(ctx _context.Context, orderId int64) ApiGetOrderByIdRequest - - /* - * Execute executes the request - * @return Order - */ - GetOrderByIdExecute(r ApiGetOrderByIdRequest) (Order, *_nethttp.Response, error) - - /* - * 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 - */ - PlaceOrderGetRequest(ctx _context.Context) ApiPlaceOrderRequest - - /* - * Execute executes the request - * @return Order - */ - PlaceOrderExecute(r ApiPlaceOrderRequest) (Order, *_nethttp.Response, error) - - } - // StoreApiService StoreApi service type StoreApiService service type ApiDeleteOrderRequest struct { ctx _context.Context + ApiService *StoreApiService orderId string } + +func (r ApiDeleteOrderRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.DeleteOrderExecute(r) +} + /* * 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 + * @return ApiDeleteOrderRequest */ -func (a *StoreApiService) DeleteOrderGetRequest(ctx _context.Context, orderId string) ApiDeleteOrderRequest { +func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) ApiDeleteOrderRequest { return ApiDeleteOrderRequest{ + ApiService: a, ctx: ctx, orderId: orderId, } @@ -170,18 +118,26 @@ func (a *StoreApiService) DeleteOrderExecute(r ApiDeleteOrderRequest) (*_nethttp return localVarHTTPResponse, nil } + type ApiGetInventoryRequest struct { ctx _context.Context + ApiService *StoreApiService +} + + +func (r ApiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, error) { + return r.ApiService.GetInventoryExecute(r) } /* * 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 + * @return ApiGetInventoryRequest */ -func (a *StoreApiService) GetInventoryGetRequest(ctx _context.Context) ApiGetInventoryRequest { +func (a *StoreApiService) GetInventory(ctx _context.Context) ApiGetInventoryRequest { return ApiGetInventoryRequest{ + ApiService: a, ctx: ctx, } } @@ -277,20 +233,28 @@ func (a *StoreApiService) GetInventoryExecute(r ApiGetInventoryRequest) (map[str return localVarReturnValue, localVarHTTPResponse, nil } + type ApiGetOrderByIdRequest struct { ctx _context.Context + ApiService *StoreApiService orderId int64 } + +func (r ApiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { + return r.ApiService.GetOrderByIdExecute(r) +} + /* * 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 + * @return ApiGetOrderByIdRequest */ -func (a *StoreApiService) GetOrderByIdGetRequest(ctx _context.Context, orderId int64) ApiGetOrderByIdRequest { +func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) ApiGetOrderByIdRequest { return ApiGetOrderByIdRequest{ + ApiService: a, ctx: ctx, orderId: orderId, } @@ -380,8 +344,10 @@ func (a *StoreApiService) GetOrderByIdExecute(r ApiGetOrderByIdRequest) (Order, return localVarReturnValue, localVarHTTPResponse, nil } + type ApiPlaceOrderRequest struct { ctx _context.Context + ApiService *StoreApiService body *Order } @@ -389,13 +355,19 @@ func (r ApiPlaceOrderRequest) Body(body Order) ApiPlaceOrderRequest { r.body = &body return r } + +func (r ApiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) { + return r.ApiService.PlaceOrderExecute(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 + * @return ApiPlaceOrderRequest */ -func (a *StoreApiService) PlaceOrderGetRequest(ctx _context.Context) ApiPlaceOrderRequest { +func (a *StoreApiService) PlaceOrder(ctx _context.Context) ApiPlaceOrderRequest { return ApiPlaceOrderRequest{ + ApiService: a, ctx: ctx, } } diff --git a/samples/client/petstore/go-experimental/go-petstore/api_user.go b/samples/client/petstore/go-experimental/go-petstore/api_user.go index ff7a1e5d2b24..154028e83099 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_user.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_user.go @@ -22,118 +22,12 @@ var ( _ _context.Context ) - type UserApi interface { - /* - * 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 - */ - CreateUserGetRequest(ctx _context.Context) ApiCreateUserRequest - - /* - * Execute executes the request - */ - CreateUserExecute(r ApiCreateUserRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - CreateUsersWithArrayInputGetRequest(ctx _context.Context) ApiCreateUsersWithArrayInputRequest - - /* - * Execute executes the request - */ - CreateUsersWithArrayInputExecute(r ApiCreateUsersWithArrayInputRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - CreateUsersWithListInputGetRequest(ctx _context.Context) ApiCreateUsersWithListInputRequest - - /* - * Execute executes the request - */ - CreateUsersWithListInputExecute(r ApiCreateUsersWithListInputRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - DeleteUserGetRequest(ctx _context.Context, username string) ApiDeleteUserRequest - - /* - * Execute executes the request - */ - DeleteUserExecute(r ApiDeleteUserRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - GetUserByNameGetRequest(ctx _context.Context, username string) ApiGetUserByNameRequest - - /* - * Execute executes the request - * @return User - */ - GetUserByNameExecute(r ApiGetUserByNameRequest) (User, *_nethttp.Response, error) - - /* - * 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 - */ - LoginUserGetRequest(ctx _context.Context) ApiLoginUserRequest - - /* - * Execute executes the request - * @return string - */ - LoginUserExecute(r ApiLoginUserRequest) (string, *_nethttp.Response, error) - - /* - * 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 - */ - LogoutUserGetRequest(ctx _context.Context) ApiLogoutUserRequest - - /* - * Execute executes the request - */ - LogoutUserExecute(r ApiLogoutUserRequest) (*_nethttp.Response, error) - - /* - * 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 - */ - UpdateUserGetRequest(ctx _context.Context, username string) ApiUpdateUserRequest - - /* - * Execute executes the request - */ - UpdateUserExecute(r ApiUpdateUserRequest) (*_nethttp.Response, error) - - } - // UserApiService UserApi service type UserApiService service type ApiCreateUserRequest struct { ctx _context.Context + ApiService *UserApiService body *User } @@ -141,14 +35,20 @@ func (r ApiCreateUserRequest) Body(body User) ApiCreateUserRequest { r.body = &body return r } + +func (r ApiCreateUserRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.CreateUserExecute(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 + * @return ApiCreateUserRequest */ -func (a *UserApiService) CreateUserGetRequest(ctx _context.Context) ApiCreateUserRequest { +func (a *UserApiService) CreateUser(ctx _context.Context) ApiCreateUserRequest { return ApiCreateUserRequest{ + ApiService: a, ctx: ctx, } } @@ -224,8 +124,10 @@ func (a *UserApiService) CreateUserExecute(r ApiCreateUserRequest) (*_nethttp.Re return localVarHTTPResponse, nil } + type ApiCreateUsersWithArrayInputRequest struct { ctx _context.Context + ApiService *UserApiService body *[]User } @@ -233,13 +135,19 @@ func (r ApiCreateUsersWithArrayInputRequest) Body(body []User) ApiCreateUsersWit r.body = &body return r } + +func (r ApiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.CreateUsersWithArrayInputExecute(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 + * @return ApiCreateUsersWithArrayInputRequest */ -func (a *UserApiService) CreateUsersWithArrayInputGetRequest(ctx _context.Context) ApiCreateUsersWithArrayInputRequest { +func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context) ApiCreateUsersWithArrayInputRequest { return ApiCreateUsersWithArrayInputRequest{ + ApiService: a, ctx: ctx, } } @@ -315,8 +223,10 @@ func (a *UserApiService) CreateUsersWithArrayInputExecute(r ApiCreateUsersWithAr return localVarHTTPResponse, nil } + type ApiCreateUsersWithListInputRequest struct { ctx _context.Context + ApiService *UserApiService body *[]User } @@ -324,13 +234,19 @@ func (r ApiCreateUsersWithListInputRequest) Body(body []User) ApiCreateUsersWith r.body = &body return r } + +func (r ApiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.CreateUsersWithListInputExecute(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 + * @return ApiCreateUsersWithListInputRequest */ -func (a *UserApiService) CreateUsersWithListInputGetRequest(ctx _context.Context) ApiCreateUsersWithListInputRequest { +func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context) ApiCreateUsersWithListInputRequest { return ApiCreateUsersWithListInputRequest{ + ApiService: a, ctx: ctx, } } @@ -406,20 +322,28 @@ func (a *UserApiService) CreateUsersWithListInputExecute(r ApiCreateUsersWithLis return localVarHTTPResponse, nil } + type ApiDeleteUserRequest struct { ctx _context.Context + ApiService *UserApiService username string } + +func (r ApiDeleteUserRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.DeleteUserExecute(r) +} + /* * 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 + * @return ApiDeleteUserRequest */ -func (a *UserApiService) DeleteUserGetRequest(ctx _context.Context, username string) ApiDeleteUserRequest { +func (a *UserApiService) DeleteUser(ctx _context.Context, username string) ApiDeleteUserRequest { return ApiDeleteUserRequest{ + ApiService: a, ctx: ctx, username: username, } @@ -492,19 +416,27 @@ func (a *UserApiService) DeleteUserExecute(r ApiDeleteUserRequest) (*_nethttp.Re return localVarHTTPResponse, nil } + type ApiGetUserByNameRequest struct { ctx _context.Context + ApiService *UserApiService username string } + +func (r ApiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { + return r.ApiService.GetUserByNameExecute(r) +} + /* * 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 + * @return ApiGetUserByNameRequest */ -func (a *UserApiService) GetUserByNameGetRequest(ctx _context.Context, username string) ApiGetUserByNameRequest { +func (a *UserApiService) GetUserByName(ctx _context.Context, username string) ApiGetUserByNameRequest { return ApiGetUserByNameRequest{ + ApiService: a, ctx: ctx, username: username, } @@ -588,8 +520,10 @@ func (a *UserApiService) GetUserByNameExecute(r ApiGetUserByNameRequest) (User, return localVarReturnValue, localVarHTTPResponse, nil } + type ApiLoginUserRequest struct { ctx _context.Context + ApiService *UserApiService username *string password *string } @@ -602,13 +536,19 @@ func (r ApiLoginUserRequest) Password(password string) ApiLoginUserRequest { r.password = &password return r } + +func (r ApiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { + return r.ApiService.LoginUserExecute(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 + * @return ApiLoginUserRequest */ -func (a *UserApiService) LoginUserGetRequest(ctx _context.Context) ApiLoginUserRequest { +func (a *UserApiService) LoginUser(ctx _context.Context) ApiLoginUserRequest { return ApiLoginUserRequest{ + ApiService: a, ctx: ctx, } } @@ -698,17 +638,25 @@ func (a *UserApiService) LoginUserExecute(r ApiLoginUserRequest) (string, *_neth return localVarReturnValue, localVarHTTPResponse, nil } + type ApiLogoutUserRequest struct { ctx _context.Context + ApiService *UserApiService +} + + +func (r ApiLogoutUserRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.LogoutUserExecute(r) } /* * 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 + * @return ApiLogoutUserRequest */ -func (a *UserApiService) LogoutUserGetRequest(ctx _context.Context) ApiLogoutUserRequest { +func (a *UserApiService) LogoutUser(ctx _context.Context) ApiLogoutUserRequest { return ApiLogoutUserRequest{ + ApiService: a, ctx: ctx, } } @@ -779,8 +727,10 @@ func (a *UserApiService) LogoutUserExecute(r ApiLogoutUserRequest) (*_nethttp.Re return localVarHTTPResponse, nil } + type ApiUpdateUserRequest struct { ctx _context.Context + ApiService *UserApiService username string body *User } @@ -789,15 +739,21 @@ func (r ApiUpdateUserRequest) Body(body User) ApiUpdateUserRequest { r.body = &body return r } + +func (r ApiUpdateUserRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.UpdateUserExecute(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 + * @return ApiUpdateUserRequest */ -func (a *UserApiService) UpdateUserGetRequest(ctx _context.Context, username string) ApiUpdateUserRequest { +func (a *UserApiService) UpdateUser(ctx _context.Context, username string) ApiUpdateUserRequest { return ApiUpdateUserRequest{ + ApiService: a, ctx: ctx, username: username, } diff --git a/samples/client/petstore/go-experimental/go-petstore/client.go b/samples/client/petstore/go-experimental/go-petstore/client.go index 09eb6b64596c..a9bd76d61238 100644 --- a/samples/client/petstore/go-experimental/go-petstore/client.go +++ b/samples/client/petstore/go-experimental/go-petstore/client.go @@ -47,17 +47,17 @@ type APIClient struct { // API Services - AnotherFakeApi AnotherFakeApi + AnotherFakeApi *AnotherFakeApiService - FakeApi FakeApi + FakeApi *FakeApiService - FakeClassnameTags123Api FakeClassnameTags123Api + FakeClassnameTags123Api *FakeClassnameTags123ApiService - PetApi PetApi + PetApi *PetApiService - StoreApi StoreApi + StoreApi *StoreApiService - UserApi UserApi + UserApi *UserApiService } type service struct { diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_another_fake.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_another_fake.go index 0f59910d9081..621189f986d0 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_another_fake.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_another_fake.go @@ -26,6 +26,7 @@ type AnotherFakeApiService service type ApiCall123TestSpecialTagsRequest struct { ctx _context.Context + ApiService *AnotherFakeApiService client *Client } @@ -33,14 +34,20 @@ func (r ApiCall123TestSpecialTagsRequest) Client(client Client) ApiCall123TestSp r.client = &client return r } + +func (r ApiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, error) { + return r.ApiService.Call123TestSpecialTagsExecute(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 + * @return ApiCall123TestSpecialTagsRequest */ -func (a *AnotherFakeApiService) Call123TestSpecialTagsGetRequest(ctx _context.Context) ApiCall123TestSpecialTagsRequest { +func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context) ApiCall123TestSpecialTagsRequest { return ApiCall123TestSpecialTagsRequest{ + ApiService: a, ctx: ctx, } } diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_default.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_default.go index 5b75530a2cfa..dca50fcf2414 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_default.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_default.go @@ -26,15 +26,22 @@ type DefaultApiService service type ApiFooGetRequest struct { ctx _context.Context + ApiService *DefaultApiService +} + + +func (r ApiFooGetRequest) Execute() (InlineResponseDefault, *_nethttp.Response, error) { + return r.ApiService.FooGetExecute(r) } /* * FooGet Method for FooGet * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return apiFooGetRequest + * @return ApiFooGetRequest */ -func (a *DefaultApiService) FooGetGetRequest(ctx _context.Context) ApiFooGetRequest { +func (a *DefaultApiService) FooGet(ctx _context.Context) ApiFooGetRequest { return ApiFooGetRequest{ + ApiService: a, ctx: ctx, } } diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake.go index e157bea4341c..9c94052d25a3 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake.go @@ -29,15 +29,22 @@ type FakeApiService service type ApiFakeHealthGetRequest struct { ctx _context.Context + ApiService *FakeApiService +} + + +func (r ApiFakeHealthGetRequest) Execute() (HealthCheckResult, *_nethttp.Response, error) { + return r.ApiService.FakeHealthGetExecute(r) } /* * FakeHealthGet Health check endpoint * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return apiFakeHealthGetRequest + * @return ApiFakeHealthGetRequest */ -func (a *FakeApiService) FakeHealthGetGetRequest(ctx _context.Context) ApiFakeHealthGetRequest { +func (a *FakeApiService) FakeHealthGet(ctx _context.Context) ApiFakeHealthGetRequest { return ApiFakeHealthGetRequest{ + ApiService: a, ctx: ctx, } } @@ -119,8 +126,10 @@ func (a *FakeApiService) FakeHealthGetExecute(r ApiFakeHealthGetRequest) (Health return localVarReturnValue, localVarHTTPResponse, nil } + type ApiFakeOuterBooleanSerializeRequest struct { ctx _context.Context + ApiService *FakeApiService body *bool } @@ -128,14 +137,20 @@ func (r ApiFakeOuterBooleanSerializeRequest) Body(body bool) ApiFakeOuterBoolean r.body = &body return r } + +func (r ApiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response, error) { + return r.ApiService.FakeOuterBooleanSerializeExecute(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 + * @return ApiFakeOuterBooleanSerializeRequest */ -func (a *FakeApiService) FakeOuterBooleanSerializeGetRequest(ctx _context.Context) ApiFakeOuterBooleanSerializeRequest { +func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context) ApiFakeOuterBooleanSerializeRequest { return ApiFakeOuterBooleanSerializeRequest{ + ApiService: a, ctx: ctx, } } @@ -219,8 +234,10 @@ func (a *FakeApiService) FakeOuterBooleanSerializeExecute(r ApiFakeOuterBooleanS return localVarReturnValue, localVarHTTPResponse, nil } + type ApiFakeOuterCompositeSerializeRequest struct { ctx _context.Context + ApiService *FakeApiService outerComposite *OuterComposite } @@ -228,14 +245,20 @@ func (r ApiFakeOuterCompositeSerializeRequest) OuterComposite(outerComposite Out r.outerComposite = &outerComposite return r } + +func (r ApiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_nethttp.Response, error) { + return r.ApiService.FakeOuterCompositeSerializeExecute(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 + * @return ApiFakeOuterCompositeSerializeRequest */ -func (a *FakeApiService) FakeOuterCompositeSerializeGetRequest(ctx _context.Context) ApiFakeOuterCompositeSerializeRequest { +func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context) ApiFakeOuterCompositeSerializeRequest { return ApiFakeOuterCompositeSerializeRequest{ + ApiService: a, ctx: ctx, } } @@ -319,8 +342,10 @@ func (a *FakeApiService) FakeOuterCompositeSerializeExecute(r ApiFakeOuterCompos return localVarReturnValue, localVarHTTPResponse, nil } + type ApiFakeOuterNumberSerializeRequest struct { ctx _context.Context + ApiService *FakeApiService body *float32 } @@ -328,14 +353,20 @@ func (r ApiFakeOuterNumberSerializeRequest) Body(body float32) ApiFakeOuterNumbe r.body = &body return r } + +func (r ApiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Response, error) { + return r.ApiService.FakeOuterNumberSerializeExecute(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 + * @return ApiFakeOuterNumberSerializeRequest */ -func (a *FakeApiService) FakeOuterNumberSerializeGetRequest(ctx _context.Context) ApiFakeOuterNumberSerializeRequest { +func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context) ApiFakeOuterNumberSerializeRequest { return ApiFakeOuterNumberSerializeRequest{ + ApiService: a, ctx: ctx, } } @@ -419,8 +450,10 @@ func (a *FakeApiService) FakeOuterNumberSerializeExecute(r ApiFakeOuterNumberSer return localVarReturnValue, localVarHTTPResponse, nil } + type ApiFakeOuterStringSerializeRequest struct { ctx _context.Context + ApiService *FakeApiService body *string } @@ -428,14 +461,20 @@ func (r ApiFakeOuterStringSerializeRequest) Body(body string) ApiFakeOuterString r.body = &body return r } + +func (r ApiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Response, error) { + return r.ApiService.FakeOuterStringSerializeExecute(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 + * @return ApiFakeOuterStringSerializeRequest */ -func (a *FakeApiService) FakeOuterStringSerializeGetRequest(ctx _context.Context) ApiFakeOuterStringSerializeRequest { +func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context) ApiFakeOuterStringSerializeRequest { return ApiFakeOuterStringSerializeRequest{ + ApiService: a, ctx: ctx, } } @@ -519,8 +558,10 @@ func (a *FakeApiService) FakeOuterStringSerializeExecute(r ApiFakeOuterStringSer return localVarReturnValue, localVarHTTPResponse, nil } + type ApiTestBodyWithFileSchemaRequest struct { ctx _context.Context + ApiService *FakeApiService fileSchemaTestClass *FileSchemaTestClass } @@ -528,14 +569,20 @@ func (r ApiTestBodyWithFileSchemaRequest) FileSchemaTestClass(fileSchemaTestClas r.fileSchemaTestClass = &fileSchemaTestClass return r } + +func (r ApiTestBodyWithFileSchemaRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestBodyWithFileSchemaExecute(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 + * @return ApiTestBodyWithFileSchemaRequest */ -func (a *FakeApiService) TestBodyWithFileSchemaGetRequest(ctx _context.Context) ApiTestBodyWithFileSchemaRequest { +func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context) ApiTestBodyWithFileSchemaRequest { return ApiTestBodyWithFileSchemaRequest{ + ApiService: a, ctx: ctx, } } @@ -611,8 +658,10 @@ func (a *FakeApiService) TestBodyWithFileSchemaExecute(r ApiTestBodyWithFileSche return localVarHTTPResponse, nil } + type ApiTestBodyWithQueryParamsRequest struct { ctx _context.Context + ApiService *FakeApiService query *string user *User } @@ -625,13 +674,19 @@ func (r ApiTestBodyWithQueryParamsRequest) User(user User) ApiTestBodyWithQueryP r.user = &user return r } + +func (r ApiTestBodyWithQueryParamsRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestBodyWithQueryParamsExecute(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 + * @return ApiTestBodyWithQueryParamsRequest */ -func (a *FakeApiService) TestBodyWithQueryParamsGetRequest(ctx _context.Context) ApiTestBodyWithQueryParamsRequest { +func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context) ApiTestBodyWithQueryParamsRequest { return ApiTestBodyWithQueryParamsRequest{ + ApiService: a, ctx: ctx, } } @@ -711,8 +766,10 @@ func (a *FakeApiService) TestBodyWithQueryParamsExecute(r ApiTestBodyWithQueryPa return localVarHTTPResponse, nil } + type ApiTestClientModelRequest struct { ctx _context.Context + ApiService *FakeApiService client *Client } @@ -720,14 +777,20 @@ func (r ApiTestClientModelRequest) Client(client Client) ApiTestClientModelReque r.client = &client return r } + +func (r ApiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) { + return r.ApiService.TestClientModelExecute(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 + * @return ApiTestClientModelRequest */ -func (a *FakeApiService) TestClientModelGetRequest(ctx _context.Context) ApiTestClientModelRequest { +func (a *FakeApiService) TestClientModel(ctx _context.Context) ApiTestClientModelRequest { return ApiTestClientModelRequest{ + ApiService: a, ctx: ctx, } } @@ -814,8 +877,10 @@ func (a *FakeApiService) TestClientModelExecute(r ApiTestClientModelRequest) (Cl return localVarReturnValue, localVarHTTPResponse, nil } + type ApiTestEndpointParametersRequest struct { ctx _context.Context + ApiService *FakeApiService number *float32 double *float64 patternWithoutDelimiter *string @@ -888,18 +953,24 @@ func (r ApiTestEndpointParametersRequest) Callback(callback string) ApiTestEndpo r.callback = &callback return r } + +func (r ApiTestEndpointParametersRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestEndpointParametersExecute(r) +} + /* - * TestEndpointParameters Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * 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 + * @return ApiTestEndpointParametersRequest */ -func (a *FakeApiService) TestEndpointParametersGetRequest(ctx _context.Context) ApiTestEndpointParametersRequest { +func (a *FakeApiService) TestEndpointParameters(ctx _context.Context) ApiTestEndpointParametersRequest { return ApiTestEndpointParametersRequest{ + ApiService: a, ctx: ctx, } } @@ -1036,8 +1107,10 @@ func (a *FakeApiService) TestEndpointParametersExecute(r ApiTestEndpointParamete return localVarHTTPResponse, nil } + type ApiTestEnumParametersRequest struct { ctx _context.Context + ApiService *FakeApiService enumHeaderStringArray *[]string enumHeaderString *string enumQueryStringArray *[]string @@ -1080,14 +1153,20 @@ func (r ApiTestEnumParametersRequest) EnumFormString(enumFormString string) ApiT r.enumFormString = &enumFormString return r } + +func (r ApiTestEnumParametersRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestEnumParametersExecute(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 + * @return ApiTestEnumParametersRequest */ -func (a *FakeApiService) TestEnumParametersGetRequest(ctx _context.Context) ApiTestEnumParametersRequest { +func (a *FakeApiService) TestEnumParameters(ctx _context.Context) ApiTestEnumParametersRequest { return ApiTestEnumParametersRequest{ + ApiService: a, ctx: ctx, } } @@ -1190,8 +1269,10 @@ func (a *FakeApiService) TestEnumParametersExecute(r ApiTestEnumParametersReques return localVarHTTPResponse, nil } + type ApiTestGroupParametersRequest struct { ctx _context.Context + ApiService *FakeApiService requiredStringGroup *int32 requiredBooleanGroup *bool requiredInt64Group *int64 @@ -1224,14 +1305,20 @@ func (r ApiTestGroupParametersRequest) Int64Group(int64Group int64) ApiTestGroup r.int64Group = &int64Group return r } + +func (r ApiTestGroupParametersRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestGroupParametersExecute(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 + * @return ApiTestGroupParametersRequest */ -func (a *FakeApiService) TestGroupParametersGetRequest(ctx _context.Context) ApiTestGroupParametersRequest { +func (a *FakeApiService) TestGroupParameters(ctx _context.Context) ApiTestGroupParametersRequest { return ApiTestGroupParametersRequest{ + ApiService: a, ctx: ctx, } } @@ -1323,8 +1410,10 @@ func (a *FakeApiService) TestGroupParametersExecute(r ApiTestGroupParametersRequ return localVarHTTPResponse, nil } + type ApiTestInlineAdditionalPropertiesRequest struct { ctx _context.Context + ApiService *FakeApiService requestBody *map[string]string } @@ -1332,13 +1421,19 @@ func (r ApiTestInlineAdditionalPropertiesRequest) RequestBody(requestBody map[st r.requestBody = &requestBody return r } + +func (r ApiTestInlineAdditionalPropertiesRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestInlineAdditionalPropertiesExecute(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 + * @return ApiTestInlineAdditionalPropertiesRequest */ -func (a *FakeApiService) TestInlineAdditionalPropertiesGetRequest(ctx _context.Context) ApiTestInlineAdditionalPropertiesRequest { +func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context) ApiTestInlineAdditionalPropertiesRequest { return ApiTestInlineAdditionalPropertiesRequest{ + ApiService: a, ctx: ctx, } } @@ -1414,8 +1509,10 @@ func (a *FakeApiService) TestInlineAdditionalPropertiesExecute(r ApiTestInlineAd return localVarHTTPResponse, nil } + type ApiTestJsonFormDataRequest struct { ctx _context.Context + ApiService *FakeApiService param *string param2 *string } @@ -1428,13 +1525,19 @@ func (r ApiTestJsonFormDataRequest) Param2(param2 string) ApiTestJsonFormDataReq r.param2 = ¶m2 return r } + +func (r ApiTestJsonFormDataRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestJsonFormDataExecute(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 + * @return ApiTestJsonFormDataRequest */ -func (a *FakeApiService) TestJsonFormDataGetRequest(ctx _context.Context) ApiTestJsonFormDataRequest { +func (a *FakeApiService) TestJsonFormData(ctx _context.Context) ApiTestJsonFormDataRequest { return ApiTestJsonFormDataRequest{ + ApiService: a, ctx: ctx, } } @@ -1513,8 +1616,10 @@ func (a *FakeApiService) TestJsonFormDataExecute(r ApiTestJsonFormDataRequest) ( return localVarHTTPResponse, nil } + type ApiTestQueryParameterCollectionFormatRequest struct { ctx _context.Context + ApiService *FakeApiService pipe *[]string ioutil *[]string http *[]string @@ -1542,14 +1647,20 @@ func (r ApiTestQueryParameterCollectionFormatRequest) Context(context []string) r.context = &context return r } + +func (r ApiTestQueryParameterCollectionFormatRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.TestQueryParameterCollectionFormatExecute(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 + * @return ApiTestQueryParameterCollectionFormatRequest */ -func (a *FakeApiService) TestQueryParameterCollectionFormatGetRequest(ctx _context.Context) ApiTestQueryParameterCollectionFormatRequest { +func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context) ApiTestQueryParameterCollectionFormatRequest { return ApiTestQueryParameterCollectionFormatRequest{ + ApiService: a, ctx: ctx, } } diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go index 1b2095f678c2..bb52ebf574ac 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go @@ -26,6 +26,7 @@ type FakeClassnameTags123ApiService service type ApiTestClassnameRequest struct { ctx _context.Context + ApiService *FakeClassnameTags123ApiService client *Client } @@ -33,14 +34,20 @@ func (r ApiTestClassnameRequest) Client(client Client) ApiTestClassnameRequest { r.client = &client return r } + +func (r ApiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) { + return r.ApiService.TestClassnameExecute(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 + * @return ApiTestClassnameRequest */ -func (a *FakeClassnameTags123ApiService) TestClassnameGetRequest(ctx _context.Context) ApiTestClassnameRequest { +func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context) ApiTestClassnameRequest { return ApiTestClassnameRequest{ + ApiService: a, ctx: ctx, } } diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_pet.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_pet.go index 4379495c0bc3..8da19763b5a4 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_pet.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_pet.go @@ -28,6 +28,7 @@ type PetApiService service type ApiAddPetRequest struct { ctx _context.Context + ApiService *PetApiService pet *Pet } @@ -35,13 +36,19 @@ func (r ApiAddPetRequest) Pet(pet Pet) ApiAddPetRequest { r.pet = &pet return r } + +func (r ApiAddPetRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.AddPetExecute(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 + * @return ApiAddPetRequest */ -func (a *PetApiService) AddPetGetRequest(ctx _context.Context) ApiAddPetRequest { +func (a *PetApiService) AddPet(ctx _context.Context) ApiAddPetRequest { return ApiAddPetRequest{ + ApiService: a, ctx: ctx, } } @@ -117,8 +124,10 @@ func (a *PetApiService) AddPetExecute(r ApiAddPetRequest) (*_nethttp.Response, e return localVarHTTPResponse, nil } + type ApiDeletePetRequest struct { ctx _context.Context + ApiService *PetApiService petId int64 apiKey *string } @@ -127,14 +136,20 @@ func (r ApiDeletePetRequest) ApiKey(apiKey string) ApiDeletePetRequest { r.apiKey = &apiKey return r } + +func (r ApiDeletePetRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.DeletePetExecute(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 + * @return ApiDeletePetRequest */ -func (a *PetApiService) DeletePetGetRequest(ctx _context.Context, petId int64) ApiDeletePetRequest { +func (a *PetApiService) DeletePet(ctx _context.Context, petId int64) ApiDeletePetRequest { return ApiDeletePetRequest{ + ApiService: a, ctx: ctx, petId: petId, } @@ -210,8 +225,10 @@ func (a *PetApiService) DeletePetExecute(r ApiDeletePetRequest) (*_nethttp.Respo return localVarHTTPResponse, nil } + type ApiFindPetsByStatusRequest struct { ctx _context.Context + ApiService *PetApiService status *[]string } @@ -219,14 +236,20 @@ func (r ApiFindPetsByStatusRequest) Status(status []string) ApiFindPetsByStatusR r.status = &status return r } + +func (r ApiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) { + return r.ApiService.FindPetsByStatusExecute(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 + * @return ApiFindPetsByStatusRequest */ -func (a *PetApiService) FindPetsByStatusGetRequest(ctx _context.Context) ApiFindPetsByStatusRequest { +func (a *PetApiService) FindPetsByStatus(ctx _context.Context) ApiFindPetsByStatusRequest { return ApiFindPetsByStatusRequest{ + ApiService: a, ctx: ctx, } } @@ -312,8 +335,10 @@ func (a *PetApiService) FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([ return localVarReturnValue, localVarHTTPResponse, nil } + type ApiFindPetsByTagsRequest struct { ctx _context.Context + ApiService *PetApiService tags *[]string } @@ -321,14 +346,20 @@ func (r ApiFindPetsByTagsRequest) Tags(tags []string) ApiFindPetsByTagsRequest { r.tags = &tags return r } + +func (r ApiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { + return r.ApiService.FindPetsByTagsExecute(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 + * @return ApiFindPetsByTagsRequest */ -func (a *PetApiService) FindPetsByTagsGetRequest(ctx _context.Context) ApiFindPetsByTagsRequest { +func (a *PetApiService) FindPetsByTags(ctx _context.Context) ApiFindPetsByTagsRequest { return ApiFindPetsByTagsRequest{ + ApiService: a, ctx: ctx, } } @@ -414,20 +445,28 @@ func (a *PetApiService) FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet return localVarReturnValue, localVarHTTPResponse, nil } + type ApiGetPetByIdRequest struct { ctx _context.Context + ApiService *PetApiService petId int64 } + +func (r ApiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { + return r.ApiService.GetPetByIdExecute(r) +} + /* * 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 + * @return ApiGetPetByIdRequest */ -func (a *PetApiService) GetPetByIdGetRequest(ctx _context.Context, petId int64) ApiGetPetByIdRequest { +func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) ApiGetPetByIdRequest { return ApiGetPetByIdRequest{ + ApiService: a, ctx: ctx, petId: petId, } @@ -525,8 +564,10 @@ func (a *PetApiService) GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *_nethtt return localVarReturnValue, localVarHTTPResponse, nil } + type ApiUpdatePetRequest struct { ctx _context.Context + ApiService *PetApiService pet *Pet } @@ -534,13 +575,19 @@ func (r ApiUpdatePetRequest) Pet(pet Pet) ApiUpdatePetRequest { r.pet = &pet return r } + +func (r ApiUpdatePetRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.UpdatePetExecute(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 + * @return ApiUpdatePetRequest */ -func (a *PetApiService) UpdatePetGetRequest(ctx _context.Context) ApiUpdatePetRequest { +func (a *PetApiService) UpdatePet(ctx _context.Context) ApiUpdatePetRequest { return ApiUpdatePetRequest{ + ApiService: a, ctx: ctx, } } @@ -616,8 +663,10 @@ func (a *PetApiService) UpdatePetExecute(r ApiUpdatePetRequest) (*_nethttp.Respo return localVarHTTPResponse, nil } + type ApiUpdatePetWithFormRequest struct { ctx _context.Context + ApiService *PetApiService petId int64 name *string status *string @@ -631,14 +680,20 @@ func (r ApiUpdatePetWithFormRequest) Status(status string) ApiUpdatePetWithFormR r.status = &status return r } + +func (r ApiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.UpdatePetWithFormExecute(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 + * @return ApiUpdatePetWithFormRequest */ -func (a *PetApiService) UpdatePetWithFormGetRequest(ctx _context.Context, petId int64) ApiUpdatePetWithFormRequest { +func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64) ApiUpdatePetWithFormRequest { return ApiUpdatePetWithFormRequest{ + ApiService: a, ctx: ctx, petId: petId, } @@ -717,8 +772,10 @@ func (a *PetApiService) UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest) return localVarHTTPResponse, nil } + type ApiUploadFileRequest struct { ctx _context.Context + ApiService *PetApiService petId int64 additionalMetadata *string file **os.File @@ -732,14 +789,20 @@ func (r ApiUploadFileRequest) File(file *os.File) ApiUploadFileRequest { r.file = &file return r } + +func (r ApiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { + return r.ApiService.UploadFileExecute(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 + * @return ApiUploadFileRequest */ -func (a *PetApiService) UploadFileGetRequest(ctx _context.Context, petId int64) ApiUploadFileRequest { +func (a *PetApiService) UploadFile(ctx _context.Context, petId int64) ApiUploadFileRequest { return ApiUploadFileRequest{ + ApiService: a, ctx: ctx, petId: petId, } @@ -837,8 +900,10 @@ func (a *PetApiService) UploadFileExecute(r ApiUploadFileRequest) (ApiResponse, return localVarReturnValue, localVarHTTPResponse, nil } + type ApiUploadFileWithRequiredFileRequest struct { ctx _context.Context + ApiService *PetApiService petId int64 requiredFile **os.File additionalMetadata *string @@ -852,14 +917,20 @@ func (r ApiUploadFileWithRequiredFileRequest) AdditionalMetadata(additionalMetad r.additionalMetadata = &additionalMetadata return r } + +func (r ApiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { + return r.ApiService.UploadFileWithRequiredFileExecute(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 + * @return ApiUploadFileWithRequiredFileRequest */ -func (a *PetApiService) UploadFileWithRequiredFileGetRequest(ctx _context.Context, petId int64) ApiUploadFileWithRequiredFileRequest { +func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64) ApiUploadFileWithRequiredFileRequest { return ApiUploadFileWithRequiredFileRequest{ + ApiService: a, ctx: ctx, petId: petId, } diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_store.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_store.go index 897d996135ec..a31dba5cdc42 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_store.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_store.go @@ -27,18 +27,25 @@ type StoreApiService service type ApiDeleteOrderRequest struct { ctx _context.Context + ApiService *StoreApiService orderId string } + +func (r ApiDeleteOrderRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.DeleteOrderExecute(r) +} + /* * 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 + * @return ApiDeleteOrderRequest */ -func (a *StoreApiService) DeleteOrderGetRequest(ctx _context.Context, orderId string) ApiDeleteOrderRequest { +func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) ApiDeleteOrderRequest { return ApiDeleteOrderRequest{ + ApiService: a, ctx: ctx, orderId: orderId, } @@ -111,18 +118,26 @@ func (a *StoreApiService) DeleteOrderExecute(r ApiDeleteOrderRequest) (*_nethttp return localVarHTTPResponse, nil } + type ApiGetInventoryRequest struct { ctx _context.Context + ApiService *StoreApiService +} + + +func (r ApiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, error) { + return r.ApiService.GetInventoryExecute(r) } /* * 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 + * @return ApiGetInventoryRequest */ -func (a *StoreApiService) GetInventoryGetRequest(ctx _context.Context) ApiGetInventoryRequest { +func (a *StoreApiService) GetInventory(ctx _context.Context) ApiGetInventoryRequest { return ApiGetInventoryRequest{ + ApiService: a, ctx: ctx, } } @@ -218,20 +233,28 @@ func (a *StoreApiService) GetInventoryExecute(r ApiGetInventoryRequest) (map[str return localVarReturnValue, localVarHTTPResponse, nil } + type ApiGetOrderByIdRequest struct { ctx _context.Context + ApiService *StoreApiService orderId int64 } + +func (r ApiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { + return r.ApiService.GetOrderByIdExecute(r) +} + /* * 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 + * @return ApiGetOrderByIdRequest */ -func (a *StoreApiService) GetOrderByIdGetRequest(ctx _context.Context, orderId int64) ApiGetOrderByIdRequest { +func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) ApiGetOrderByIdRequest { return ApiGetOrderByIdRequest{ + ApiService: a, ctx: ctx, orderId: orderId, } @@ -321,8 +344,10 @@ func (a *StoreApiService) GetOrderByIdExecute(r ApiGetOrderByIdRequest) (Order, return localVarReturnValue, localVarHTTPResponse, nil } + type ApiPlaceOrderRequest struct { ctx _context.Context + ApiService *StoreApiService order *Order } @@ -330,13 +355,19 @@ func (r ApiPlaceOrderRequest) Order(order Order) ApiPlaceOrderRequest { r.order = &order return r } + +func (r ApiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) { + return r.ApiService.PlaceOrderExecute(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 + * @return ApiPlaceOrderRequest */ -func (a *StoreApiService) PlaceOrderGetRequest(ctx _context.Context) ApiPlaceOrderRequest { +func (a *StoreApiService) PlaceOrder(ctx _context.Context) ApiPlaceOrderRequest { return ApiPlaceOrderRequest{ + ApiService: a, ctx: ctx, } } diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_user.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_user.go index c7c32835e4d9..2c7e32333b33 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_user.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_user.go @@ -27,6 +27,7 @@ type UserApiService service type ApiCreateUserRequest struct { ctx _context.Context + ApiService *UserApiService user *User } @@ -34,14 +35,20 @@ func (r ApiCreateUserRequest) User(user User) ApiCreateUserRequest { r.user = &user return r } + +func (r ApiCreateUserRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.CreateUserExecute(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 + * @return ApiCreateUserRequest */ -func (a *UserApiService) CreateUserGetRequest(ctx _context.Context) ApiCreateUserRequest { +func (a *UserApiService) CreateUser(ctx _context.Context) ApiCreateUserRequest { return ApiCreateUserRequest{ + ApiService: a, ctx: ctx, } } @@ -117,8 +124,10 @@ func (a *UserApiService) CreateUserExecute(r ApiCreateUserRequest) (*_nethttp.Re return localVarHTTPResponse, nil } + type ApiCreateUsersWithArrayInputRequest struct { ctx _context.Context + ApiService *UserApiService user *[]User } @@ -126,13 +135,19 @@ func (r ApiCreateUsersWithArrayInputRequest) User(user []User) ApiCreateUsersWit r.user = &user return r } + +func (r ApiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.CreateUsersWithArrayInputExecute(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 + * @return ApiCreateUsersWithArrayInputRequest */ -func (a *UserApiService) CreateUsersWithArrayInputGetRequest(ctx _context.Context) ApiCreateUsersWithArrayInputRequest { +func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context) ApiCreateUsersWithArrayInputRequest { return ApiCreateUsersWithArrayInputRequest{ + ApiService: a, ctx: ctx, } } @@ -208,8 +223,10 @@ func (a *UserApiService) CreateUsersWithArrayInputExecute(r ApiCreateUsersWithAr return localVarHTTPResponse, nil } + type ApiCreateUsersWithListInputRequest struct { ctx _context.Context + ApiService *UserApiService user *[]User } @@ -217,13 +234,19 @@ func (r ApiCreateUsersWithListInputRequest) User(user []User) ApiCreateUsersWith r.user = &user return r } + +func (r ApiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.CreateUsersWithListInputExecute(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 + * @return ApiCreateUsersWithListInputRequest */ -func (a *UserApiService) CreateUsersWithListInputGetRequest(ctx _context.Context) ApiCreateUsersWithListInputRequest { +func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context) ApiCreateUsersWithListInputRequest { return ApiCreateUsersWithListInputRequest{ + ApiService: a, ctx: ctx, } } @@ -299,20 +322,28 @@ func (a *UserApiService) CreateUsersWithListInputExecute(r ApiCreateUsersWithLis return localVarHTTPResponse, nil } + type ApiDeleteUserRequest struct { ctx _context.Context + ApiService *UserApiService username string } + +func (r ApiDeleteUserRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.DeleteUserExecute(r) +} + /* * 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 + * @return ApiDeleteUserRequest */ -func (a *UserApiService) DeleteUserGetRequest(ctx _context.Context, username string) ApiDeleteUserRequest { +func (a *UserApiService) DeleteUser(ctx _context.Context, username string) ApiDeleteUserRequest { return ApiDeleteUserRequest{ + ApiService: a, ctx: ctx, username: username, } @@ -385,19 +416,27 @@ func (a *UserApiService) DeleteUserExecute(r ApiDeleteUserRequest) (*_nethttp.Re return localVarHTTPResponse, nil } + type ApiGetUserByNameRequest struct { ctx _context.Context + ApiService *UserApiService username string } + +func (r ApiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { + return r.ApiService.GetUserByNameExecute(r) +} + /* * 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 + * @return ApiGetUserByNameRequest */ -func (a *UserApiService) GetUserByNameGetRequest(ctx _context.Context, username string) ApiGetUserByNameRequest { +func (a *UserApiService) GetUserByName(ctx _context.Context, username string) ApiGetUserByNameRequest { return ApiGetUserByNameRequest{ + ApiService: a, ctx: ctx, username: username, } @@ -481,8 +520,10 @@ func (a *UserApiService) GetUserByNameExecute(r ApiGetUserByNameRequest) (User, return localVarReturnValue, localVarHTTPResponse, nil } + type ApiLoginUserRequest struct { ctx _context.Context + ApiService *UserApiService username *string password *string } @@ -495,13 +536,19 @@ func (r ApiLoginUserRequest) Password(password string) ApiLoginUserRequest { r.password = &password return r } + +func (r ApiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { + return r.ApiService.LoginUserExecute(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 + * @return ApiLoginUserRequest */ -func (a *UserApiService) LoginUserGetRequest(ctx _context.Context) ApiLoginUserRequest { +func (a *UserApiService) LoginUser(ctx _context.Context) ApiLoginUserRequest { return ApiLoginUserRequest{ + ApiService: a, ctx: ctx, } } @@ -591,17 +638,25 @@ func (a *UserApiService) LoginUserExecute(r ApiLoginUserRequest) (string, *_neth return localVarReturnValue, localVarHTTPResponse, nil } + type ApiLogoutUserRequest struct { ctx _context.Context + ApiService *UserApiService +} + + +func (r ApiLogoutUserRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.LogoutUserExecute(r) } /* * 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 + * @return ApiLogoutUserRequest */ -func (a *UserApiService) LogoutUserGetRequest(ctx _context.Context) ApiLogoutUserRequest { +func (a *UserApiService) LogoutUser(ctx _context.Context) ApiLogoutUserRequest { return ApiLogoutUserRequest{ + ApiService: a, ctx: ctx, } } @@ -672,8 +727,10 @@ func (a *UserApiService) LogoutUserExecute(r ApiLogoutUserRequest) (*_nethttp.Re return localVarHTTPResponse, nil } + type ApiUpdateUserRequest struct { ctx _context.Context + ApiService *UserApiService username string user *User } @@ -682,15 +739,21 @@ func (r ApiUpdateUserRequest) User(user User) ApiUpdateUserRequest { r.user = &user return r } + +func (r ApiUpdateUserRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.UpdateUserExecute(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 + * @return ApiUpdateUserRequest */ -func (a *UserApiService) UpdateUserGetRequest(ctx _context.Context, username string) ApiUpdateUserRequest { +func (a *UserApiService) UpdateUser(ctx _context.Context, username string) ApiUpdateUserRequest { return ApiUpdateUserRequest{ + ApiService: a, ctx: ctx, username: username, } From fdc4599662ce8ae5366787d06bbf24c2f8a8e101 Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Sun, 23 Aug 2020 16:01:21 -0500 Subject: [PATCH 15/16] Regenerate go-experimental/oas2 samples with interfaces --- .../go-experimental-go-petstore-oas2.yaml | 1 + bin/configs/go-experimental-go-petstore.yaml | 1 + .../go-petstore/api_another_fake.go | 19 +- .../go-experimental/go-petstore/api_fake.go | 218 +++++++++++++++-- .../go-petstore/api_fake_classname_tags123.go | 19 +- .../go-experimental/go-petstore/api_pet.go | 142 +++++++++++- .../go-experimental/go-petstore/api_store.go | 67 +++++- .../go-experimental/go-petstore/api_user.go | 123 +++++++++- .../go-experimental/go-petstore/client.go | 12 +- .../go-petstore/api_another_fake.go | 19 +- .../go-petstore/api_default.go | 18 +- .../go-experimental/go-petstore/api_fake.go | 219 ++++++++++++++++-- .../go-petstore/api_fake_classname_tags123.go | 19 +- .../go-experimental/go-petstore/api_pet.go | 142 +++++++++++- .../go-experimental/go-petstore/api_store.go | 67 +++++- .../go-experimental/go-petstore/api_user.go | 123 +++++++++- .../go-experimental/go-petstore/client.go | 14 +- 17 files changed, 1135 insertions(+), 88 deletions(-) diff --git a/bin/configs/go-experimental-go-petstore-oas2.yaml b/bin/configs/go-experimental-go-petstore-oas2.yaml index 64c6bfbebc3b..5542bedcf332 100644 --- a/bin/configs/go-experimental-go-petstore-oas2.yaml +++ b/bin/configs/go-experimental-go-petstore-oas2.yaml @@ -4,3 +4,4 @@ inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-e templateDir: modules/openapi-generator/src/main/resources/go-experimental additionalProperties: packageName: petstore + generateInterfaces: true diff --git a/bin/configs/go-experimental-go-petstore.yaml b/bin/configs/go-experimental-go-petstore.yaml index 5b81f347ca56..ca3e95e80ec3 100644 --- a/bin/configs/go-experimental-go-petstore.yaml +++ b/bin/configs/go-experimental-go-petstore.yaml @@ -6,3 +6,4 @@ additionalProperties: enumClassPrefix: "true" packageName: petstore disallowAdditionalPropertiesIfNotPresent: false + generateInterfaces: true diff --git a/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go index 7c30fb4ae74c..4c7310dd505a 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go @@ -21,12 +21,29 @@ var ( _ _context.Context ) +type AnotherFakeApi interface { + + /* + * 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 + */ + Call123TestSpecialTags(ctx _context.Context) ApiCall123TestSpecialTagsRequest + + /* + * Call123TestSpecialTagsExecute executes the request + * @return Client + */ + Call123TestSpecialTagsExecute(r ApiCall123TestSpecialTagsRequest) (Client, *_nethttp.Response, error) +} + // AnotherFakeApiService AnotherFakeApi service type AnotherFakeApiService service type ApiCall123TestSpecialTagsRequest struct { ctx _context.Context - ApiService *AnotherFakeApiService + ApiService AnotherFakeApi body *Client } diff --git a/samples/client/petstore/go-experimental/go-petstore/api_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_fake.go index 34e82339599c..845d911cacf3 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_fake.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_fake.go @@ -24,12 +24,202 @@ var ( _ _context.Context ) +type FakeApi interface { + + /* + * 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 + */ + CreateXmlItem(ctx _context.Context) ApiCreateXmlItemRequest + + /* + * CreateXmlItemExecute executes the request + */ + CreateXmlItemExecute(r ApiCreateXmlItemRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + FakeOuterBooleanSerialize(ctx _context.Context) ApiFakeOuterBooleanSerializeRequest + + /* + * FakeOuterBooleanSerializeExecute executes the request + * @return bool + */ + FakeOuterBooleanSerializeExecute(r ApiFakeOuterBooleanSerializeRequest) (bool, *_nethttp.Response, error) + + /* + * 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 + */ + FakeOuterCompositeSerialize(ctx _context.Context) ApiFakeOuterCompositeSerializeRequest + + /* + * FakeOuterCompositeSerializeExecute executes the request + * @return OuterComposite + */ + FakeOuterCompositeSerializeExecute(r ApiFakeOuterCompositeSerializeRequest) (OuterComposite, *_nethttp.Response, error) + + /* + * 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 + */ + FakeOuterNumberSerialize(ctx _context.Context) ApiFakeOuterNumberSerializeRequest + + /* + * FakeOuterNumberSerializeExecute executes the request + * @return float32 + */ + FakeOuterNumberSerializeExecute(r ApiFakeOuterNumberSerializeRequest) (float32, *_nethttp.Response, error) + + /* + * 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 + */ + FakeOuterStringSerialize(ctx _context.Context) ApiFakeOuterStringSerializeRequest + + /* + * FakeOuterStringSerializeExecute executes the request + * @return string + */ + FakeOuterStringSerializeExecute(r ApiFakeOuterStringSerializeRequest) (string, *_nethttp.Response, error) + + /* + * 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 + */ + TestBodyWithFileSchema(ctx _context.Context) ApiTestBodyWithFileSchemaRequest + + /* + * TestBodyWithFileSchemaExecute executes the request + */ + TestBodyWithFileSchemaExecute(r ApiTestBodyWithFileSchemaRequest) (*_nethttp.Response, error) + + /* + * TestBodyWithQueryParams Method for TestBodyWithQueryParams + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiTestBodyWithQueryParamsRequest + */ + TestBodyWithQueryParams(ctx _context.Context) ApiTestBodyWithQueryParamsRequest + + /* + * TestBodyWithQueryParamsExecute executes the request + */ + TestBodyWithQueryParamsExecute(r ApiTestBodyWithQueryParamsRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestClientModel(ctx _context.Context) ApiTestClientModelRequest + + /* + * TestClientModelExecute executes the request + * @return Client + */ + TestClientModelExecute(r ApiTestClientModelRequest) (Client, *_nethttp.Response, error) + + /* + * 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 + */ + TestEndpointParameters(ctx _context.Context) ApiTestEndpointParametersRequest + + /* + * TestEndpointParametersExecute executes the request + */ + TestEndpointParametersExecute(r ApiTestEndpointParametersRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestEnumParameters(ctx _context.Context) ApiTestEnumParametersRequest + + /* + * TestEnumParametersExecute executes the request + */ + TestEnumParametersExecute(r ApiTestEnumParametersRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestGroupParameters(ctx _context.Context) ApiTestGroupParametersRequest + + /* + * TestGroupParametersExecute executes the request + */ + TestGroupParametersExecute(r ApiTestGroupParametersRequest) (*_nethttp.Response, error) + + /* + * TestInlineAdditionalProperties test inline additionalProperties + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiTestInlineAdditionalPropertiesRequest + */ + TestInlineAdditionalProperties(ctx _context.Context) ApiTestInlineAdditionalPropertiesRequest + + /* + * TestInlineAdditionalPropertiesExecute executes the request + */ + TestInlineAdditionalPropertiesExecute(r ApiTestInlineAdditionalPropertiesRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestJsonFormData(ctx _context.Context) ApiTestJsonFormDataRequest + + /* + * TestJsonFormDataExecute executes the request + */ + TestJsonFormDataExecute(r ApiTestJsonFormDataRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestQueryParameterCollectionFormat(ctx _context.Context) ApiTestQueryParameterCollectionFormatRequest + + /* + * TestQueryParameterCollectionFormatExecute executes the request + */ + TestQueryParameterCollectionFormatExecute(r ApiTestQueryParameterCollectionFormatRequest) (*_nethttp.Response, error) +} + // FakeApiService FakeApi service type FakeApiService service type ApiCreateXmlItemRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi xmlItem *XmlItem } @@ -129,7 +319,7 @@ func (a *FakeApiService) CreateXmlItemExecute(r ApiCreateXmlItemRequest) (*_neth type ApiFakeOuterBooleanSerializeRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi body *bool } @@ -237,7 +427,7 @@ func (a *FakeApiService) FakeOuterBooleanSerializeExecute(r ApiFakeOuterBooleanS type ApiFakeOuterCompositeSerializeRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi body *OuterComposite } @@ -345,7 +535,7 @@ func (a *FakeApiService) FakeOuterCompositeSerializeExecute(r ApiFakeOuterCompos type ApiFakeOuterNumberSerializeRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi body *float32 } @@ -453,7 +643,7 @@ func (a *FakeApiService) FakeOuterNumberSerializeExecute(r ApiFakeOuterNumberSer type ApiFakeOuterStringSerializeRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi body *string } @@ -561,7 +751,7 @@ func (a *FakeApiService) FakeOuterStringSerializeExecute(r ApiFakeOuterStringSer type ApiTestBodyWithFileSchemaRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi body *FileSchemaTestClass } @@ -661,7 +851,7 @@ func (a *FakeApiService) TestBodyWithFileSchemaExecute(r ApiTestBodyWithFileSche type ApiTestBodyWithQueryParamsRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi query *string body *User } @@ -769,7 +959,7 @@ func (a *FakeApiService) TestBodyWithQueryParamsExecute(r ApiTestBodyWithQueryPa type ApiTestClientModelRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi body *Client } @@ -880,7 +1070,7 @@ func (a *FakeApiService) TestClientModelExecute(r ApiTestClientModelRequest) (Cl type ApiTestEndpointParametersRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi number *float32 double *float64 patternWithoutDelimiter *string @@ -1109,7 +1299,7 @@ func (a *FakeApiService) TestEndpointParametersExecute(r ApiTestEndpointParamete type ApiTestEnumParametersRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi enumHeaderStringArray *[]string enumHeaderString *string enumQueryStringArray *[]string @@ -1263,7 +1453,7 @@ func (a *FakeApiService) TestEnumParametersExecute(r ApiTestEnumParametersReques type ApiTestGroupParametersRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi requiredStringGroup *int32 requiredBooleanGroup *bool requiredInt64Group *int64 @@ -1404,7 +1594,7 @@ func (a *FakeApiService) TestGroupParametersExecute(r ApiTestGroupParametersRequ type ApiTestInlineAdditionalPropertiesRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi param *map[string]string } @@ -1503,7 +1693,7 @@ func (a *FakeApiService) TestInlineAdditionalPropertiesExecute(r ApiTestInlineAd type ApiTestJsonFormDataRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi param *string param2 *string } @@ -1610,7 +1800,7 @@ func (a *FakeApiService) TestJsonFormDataExecute(r ApiTestJsonFormDataRequest) ( type ApiTestQueryParameterCollectionFormatRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi pipe *[]string ioutil *[]string http *[]string diff --git a/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go b/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go index f3196ff2bd80..d05b6ad941aa 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go @@ -21,12 +21,29 @@ var ( _ _context.Context ) +type FakeClassnameTags123Api interface { + + /* + * 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 + */ + TestClassname(ctx _context.Context) ApiTestClassnameRequest + + /* + * TestClassnameExecute executes the request + * @return Client + */ + TestClassnameExecute(r ApiTestClassnameRequest) (Client, *_nethttp.Response, error) +} + // FakeClassnameTags123ApiService FakeClassnameTags123Api service type FakeClassnameTags123ApiService service type ApiTestClassnameRequest struct { ctx _context.Context - ApiService *FakeClassnameTags123ApiService + ApiService FakeClassnameTags123Api body *Client } diff --git a/samples/client/petstore/go-experimental/go-petstore/api_pet.go b/samples/client/petstore/go-experimental/go-petstore/api_pet.go index 8482a367de29..fbc8751dbfa5 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_pet.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_pet.go @@ -23,12 +23,136 @@ var ( _ _context.Context ) +type PetApi interface { + + /* + * 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 + */ + AddPet(ctx _context.Context) ApiAddPetRequest + + /* + * AddPetExecute executes the request + */ + AddPetExecute(r ApiAddPetRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + DeletePet(ctx _context.Context, petId int64) ApiDeletePetRequest + + /* + * DeletePetExecute executes the request + */ + DeletePetExecute(r ApiDeletePetRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + FindPetsByStatus(ctx _context.Context) ApiFindPetsByStatusRequest + + /* + * FindPetsByStatusExecute executes the request + * @return []Pet + */ + FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([]Pet, *_nethttp.Response, error) + + /* + * 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 + */ + FindPetsByTags(ctx _context.Context) ApiFindPetsByTagsRequest + + /* + * FindPetsByTagsExecute executes the request + * @return []Pet + */ + FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet, *_nethttp.Response, error) + + /* + * 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 + */ + GetPetById(ctx _context.Context, petId int64) ApiGetPetByIdRequest + + /* + * GetPetByIdExecute executes the request + * @return Pet + */ + GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *_nethttp.Response, error) + + /* + * 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 + */ + UpdatePet(ctx _context.Context) ApiUpdatePetRequest + + /* + * UpdatePetExecute executes the request + */ + UpdatePetExecute(r ApiUpdatePetRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + UpdatePetWithForm(ctx _context.Context, petId int64) ApiUpdatePetWithFormRequest + + /* + * UpdatePetWithFormExecute executes the request + */ + UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + UploadFile(ctx _context.Context, petId int64) ApiUploadFileRequest + + /* + * UploadFileExecute executes the request + * @return ApiResponse + */ + UploadFileExecute(r ApiUploadFileRequest) (ApiResponse, *_nethttp.Response, error) + + /* + * 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 + */ + UploadFileWithRequiredFile(ctx _context.Context, petId int64) ApiUploadFileWithRequiredFileRequest + + /* + * UploadFileWithRequiredFileExecute executes the request + * @return ApiResponse + */ + UploadFileWithRequiredFileExecute(r ApiUploadFileWithRequiredFileRequest) (ApiResponse, *_nethttp.Response, error) +} + // PetApiService PetApi service type PetApiService service type ApiAddPetRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi body *Pet } @@ -127,7 +251,7 @@ func (a *PetApiService) AddPetExecute(r ApiAddPetRequest) (*_nethttp.Response, e type ApiDeletePetRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi petId int64 apiKey *string } @@ -228,7 +352,7 @@ func (a *PetApiService) DeletePetExecute(r ApiDeletePetRequest) (*_nethttp.Respo type ApiFindPetsByStatusRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi status *[]string } @@ -338,7 +462,7 @@ func (a *PetApiService) FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([ type ApiFindPetsByTagsRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi tags *[]string } @@ -448,7 +572,7 @@ func (a *PetApiService) FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet type ApiGetPetByIdRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi petId int64 } @@ -567,7 +691,7 @@ func (a *PetApiService) GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *_nethtt type ApiUpdatePetRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi body *Pet } @@ -666,7 +790,7 @@ func (a *PetApiService) UpdatePetExecute(r ApiUpdatePetRequest) (*_nethttp.Respo type ApiUpdatePetWithFormRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi petId int64 name *string status *string @@ -775,7 +899,7 @@ func (a *PetApiService) UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest) type ApiUploadFileRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi petId int64 additionalMetadata *string file **os.File @@ -903,7 +1027,7 @@ func (a *PetApiService) UploadFileExecute(r ApiUploadFileRequest) (ApiResponse, type ApiUploadFileWithRequiredFileRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi petId int64 requiredFile **os.File additionalMetadata *string diff --git a/samples/client/petstore/go-experimental/go-petstore/api_store.go b/samples/client/petstore/go-experimental/go-petstore/api_store.go index 8b6b11215c6f..402213102734 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_store.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_store.go @@ -22,12 +22,71 @@ var ( _ _context.Context ) +type StoreApi interface { + + /* + * 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 + */ + DeleteOrder(ctx _context.Context, orderId string) ApiDeleteOrderRequest + + /* + * DeleteOrderExecute executes the request + */ + DeleteOrderExecute(r ApiDeleteOrderRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + GetInventory(ctx _context.Context) ApiGetInventoryRequest + + /* + * GetInventoryExecute executes the request + * @return map[string]int32 + */ + GetInventoryExecute(r ApiGetInventoryRequest) (map[string]int32, *_nethttp.Response, error) + + /* + * 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 + */ + GetOrderById(ctx _context.Context, orderId int64) ApiGetOrderByIdRequest + + /* + * GetOrderByIdExecute executes the request + * @return Order + */ + GetOrderByIdExecute(r ApiGetOrderByIdRequest) (Order, *_nethttp.Response, error) + + /* + * 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 + */ + PlaceOrder(ctx _context.Context) ApiPlaceOrderRequest + + /* + * PlaceOrderExecute executes the request + * @return Order + */ + PlaceOrderExecute(r ApiPlaceOrderRequest) (Order, *_nethttp.Response, error) +} + // StoreApiService StoreApi service type StoreApiService service type ApiDeleteOrderRequest struct { ctx _context.Context - ApiService *StoreApiService + ApiService StoreApi orderId string } @@ -121,7 +180,7 @@ func (a *StoreApiService) DeleteOrderExecute(r ApiDeleteOrderRequest) (*_nethttp type ApiGetInventoryRequest struct { ctx _context.Context - ApiService *StoreApiService + ApiService StoreApi } @@ -236,7 +295,7 @@ func (a *StoreApiService) GetInventoryExecute(r ApiGetInventoryRequest) (map[str type ApiGetOrderByIdRequest struct { ctx _context.Context - ApiService *StoreApiService + ApiService StoreApi orderId int64 } @@ -347,7 +406,7 @@ func (a *StoreApiService) GetOrderByIdExecute(r ApiGetOrderByIdRequest) (Order, type ApiPlaceOrderRequest struct { ctx _context.Context - ApiService *StoreApiService + ApiService StoreApi body *Order } diff --git a/samples/client/petstore/go-experimental/go-petstore/api_user.go b/samples/client/petstore/go-experimental/go-petstore/api_user.go index 154028e83099..52216e06040d 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_user.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_user.go @@ -22,12 +22,119 @@ var ( _ _context.Context ) +type UserApi interface { + + /* + * 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 + */ + CreateUser(ctx _context.Context) ApiCreateUserRequest + + /* + * CreateUserExecute executes the request + */ + CreateUserExecute(r ApiCreateUserRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + CreateUsersWithArrayInput(ctx _context.Context) ApiCreateUsersWithArrayInputRequest + + /* + * CreateUsersWithArrayInputExecute executes the request + */ + CreateUsersWithArrayInputExecute(r ApiCreateUsersWithArrayInputRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + CreateUsersWithListInput(ctx _context.Context) ApiCreateUsersWithListInputRequest + + /* + * CreateUsersWithListInputExecute executes the request + */ + CreateUsersWithListInputExecute(r ApiCreateUsersWithListInputRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + DeleteUser(ctx _context.Context, username string) ApiDeleteUserRequest + + /* + * DeleteUserExecute executes the request + */ + DeleteUserExecute(r ApiDeleteUserRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + GetUserByName(ctx _context.Context, username string) ApiGetUserByNameRequest + + /* + * GetUserByNameExecute executes the request + * @return User + */ + GetUserByNameExecute(r ApiGetUserByNameRequest) (User, *_nethttp.Response, error) + + /* + * 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 + */ + LoginUser(ctx _context.Context) ApiLoginUserRequest + + /* + * LoginUserExecute executes the request + * @return string + */ + LoginUserExecute(r ApiLoginUserRequest) (string, *_nethttp.Response, error) + + /* + * 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 + */ + LogoutUser(ctx _context.Context) ApiLogoutUserRequest + + /* + * LogoutUserExecute executes the request + */ + LogoutUserExecute(r ApiLogoutUserRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + UpdateUser(ctx _context.Context, username string) ApiUpdateUserRequest + + /* + * UpdateUserExecute executes the request + */ + UpdateUserExecute(r ApiUpdateUserRequest) (*_nethttp.Response, error) +} + // UserApiService UserApi service type UserApiService service type ApiCreateUserRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi body *User } @@ -127,7 +234,7 @@ func (a *UserApiService) CreateUserExecute(r ApiCreateUserRequest) (*_nethttp.Re type ApiCreateUsersWithArrayInputRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi body *[]User } @@ -226,7 +333,7 @@ func (a *UserApiService) CreateUsersWithArrayInputExecute(r ApiCreateUsersWithAr type ApiCreateUsersWithListInputRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi body *[]User } @@ -325,7 +432,7 @@ func (a *UserApiService) CreateUsersWithListInputExecute(r ApiCreateUsersWithLis type ApiDeleteUserRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi username string } @@ -419,7 +526,7 @@ func (a *UserApiService) DeleteUserExecute(r ApiDeleteUserRequest) (*_nethttp.Re type ApiGetUserByNameRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi username string } @@ -523,7 +630,7 @@ func (a *UserApiService) GetUserByNameExecute(r ApiGetUserByNameRequest) (User, type ApiLoginUserRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi username *string password *string } @@ -641,7 +748,7 @@ func (a *UserApiService) LoginUserExecute(r ApiLoginUserRequest) (string, *_neth type ApiLogoutUserRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi } @@ -730,7 +837,7 @@ func (a *UserApiService) LogoutUserExecute(r ApiLogoutUserRequest) (*_nethttp.Re type ApiUpdateUserRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi username string body *User } diff --git a/samples/client/petstore/go-experimental/go-petstore/client.go b/samples/client/petstore/go-experimental/go-petstore/client.go index a9bd76d61238..09eb6b64596c 100644 --- a/samples/client/petstore/go-experimental/go-petstore/client.go +++ b/samples/client/petstore/go-experimental/go-petstore/client.go @@ -47,17 +47,17 @@ type APIClient struct { // API Services - AnotherFakeApi *AnotherFakeApiService + AnotherFakeApi AnotherFakeApi - FakeApi *FakeApiService + FakeApi FakeApi - FakeClassnameTags123Api *FakeClassnameTags123ApiService + FakeClassnameTags123Api FakeClassnameTags123Api - PetApi *PetApiService + PetApi PetApi - StoreApi *StoreApiService + StoreApi StoreApi - UserApi *UserApiService + UserApi UserApi } type service struct { diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_another_fake.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_another_fake.go index 621189f986d0..9b66a604a4fc 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_another_fake.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_another_fake.go @@ -21,12 +21,29 @@ var ( _ _context.Context ) +type AnotherFakeApi interface { + + /* + * 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 + */ + Call123TestSpecialTags(ctx _context.Context) ApiCall123TestSpecialTagsRequest + + /* + * Call123TestSpecialTagsExecute executes the request + * @return Client + */ + Call123TestSpecialTagsExecute(r ApiCall123TestSpecialTagsRequest) (Client, *_nethttp.Response, error) +} + // AnotherFakeApiService AnotherFakeApi service type AnotherFakeApiService service type ApiCall123TestSpecialTagsRequest struct { ctx _context.Context - ApiService *AnotherFakeApiService + ApiService AnotherFakeApi client *Client } diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_default.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_default.go index dca50fcf2414..ecc9658a508d 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_default.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_default.go @@ -21,12 +21,28 @@ var ( _ _context.Context ) +type DefaultApi interface { + + /* + * FooGet Method for FooGet + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiFooGetRequest + */ + FooGet(ctx _context.Context) ApiFooGetRequest + + /* + * FooGetExecute executes the request + * @return InlineResponseDefault + */ + FooGetExecute(r ApiFooGetRequest) (InlineResponseDefault, *_nethttp.Response, error) +} + // DefaultApiService DefaultApi service type DefaultApiService service type ApiFooGetRequest struct { ctx _context.Context - ApiService *DefaultApiService + ApiService DefaultApi } diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake.go index 9c94052d25a3..f2423b5d887f 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake.go @@ -24,12 +24,203 @@ var ( _ _context.Context ) +type FakeApi interface { + + /* + * FakeHealthGet Health check endpoint + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiFakeHealthGetRequest + */ + FakeHealthGet(ctx _context.Context) ApiFakeHealthGetRequest + + /* + * FakeHealthGetExecute executes the request + * @return HealthCheckResult + */ + FakeHealthGetExecute(r ApiFakeHealthGetRequest) (HealthCheckResult, *_nethttp.Response, error) + + /* + * 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 + */ + FakeOuterBooleanSerialize(ctx _context.Context) ApiFakeOuterBooleanSerializeRequest + + /* + * FakeOuterBooleanSerializeExecute executes the request + * @return bool + */ + FakeOuterBooleanSerializeExecute(r ApiFakeOuterBooleanSerializeRequest) (bool, *_nethttp.Response, error) + + /* + * 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 + */ + FakeOuterCompositeSerialize(ctx _context.Context) ApiFakeOuterCompositeSerializeRequest + + /* + * FakeOuterCompositeSerializeExecute executes the request + * @return OuterComposite + */ + FakeOuterCompositeSerializeExecute(r ApiFakeOuterCompositeSerializeRequest) (OuterComposite, *_nethttp.Response, error) + + /* + * 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 + */ + FakeOuterNumberSerialize(ctx _context.Context) ApiFakeOuterNumberSerializeRequest + + /* + * FakeOuterNumberSerializeExecute executes the request + * @return float32 + */ + FakeOuterNumberSerializeExecute(r ApiFakeOuterNumberSerializeRequest) (float32, *_nethttp.Response, error) + + /* + * 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 + */ + FakeOuterStringSerialize(ctx _context.Context) ApiFakeOuterStringSerializeRequest + + /* + * FakeOuterStringSerializeExecute executes the request + * @return string + */ + FakeOuterStringSerializeExecute(r ApiFakeOuterStringSerializeRequest) (string, *_nethttp.Response, error) + + /* + * 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 + */ + TestBodyWithFileSchema(ctx _context.Context) ApiTestBodyWithFileSchemaRequest + + /* + * TestBodyWithFileSchemaExecute executes the request + */ + TestBodyWithFileSchemaExecute(r ApiTestBodyWithFileSchemaRequest) (*_nethttp.Response, error) + + /* + * TestBodyWithQueryParams Method for TestBodyWithQueryParams + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiTestBodyWithQueryParamsRequest + */ + TestBodyWithQueryParams(ctx _context.Context) ApiTestBodyWithQueryParamsRequest + + /* + * TestBodyWithQueryParamsExecute executes the request + */ + TestBodyWithQueryParamsExecute(r ApiTestBodyWithQueryParamsRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestClientModel(ctx _context.Context) ApiTestClientModelRequest + + /* + * TestClientModelExecute executes the request + * @return Client + */ + TestClientModelExecute(r ApiTestClientModelRequest) (Client, *_nethttp.Response, error) + + /* + * 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 + */ + TestEndpointParameters(ctx _context.Context) ApiTestEndpointParametersRequest + + /* + * TestEndpointParametersExecute executes the request + */ + TestEndpointParametersExecute(r ApiTestEndpointParametersRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestEnumParameters(ctx _context.Context) ApiTestEnumParametersRequest + + /* + * TestEnumParametersExecute executes the request + */ + TestEnumParametersExecute(r ApiTestEnumParametersRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestGroupParameters(ctx _context.Context) ApiTestGroupParametersRequest + + /* + * TestGroupParametersExecute executes the request + */ + TestGroupParametersExecute(r ApiTestGroupParametersRequest) (*_nethttp.Response, error) + + /* + * TestInlineAdditionalProperties test inline additionalProperties + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiTestInlineAdditionalPropertiesRequest + */ + TestInlineAdditionalProperties(ctx _context.Context) ApiTestInlineAdditionalPropertiesRequest + + /* + * TestInlineAdditionalPropertiesExecute executes the request + */ + TestInlineAdditionalPropertiesExecute(r ApiTestInlineAdditionalPropertiesRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestJsonFormData(ctx _context.Context) ApiTestJsonFormDataRequest + + /* + * TestJsonFormDataExecute executes the request + */ + TestJsonFormDataExecute(r ApiTestJsonFormDataRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + TestQueryParameterCollectionFormat(ctx _context.Context) ApiTestQueryParameterCollectionFormatRequest + + /* + * TestQueryParameterCollectionFormatExecute executes the request + */ + TestQueryParameterCollectionFormatExecute(r ApiTestQueryParameterCollectionFormatRequest) (*_nethttp.Response, error) +} + // FakeApiService FakeApi service type FakeApiService service type ApiFakeHealthGetRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi } @@ -129,7 +320,7 @@ func (a *FakeApiService) FakeHealthGetExecute(r ApiFakeHealthGetRequest) (Health type ApiFakeOuterBooleanSerializeRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi body *bool } @@ -237,7 +428,7 @@ func (a *FakeApiService) FakeOuterBooleanSerializeExecute(r ApiFakeOuterBooleanS type ApiFakeOuterCompositeSerializeRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi outerComposite *OuterComposite } @@ -345,7 +536,7 @@ func (a *FakeApiService) FakeOuterCompositeSerializeExecute(r ApiFakeOuterCompos type ApiFakeOuterNumberSerializeRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi body *float32 } @@ -453,7 +644,7 @@ func (a *FakeApiService) FakeOuterNumberSerializeExecute(r ApiFakeOuterNumberSer type ApiFakeOuterStringSerializeRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi body *string } @@ -561,7 +752,7 @@ func (a *FakeApiService) FakeOuterStringSerializeExecute(r ApiFakeOuterStringSer type ApiTestBodyWithFileSchemaRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi fileSchemaTestClass *FileSchemaTestClass } @@ -661,7 +852,7 @@ func (a *FakeApiService) TestBodyWithFileSchemaExecute(r ApiTestBodyWithFileSche type ApiTestBodyWithQueryParamsRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi query *string user *User } @@ -769,7 +960,7 @@ func (a *FakeApiService) TestBodyWithQueryParamsExecute(r ApiTestBodyWithQueryPa type ApiTestClientModelRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi client *Client } @@ -880,7 +1071,7 @@ func (a *FakeApiService) TestClientModelExecute(r ApiTestClientModelRequest) (Cl type ApiTestEndpointParametersRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi number *float32 double *float64 patternWithoutDelimiter *string @@ -1110,7 +1301,7 @@ func (a *FakeApiService) TestEndpointParametersExecute(r ApiTestEndpointParamete type ApiTestEnumParametersRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi enumHeaderStringArray *[]string enumHeaderString *string enumQueryStringArray *[]string @@ -1272,7 +1463,7 @@ func (a *FakeApiService) TestEnumParametersExecute(r ApiTestEnumParametersReques type ApiTestGroupParametersRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi requiredStringGroup *int32 requiredBooleanGroup *bool requiredInt64Group *int64 @@ -1413,7 +1604,7 @@ func (a *FakeApiService) TestGroupParametersExecute(r ApiTestGroupParametersRequ type ApiTestInlineAdditionalPropertiesRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi requestBody *map[string]string } @@ -1512,7 +1703,7 @@ func (a *FakeApiService) TestInlineAdditionalPropertiesExecute(r ApiTestInlineAd type ApiTestJsonFormDataRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi param *string param2 *string } @@ -1619,7 +1810,7 @@ func (a *FakeApiService) TestJsonFormDataExecute(r ApiTestJsonFormDataRequest) ( type ApiTestQueryParameterCollectionFormatRequest struct { ctx _context.Context - ApiService *FakeApiService + ApiService FakeApi pipe *[]string ioutil *[]string http *[]string diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go index bb52ebf574ac..c48ef9312910 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go @@ -21,12 +21,29 @@ var ( _ _context.Context ) +type FakeClassnameTags123Api interface { + + /* + * 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 + */ + TestClassname(ctx _context.Context) ApiTestClassnameRequest + + /* + * TestClassnameExecute executes the request + * @return Client + */ + TestClassnameExecute(r ApiTestClassnameRequest) (Client, *_nethttp.Response, error) +} + // FakeClassnameTags123ApiService FakeClassnameTags123Api service type FakeClassnameTags123ApiService service type ApiTestClassnameRequest struct { ctx _context.Context - ApiService *FakeClassnameTags123ApiService + ApiService FakeClassnameTags123Api client *Client } diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_pet.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_pet.go index 8da19763b5a4..7ea431b7d7db 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_pet.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_pet.go @@ -23,12 +23,136 @@ var ( _ _context.Context ) +type PetApi interface { + + /* + * 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 + */ + AddPet(ctx _context.Context) ApiAddPetRequest + + /* + * AddPetExecute executes the request + */ + AddPetExecute(r ApiAddPetRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + DeletePet(ctx _context.Context, petId int64) ApiDeletePetRequest + + /* + * DeletePetExecute executes the request + */ + DeletePetExecute(r ApiDeletePetRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + FindPetsByStatus(ctx _context.Context) ApiFindPetsByStatusRequest + + /* + * FindPetsByStatusExecute executes the request + * @return []Pet + */ + FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([]Pet, *_nethttp.Response, error) + + /* + * 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 + */ + FindPetsByTags(ctx _context.Context) ApiFindPetsByTagsRequest + + /* + * FindPetsByTagsExecute executes the request + * @return []Pet + */ + FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet, *_nethttp.Response, error) + + /* + * 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 + */ + GetPetById(ctx _context.Context, petId int64) ApiGetPetByIdRequest + + /* + * GetPetByIdExecute executes the request + * @return Pet + */ + GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *_nethttp.Response, error) + + /* + * 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 + */ + UpdatePet(ctx _context.Context) ApiUpdatePetRequest + + /* + * UpdatePetExecute executes the request + */ + UpdatePetExecute(r ApiUpdatePetRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + UpdatePetWithForm(ctx _context.Context, petId int64) ApiUpdatePetWithFormRequest + + /* + * UpdatePetWithFormExecute executes the request + */ + UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + UploadFile(ctx _context.Context, petId int64) ApiUploadFileRequest + + /* + * UploadFileExecute executes the request + * @return ApiResponse + */ + UploadFileExecute(r ApiUploadFileRequest) (ApiResponse, *_nethttp.Response, error) + + /* + * 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 + */ + UploadFileWithRequiredFile(ctx _context.Context, petId int64) ApiUploadFileWithRequiredFileRequest + + /* + * UploadFileWithRequiredFileExecute executes the request + * @return ApiResponse + */ + UploadFileWithRequiredFileExecute(r ApiUploadFileWithRequiredFileRequest) (ApiResponse, *_nethttp.Response, error) +} + // PetApiService PetApi service type PetApiService service type ApiAddPetRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi pet *Pet } @@ -127,7 +251,7 @@ func (a *PetApiService) AddPetExecute(r ApiAddPetRequest) (*_nethttp.Response, e type ApiDeletePetRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi petId int64 apiKey *string } @@ -228,7 +352,7 @@ func (a *PetApiService) DeletePetExecute(r ApiDeletePetRequest) (*_nethttp.Respo type ApiFindPetsByStatusRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi status *[]string } @@ -338,7 +462,7 @@ func (a *PetApiService) FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([ type ApiFindPetsByTagsRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi tags *[]string } @@ -448,7 +572,7 @@ func (a *PetApiService) FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet type ApiGetPetByIdRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi petId int64 } @@ -567,7 +691,7 @@ func (a *PetApiService) GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *_nethtt type ApiUpdatePetRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi pet *Pet } @@ -666,7 +790,7 @@ func (a *PetApiService) UpdatePetExecute(r ApiUpdatePetRequest) (*_nethttp.Respo type ApiUpdatePetWithFormRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi petId int64 name *string status *string @@ -775,7 +899,7 @@ func (a *PetApiService) UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest) type ApiUploadFileRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi petId int64 additionalMetadata *string file **os.File @@ -903,7 +1027,7 @@ func (a *PetApiService) UploadFileExecute(r ApiUploadFileRequest) (ApiResponse, type ApiUploadFileWithRequiredFileRequest struct { ctx _context.Context - ApiService *PetApiService + ApiService PetApi petId int64 requiredFile **os.File additionalMetadata *string diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_store.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_store.go index a31dba5cdc42..281a9afaebc6 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_store.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_store.go @@ -22,12 +22,71 @@ var ( _ _context.Context ) +type StoreApi interface { + + /* + * 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 + */ + DeleteOrder(ctx _context.Context, orderId string) ApiDeleteOrderRequest + + /* + * DeleteOrderExecute executes the request + */ + DeleteOrderExecute(r ApiDeleteOrderRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + GetInventory(ctx _context.Context) ApiGetInventoryRequest + + /* + * GetInventoryExecute executes the request + * @return map[string]int32 + */ + GetInventoryExecute(r ApiGetInventoryRequest) (map[string]int32, *_nethttp.Response, error) + + /* + * 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 + */ + GetOrderById(ctx _context.Context, orderId int64) ApiGetOrderByIdRequest + + /* + * GetOrderByIdExecute executes the request + * @return Order + */ + GetOrderByIdExecute(r ApiGetOrderByIdRequest) (Order, *_nethttp.Response, error) + + /* + * 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 + */ + PlaceOrder(ctx _context.Context) ApiPlaceOrderRequest + + /* + * PlaceOrderExecute executes the request + * @return Order + */ + PlaceOrderExecute(r ApiPlaceOrderRequest) (Order, *_nethttp.Response, error) +} + // StoreApiService StoreApi service type StoreApiService service type ApiDeleteOrderRequest struct { ctx _context.Context - ApiService *StoreApiService + ApiService StoreApi orderId string } @@ -121,7 +180,7 @@ func (a *StoreApiService) DeleteOrderExecute(r ApiDeleteOrderRequest) (*_nethttp type ApiGetInventoryRequest struct { ctx _context.Context - ApiService *StoreApiService + ApiService StoreApi } @@ -236,7 +295,7 @@ func (a *StoreApiService) GetInventoryExecute(r ApiGetInventoryRequest) (map[str type ApiGetOrderByIdRequest struct { ctx _context.Context - ApiService *StoreApiService + ApiService StoreApi orderId int64 } @@ -347,7 +406,7 @@ func (a *StoreApiService) GetOrderByIdExecute(r ApiGetOrderByIdRequest) (Order, type ApiPlaceOrderRequest struct { ctx _context.Context - ApiService *StoreApiService + ApiService StoreApi order *Order } diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_user.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_user.go index 2c7e32333b33..15fa65e12eaa 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_user.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_user.go @@ -22,12 +22,119 @@ var ( _ _context.Context ) +type UserApi interface { + + /* + * 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 + */ + CreateUser(ctx _context.Context) ApiCreateUserRequest + + /* + * CreateUserExecute executes the request + */ + CreateUserExecute(r ApiCreateUserRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + CreateUsersWithArrayInput(ctx _context.Context) ApiCreateUsersWithArrayInputRequest + + /* + * CreateUsersWithArrayInputExecute executes the request + */ + CreateUsersWithArrayInputExecute(r ApiCreateUsersWithArrayInputRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + CreateUsersWithListInput(ctx _context.Context) ApiCreateUsersWithListInputRequest + + /* + * CreateUsersWithListInputExecute executes the request + */ + CreateUsersWithListInputExecute(r ApiCreateUsersWithListInputRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + DeleteUser(ctx _context.Context, username string) ApiDeleteUserRequest + + /* + * DeleteUserExecute executes the request + */ + DeleteUserExecute(r ApiDeleteUserRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + GetUserByName(ctx _context.Context, username string) ApiGetUserByNameRequest + + /* + * GetUserByNameExecute executes the request + * @return User + */ + GetUserByNameExecute(r ApiGetUserByNameRequest) (User, *_nethttp.Response, error) + + /* + * 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 + */ + LoginUser(ctx _context.Context) ApiLoginUserRequest + + /* + * LoginUserExecute executes the request + * @return string + */ + LoginUserExecute(r ApiLoginUserRequest) (string, *_nethttp.Response, error) + + /* + * 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 + */ + LogoutUser(ctx _context.Context) ApiLogoutUserRequest + + /* + * LogoutUserExecute executes the request + */ + LogoutUserExecute(r ApiLogoutUserRequest) (*_nethttp.Response, error) + + /* + * 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 + */ + UpdateUser(ctx _context.Context, username string) ApiUpdateUserRequest + + /* + * UpdateUserExecute executes the request + */ + UpdateUserExecute(r ApiUpdateUserRequest) (*_nethttp.Response, error) +} + // UserApiService UserApi service type UserApiService service type ApiCreateUserRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi user *User } @@ -127,7 +234,7 @@ func (a *UserApiService) CreateUserExecute(r ApiCreateUserRequest) (*_nethttp.Re type ApiCreateUsersWithArrayInputRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi user *[]User } @@ -226,7 +333,7 @@ func (a *UserApiService) CreateUsersWithArrayInputExecute(r ApiCreateUsersWithAr type ApiCreateUsersWithListInputRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi user *[]User } @@ -325,7 +432,7 @@ func (a *UserApiService) CreateUsersWithListInputExecute(r ApiCreateUsersWithLis type ApiDeleteUserRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi username string } @@ -419,7 +526,7 @@ func (a *UserApiService) DeleteUserExecute(r ApiDeleteUserRequest) (*_nethttp.Re type ApiGetUserByNameRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi username string } @@ -523,7 +630,7 @@ func (a *UserApiService) GetUserByNameExecute(r ApiGetUserByNameRequest) (User, type ApiLoginUserRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi username *string password *string } @@ -641,7 +748,7 @@ func (a *UserApiService) LoginUserExecute(r ApiLoginUserRequest) (string, *_neth type ApiLogoutUserRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi } @@ -730,7 +837,7 @@ func (a *UserApiService) LogoutUserExecute(r ApiLogoutUserRequest) (*_nethttp.Re type ApiUpdateUserRequest struct { ctx _context.Context - ApiService *UserApiService + ApiService UserApi username string user *User } diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/client.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/client.go index f38d68a6a607..a4194b6510e3 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/client.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/client.go @@ -47,19 +47,19 @@ type APIClient struct { // API Services - AnotherFakeApi *AnotherFakeApiService + AnotherFakeApi AnotherFakeApi - DefaultApi *DefaultApiService + DefaultApi DefaultApi - FakeApi *FakeApiService + FakeApi FakeApi - FakeClassnameTags123Api *FakeClassnameTags123ApiService + FakeClassnameTags123Api FakeClassnameTags123Api - PetApi *PetApiService + PetApi PetApi - StoreApi *StoreApiService + StoreApi StoreApi - UserApi *UserApiService + UserApi UserApi } type service struct { From 9d6ca297f8b776e7e554bc14cf566839111d7f29 Mon Sep 17 00:00:00 2001 From: Arvind Thirunarayanan Date: Sun, 23 Aug 2020 16:09:08 -0500 Subject: [PATCH 16/16] Add mock to test go-experimental interface --- .../go-experimental/mock/mock_api_pet.go | 89 +++++++++++++++++++ .../petstore/go-experimental/pet_api_test.go | 10 +++ 2 files changed, 99 insertions(+) create mode 100644 samples/client/petstore/go-experimental/mock/mock_api_pet.go diff --git a/samples/client/petstore/go-experimental/mock/mock_api_pet.go b/samples/client/petstore/go-experimental/mock/mock_api_pet.go new file mode 100644 index 000000000000..84686bb5f2e5 --- /dev/null +++ b/samples/client/petstore/go-experimental/mock/mock_api_pet.go @@ -0,0 +1,89 @@ +package mock + +import ( + "context" + "net/http" + + sw "../go-petstore" +) + +// MockPetApi is a mock of the PetApi interface +type MockPetApi struct { +} + +// NewMockPetApi creates a new mock instance +func NewMockPetApi() *MockPetApi { + return &MockPetApi{} +} + +func (m *MockPetApi) AddPet(ctx context.Context) sw.ApiAddPetRequest { + return sw.ApiAddPetRequest{ApiService: m} +} + +func (m *MockPetApi) AddPetExecute(r sw.ApiAddPetRequest) (*http.Response, error) { + return &http.Response{StatusCode:200}, nil +} + +func (m *MockPetApi) DeletePet(ctx context.Context, petId int64) sw.ApiDeletePetRequest { + return sw.ApiDeletePetRequest{ApiService: m} +} + +func (m *MockPetApi) DeletePetExecute(r sw.ApiDeletePetRequest) (*http.Response, error) { + return &http.Response{StatusCode:200}, nil +} + +func (m *MockPetApi) FindPetsByStatus(ctx context.Context) sw.ApiFindPetsByStatusRequest { + return sw.ApiFindPetsByStatusRequest{ApiService: m} +} + +func (m *MockPetApi) FindPetsByStatusExecute(r sw.ApiFindPetsByStatusRequest) ([]sw.Pet, *http.Response, error) { + return []sw.Pet{}, &http.Response{StatusCode:200}, nil +} + +func (m *MockPetApi) FindPetsByTags(ctx context.Context) sw.ApiFindPetsByTagsRequest { + return sw.ApiFindPetsByTagsRequest{ApiService: m} +} + +func (m *MockPetApi) FindPetsByTagsExecute(r sw.ApiFindPetsByTagsRequest) ([]sw.Pet, *http.Response, error) { + return []sw.Pet{}, &http.Response{StatusCode:200}, nil +} + +func (m *MockPetApi) GetPetById(ctx context.Context, petId int64) sw.ApiGetPetByIdRequest { + return sw.ApiGetPetByIdRequest{ApiService: m} +} + +func (m *MockPetApi) GetPetByIdExecute(r sw.ApiGetPetByIdRequest) (sw.Pet, *http.Response, error) { + return sw.Pet{}, &http.Response{StatusCode:200}, nil +} + +func (m *MockPetApi) UpdatePet(ctx context.Context) sw.ApiUpdatePetRequest { + return sw.ApiUpdatePetRequest{ApiService: m} +} + +func (m *MockPetApi) UpdatePetExecute(r sw.ApiUpdatePetRequest) (*http.Response, error) { + return &http.Response{StatusCode:200}, nil +} + +func (m *MockPetApi) UpdatePetWithForm(ctx context.Context, petId int64) sw.ApiUpdatePetWithFormRequest { + return sw.ApiUpdatePetWithFormRequest{ApiService: m} +} + +func (m *MockPetApi) UpdatePetWithFormExecute(r sw.ApiUpdatePetWithFormRequest) (*http.Response, error) { + return &http.Response{StatusCode:200}, nil +} + +func (m *MockPetApi) UploadFile(ctx context.Context, petId int64) sw.ApiUploadFileRequest { + return sw.ApiUploadFileRequest{ApiService: m} +} + +func (m *MockPetApi) UploadFileExecute(r sw.ApiUploadFileRequest) (sw.ApiResponse, *http.Response, error) { + return sw.ApiResponse{}, &http.Response{StatusCode:200}, nil +} + +func (m *MockPetApi) UploadFileWithRequiredFile(ctx context.Context, petId int64) sw.ApiUploadFileWithRequiredFileRequest { + return sw.ApiUploadFileWithRequiredFileRequest{ApiService: m} +} + +func (m *MockPetApi) UploadFileWithRequiredFileExecute(r sw.ApiUploadFileWithRequiredFileRequest) (sw.ApiResponse, *http.Response, error) { + return sw.ApiResponse{}, &http.Response{StatusCode:200}, nil +} diff --git a/samples/client/petstore/go-experimental/pet_api_test.go b/samples/client/petstore/go-experimental/pet_api_test.go index 57afd2923c50..0868c4b96ccb 100644 --- a/samples/client/petstore/go-experimental/pet_api_test.go +++ b/samples/client/petstore/go-experimental/pet_api_test.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/assert" sw "./go-petstore" + mock "./mock" ) var client *sw.APIClient @@ -41,6 +42,15 @@ func TestAddPet(t *testing.T) { } } +func TestAddPetMock(t *testing.T) { + actualApi := client.PetApi + + mockApi := mock.NewMockPetApi() + client.PetApi = mockApi + TestAddPet(t) + client.PetApi = actualApi +} + func TestFindPetsByStatusWithMissingParam(t *testing.T) { _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute()