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 6950cfa4e050..f83783b2d3aa 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 @@ -46,6 +46,8 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege protected String packageName = "openapi"; protected Set numberTypes; + protected boolean usesOptionals = true; + public AbstractGoCodegen() { super(); @@ -400,7 +402,7 @@ public Map postProcessOperationsWithModels(Map o } // import "time" if the operation has a required time parameter. - if (param.required) { + if (param.required || !usesOptionals) { if (!addedTimeImport && "time.Time".equals(param.dataType)) { imports.add(createMapping("import", "time")); addedTimeImport = true; @@ -414,7 +416,7 @@ public Map postProcessOperationsWithModels(Map o } // import "optionals" package if the parameter is optional - if (!param.required) { + if (!param.required && usesOptionals) { if (!addedOptionalImport) { imports.add(createMapping("import", "github.com/antihax/optional")); addedOptionalImport = true; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java index 76d265049693..181363a97289 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java @@ -36,6 +36,8 @@ public GoClientExperimentalCodegen() { outputFolder = "generated-code/go-experimental"; embeddedTemplateDir = templateDir = "go-experimental"; + usesOptionals = false; + generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata).stability(Stability.EXPERIMENTAL).build(); } 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 507fdcfc0ce1..7d9baf079c2c 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/api.mustache +++ b/modules/openapi-generator/src/main/resources/go-experimental/api.mustache @@ -18,115 +18,105 @@ var ( // {{classname}}Service {{classname}} service type {{classname}}Service service -{{#operation}} -{{#hasOptionalParams}} -// {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts Optional parameters for the method '{{{nickname}}}' -type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts struct { -{{#allParams}} -{{^required}} -{{#isPrimitiveType}} -{{^isBinary}} - {{vendorExtensions.x-exportParamName}} optional.{{vendorExtensions.x-optionalDataType}} -{{/isBinary}} -{{#isBinary}} - {{vendorExtensions.x-exportParamName}} optional.Interface -{{/isBinary}} -{{/isPrimitiveType}} -{{^isPrimitiveType}} - {{vendorExtensions.x-exportParamName}} optional.Interface -{{/isPrimitiveType}} -{{/required}} -{{/allParams}} +{{#operation}} +type api{{operationId}}Request struct { + ctx _context.Context + apiService *{{classname}}Service{{#allParams}} + {{paramName}} {{^isPathParam}}*{{/isPathParam}}{{{dataType}}}{{/allParams}} } -{{/hasOptionalParams}} +{{#allParams}}{{^isPathParam}} +func (r api{{operationId}}Request) {{vendorExtensions.x-exportParamName}}({{paramName}} {{{dataType}}}) api{{operationId}}Request { + r.{{paramName}} = &{{paramName}} + return r +} +{{/isPathParam}}{{/allParams}} /* {{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}} {{#notes}} -{{notes}} +{{{unescapedNotes}}} {{/notes}} - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). -{{#allParams}} -{{#required}} - * @param {{paramName}}{{#description}} {{{.}}}{{/description}} -{{/required}} -{{/allParams}} -{{#hasOptionalParams}} - * @param optional nil or *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts - Optional Parameters: -{{#allParams}} -{{^required}} - * @param "{{vendorExtensions.x-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}} + * @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{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*_nethttp.Response, error) { +func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) api{{operationId}}Request { + return api{{operationId}}Request{ + apiService: a, + ctx: ctx,{{#pathParams}} + {{paramName}}: {{paramName}},{{/pathParams}} + } +} + +/* +Execute executes the request +{{#returnType}} @return {{{.}}}{{/returnType}} +*/ +func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnType}}*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.Method{{httpMethod}} localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - {{#returnType}} - localVarReturnValue {{{returnType}}} - {{/returnType}} + {{#returnType}}localVarReturnValue {{{.}}}{{/returnType}} ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "{{{classname}}}Service.{{{nickname}}}") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "{{{classname}}}Service.{{{nickname}}}") if err != nil { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "{{{path}}}"{{#pathParams}} - localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.QueryEscape(parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) , -1){{/pathParams}} + localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.QueryEscape(parameterToString(r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) , -1){{/pathParams}} localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} {{#allParams}} - {{#required}} + {{#required}}{{^isPathParam}} + if r.{{paramName}} == nil { + return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} is required and must be specified") + }{{/isPathParam}} {{#minItems}} - if len({{paramName}}) < {{minItems}} { + if len({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) < {{minItems}} { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minItems}} elements") } {{/minItems}} {{#maxItems}} - if len({{paramName}}) > {{maxItems}} { + if len({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) > {{maxItems}} { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxItems}} elements") } {{/maxItems}} {{#minLength}} - if strlen({{paramName}}) < {{minLength}} { + if strlen({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) < {{minLength}} { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minLength}} elements") } {{/minLength}} {{#maxLength}} - if strlen({{paramName}}) > {{maxLength}} { + if strlen({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) > {{maxLength}} { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxLength}} elements") } {{/maxLength}} {{#minimum}} {{#isString}} - {{paramName}}Txt, err := atoi({{paramName}}) + {{paramName}}Txt, err := atoi({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) if {{paramName}}Txt < {{minimum}} { {{/isString}} {{^isString}} - if {{paramName}} < {{minimum}} { + if {{^isPathParam}}*{{/isPathParam}}r.{{paramName}} < {{minimum}} { {{/isString}} return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must be greater than {{minimum}}") } {{/minimum}} {{#maximum}} {{#isString}} - {{paramName}}Txt, err := atoi({{paramName}}) + {{paramName}}Txt, err := atoi({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) if {{paramName}}Txt > {{maximum}} { {{/isString}} {{^isString}} - if {{paramName}} > {{maximum}} { + if {{^isPathParam}}*{{/isPathParam}}r.{{paramName}} > {{maximum}} { {{/isString}} return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must be less than {{maximum}}") } @@ -134,11 +124,10 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams {{/required}} {{/allParams}} - {{#hasQueryParams}} {{#queryParams}} {{#required}} {{#isCollectionFormatMulti}} - t:={{paramName}} + t := *r.{{paramName}} if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { @@ -149,13 +138,13 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams } {{/isCollectionFormatMulti}} {{^isCollectionFormatMulti}} - localVarQueryParams.Add("{{baseName}}", parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) + localVarQueryParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) {{/isCollectionFormatMulti}} {{/required}} {{^required}} - if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() { + if r.{{paramName}} != nil { {{#isCollectionFormatMulti}} - t:=localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value() + t := *r.{{paramName}} if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { @@ -166,12 +155,11 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams } {{/isCollectionFormatMulti}} {{^isCollectionFormatMulti}} - localVarQueryParams.Add("{{baseName}}", parameterToString(localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) + localVarQueryParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) {{/isCollectionFormatMulti}} } {{/required}} {{/queryParams}} - {{/hasQueryParams}} // to determine the Content-Type header {{=<% %>=}} localVarHTTPContentTypes := []string{<%#consumes%>"<%&mediaType%>"<%^-last%>, <%/-last%><%/consumes%>} @@ -193,33 +181,26 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } -{{#hasHeaderParams}} {{#headerParams}} {{#required}} - localVarHeaderParams["{{baseName}}"] = parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}") + localVarHeaderParams["{{baseName}}"] = parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}") {{/required}} {{^required}} - if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() { - localVarHeaderParams["{{baseName}}"] = parameterToString(localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}") + if r.{{paramName}} != nil { + localVarHeaderParams["{{baseName}}"] = parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}") } {{/required}} {{/headerParams}} -{{/hasHeaderParams}} -{{#hasFormParams}} {{#formParams}} {{#isFile}} localVarFormFileName = "{{baseName}}" {{#required}} - localVarFile := {{paramName}} + localVarFile := *r.{{paramName}} {{/required}} {{^required}} var localVarFile {{dataType}} - if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() { - localVarFileOk := false - localVarFile, localVarFileOk = localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value().({{dataType}}) - if !localVarFileOk { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} should be {{dataType}}") - } + if r.{{paramName}} != nil { + localVarFile = *r.{{paramName}} } {{/required}} if localVarFile != nil { @@ -231,12 +212,12 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams {{/isFile}} {{^isFile}} {{#required}} - localVarFormParams.Add("{{baseName}}", parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) + localVarFormParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) {{/required}} {{^required}} {{#isModel}} - if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() { - paramJson, err := parameterToJson(localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value()) + if r.{{paramName}} != nil { + paramJson, err := parameterToJson(*r.{{paramName}}) if err != nil { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err } @@ -244,43 +225,23 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams } {{/isModel}} {{^isModel}} - if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() { - localVarFormParams.Add("{{baseName}}", parameterToString(localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) + if r.{{paramName}} != nil { + localVarFormParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) } {{/isModel}} {{/required}} {{/isFile}} {{/formParams}} -{{/hasFormParams}} -{{#hasBodyParam}} {{#bodyParams}} // body params -{{#required}} - localVarPostBody = &{{paramName}} -{{/required}} -{{^required}} - if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() { - {{#isPrimitiveType}} - localVarPostBody = localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value() - {{/isPrimitiveType}} - {{^isPrimitiveType}} - localVarOptional{{vendorExtensions.x-exportParamName}}, localVarOptional{{vendorExtensions.x-exportParamName}}ok := localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value().({{{dataType}}}) - if !localVarOptional{{vendorExtensions.x-exportParamName}}ok { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} should be {{dataType}}") - } - localVarPostBody = &localVarOptional{{vendorExtensions.x-exportParamName}} - {{/isPrimitiveType}} - } - -{{/required}} + localVarPostBody = r.{{paramName}} {{/bodyParams}} -{{/hasBodyParam}} {{#authMethods}} {{#isApiKey}} {{^isKeyInCookie}} - if ctx != nil { + if r.ctx != nil { // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { if auth, ok := auth["{{keyParamName}}"]; ok { var key string if auth.Prefix != "" { @@ -300,12 +261,12 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams {{/isKeyInCookie}} {{/isApiKey}} {{/authMethods}} - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err } @@ -327,7 +288,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams if localVarHTTPResponse.StatusCode == {{{code}}} { {{/wildcard}} var v {{{dataType}}} - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, newErr @@ -345,7 +306,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams } {{#returnType}} - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, diff --git a/modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache b/modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache index d7eda37d714e..6b5c236d398a 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache @@ -14,29 +14,28 @@ Method | HTTP request | Description ## {{{operationId}}} -> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}(ctx, {{#allParams}}{{#required}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}optional{{/hasOptionalParams}}) +> {{#returnType}}{{{.}}} {{/returnType}}{{{operationId}}}(ctx{{#pathParams}}, {{paramName}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{vendorExtensions.x-exportParamName}}({{paramName}}){{/isPathParam}}{{/allParams}}.Execute() {{{summary}}}{{#notes}} -{{{notes}}}{{/notes}} +{{{unespacedNotes}}}{{/notes}} -### Required Parameters +### Path Parameters -{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#pathParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.{{/-last}}{{/allParams}}{{#allParams}}{{#required}} -**{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{#hasOptionalParams}} - **optional** | ***{{{nickname}}}Opts** | optional parameters | nil if no parameters +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.{{/-last}}{{/pathParams}}{{#pathParams}} +**{{paramName}}** | {{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/pathParams}} -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a {{{nickname}}}Opts struct +Other parameters are passed through a pointer to a api{{{nickname}}}Request struct via the builder pattern {{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}} -{{^required}} **{{paramName}}** | {{#isFile}}**optional.Interface of {{dataType}}**{{/isFile}}{{#isPrimitiveType}}**optional.{{vendorExtensions.x-optionalDataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**optional.Interface of {{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{/hasOptionalParams}} +{{^isPathParam}} **{{paramName}}** | {{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/isPathParam}}{{/allParams}} ### Return type diff --git a/samples/client/petstore/go-experimental/auth_test.go b/samples/client/petstore/go-experimental/auth_test.go index b788cc1199e3..0e532aeff3ac 100644 --- a/samples/client/petstore/go-experimental/auth_test.go +++ b/samples/client/petstore/go-experimental/auth_test.go @@ -41,7 +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")}}}) - r, err := client.PetApi.AddPet(context.Background(), newPet) + r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -50,7 +50,7 @@ func TestOAuth2(t *testing.T) { t.Log(r) } - r, err = client.PetApi.DeletePet(auth, 12992, nil) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -76,7 +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")}}}) - r, err := client.PetApi.AddPet(auth, newPet) + r, err := client.PetApi.AddPet(auth).Body(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -85,7 +85,7 @@ func TestBasicAuth(t *testing.T) { t.Log(r) } - r, err = client.PetApi.DeletePet(auth, 12992, nil) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -106,7 +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")}}}) - r, err := client.PetApi.AddPet(nil, newPet) + r, err := client.PetApi.AddPet(nil).Body(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -115,7 +115,7 @@ func TestAccessToken(t *testing.T) { t.Log(r) } - r, err = client.PetApi.DeletePet(auth, 12992, nil) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -136,7 +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")}}}) - r, err := client.PetApi.AddPet(context.Background(), newPet) + r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -145,7 +145,7 @@ func TestAPIKeyNoPrefix(t *testing.T) { t.Log(r) } - _, r, err = client.PetApi.GetPetById(auth, 12992) + _, r, err = client.PetApi.GetPetById(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -155,7 +155,7 @@ func TestAPIKeyNoPrefix(t *testing.T) { t.Errorf("APIKey Authentication is missing") } - r, err = client.PetApi.DeletePet(auth, 12992, nil) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -171,7 +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")}}}) - r, err := client.PetApi.AddPet(nil, newPet) + r, err := client.PetApi.AddPet(nil).Body(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -180,7 +180,7 @@ func TestAPIKeyWithPrefix(t *testing.T) { t.Log(r) } - _, r, err = client.PetApi.GetPetById(auth, 12992) + _, r, err = client.PetApi.GetPetById(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -190,7 +190,7 @@ func TestAPIKeyWithPrefix(t *testing.T) { t.Errorf("APIKey Authentication is missing") } - r, err = client.PetApi.DeletePet(auth, 12992, nil) + r, err = client.PetApi.DeletePet(auth, 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) } @@ -204,7 +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")}}}) - r, err := client.PetApi.AddPet(context.Background(), newPet) + r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -213,7 +213,7 @@ func TestDefaultHeader(t *testing.T) { t.Log(r) } - r, err = client.PetApi.DeletePet(context.Background(), 12992, nil) + r, err = client.PetApi.DeletePet(context.Background(), 12992).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -228,7 +228,7 @@ func TestDefaultHeader(t *testing.T) { } func TestHostOverride(t *testing.T) { - _, r, err := client.PetApi.FindPetsByStatus(context.Background(), nil) + _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute() if err != nil { t.Fatalf("Error while finding pets by status: %v", err) @@ -240,7 +240,7 @@ func TestHostOverride(t *testing.T) { } func TestSchemeOverride(t *testing.T) { - _, r, err := client.PetApi.FindPetsByStatus(context.Background(), nil) + _, 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 e97bcb4846a8..d27137eeacfa 100644 --- a/samples/client/petstore/go-experimental/fake_api_test.go +++ b/samples/client/petstore/go-experimental/fake_api_test.go @@ -1,10 +1,10 @@ package main import ( + "context" "testing" sw "./go-petstore" - "golang.org/x/net/context" ) // TestPutBodyWithFileSchema ensures a model with the name 'File' @@ -17,7 +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")}}} - r, err := client.FakeApi.TestBodyWithFileSchema(context.Background(), schema) + 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/api_another_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go index f5e420b84fa3..f58c0d405f35 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,14 +24,36 @@ var ( // AnotherFakeApiService AnotherFakeApi service type AnotherFakeApiService service +type apiCall123TestSpecialTagsRequest struct { + ctx _context.Context + apiService *AnotherFakeApiService + body *Client +} + + +func (r apiCall123TestSpecialTagsRequest) Body(body Client) apiCall123TestSpecialTagsRequest { + r.body = &body + return r +} + /* Call123TestSpecialTags To test special tags To test special tags and operation ID starting with number * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body client model -@return Client +@return apiCall123TestSpecialTagsRequest */ -func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) { +func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context) apiCall123TestSpecialTagsRequest { + return apiCall123TestSpecialTagsRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return Client +*/ +func (r apiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -41,7 +63,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, bod localVarReturnValue Client ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "AnotherFakeApiService.Call123TestSpecialTags") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "AnotherFakeApiService.Call123TestSpecialTags") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -51,6 +73,10 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, bod localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -70,13 +96,13 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, bod localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -94,7 +120,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, bod } if localVarHTTPResponse.StatusCode == 200 { var v Client - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -104,7 +130,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, bod return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, diff --git a/samples/client/petstore/go-experimental/go-petstore/api_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_fake.go index e055cf26d653..0a9b9b5f7439 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_fake.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_fake.go @@ -14,8 +14,8 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - "github.com/antihax/optional" "os" + "time" "reflect" ) @@ -27,22 +27,46 @@ var ( // FakeApiService FakeApi service type FakeApiService service +type apiCreateXmlItemRequest struct { + ctx _context.Context + apiService *FakeApiService + xmlItem *XmlItem +} + + +func (r apiCreateXmlItemRequest) XmlItem(xmlItem XmlItem) apiCreateXmlItemRequest { + r.xmlItem = &xmlItem + return r +} + /* CreateXmlItem creates an XmlItem this route creates an XmlItem * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param xmlItem XmlItem Body +@return apiCreateXmlItemRequest +*/ +func (a *FakeApiService) CreateXmlItem(ctx _context.Context) apiCreateXmlItemRequest { + return apiCreateXmlItemRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *FakeApiService) CreateXmlItem(ctx _context.Context, xmlItem XmlItem) (*_nethttp.Response, error) { +func (r apiCreateXmlItemRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.CreateXmlItem") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.CreateXmlItem") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -52,6 +76,10 @@ func (a *FakeApiService) CreateXmlItem(ctx _context.Context, xmlItem XmlItem) (* localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.xmlItem == nil { + return nil, reportError("xmlItem is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16"} @@ -71,13 +99,13 @@ func (a *FakeApiService) CreateXmlItem(ctx _context.Context, xmlItem XmlItem) (* localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &xmlItem - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.xmlItem + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -98,21 +126,36 @@ func (a *FakeApiService) CreateXmlItem(ctx _context.Context, xmlItem XmlItem) (* return localVarHTTPResponse, nil } +type apiFakeOuterBooleanSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + body *bool +} + -// FakeOuterBooleanSerializeOpts Optional parameters for the method 'FakeOuterBooleanSerialize' -type FakeOuterBooleanSerializeOpts struct { - Body optional.Bool +func (r apiFakeOuterBooleanSerializeRequest) Body(body bool) apiFakeOuterBooleanSerializeRequest { + r.body = &body + return r } /* FakeOuterBooleanSerialize Method for FakeOuterBooleanSerialize Test serialization of outer boolean types * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param optional nil or *FakeOuterBooleanSerializeOpts - Optional Parameters: - * @param "Body" (optional.Bool) - Input boolean as post body -@return bool +@return apiFakeOuterBooleanSerializeRequest */ -func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *_nethttp.Response, error) { +func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context) apiFakeOuterBooleanSerializeRequest { + return apiFakeOuterBooleanSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return bool +*/ +func (r apiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -122,7 +165,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa localVarReturnValue bool ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.FakeOuterBooleanSerialize") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterBooleanSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -132,7 +175,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -151,16 +194,13 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - if localVarOptionals != nil && localVarOptionals.Body.IsSet() { - localVarPostBody = localVarOptionals.Body.Value() - } - - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -178,7 +218,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa } if localVarHTTPResponse.StatusCode == 200 { var v bool - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -188,7 +228,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -199,21 +239,36 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa return localVarReturnValue, localVarHTTPResponse, nil } +type apiFakeOuterCompositeSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + body *OuterComposite +} -// FakeOuterCompositeSerializeOpts Optional parameters for the method 'FakeOuterCompositeSerialize' -type FakeOuterCompositeSerializeOpts struct { - Body optional.Interface + +func (r apiFakeOuterCompositeSerializeRequest) Body(body OuterComposite) apiFakeOuterCompositeSerializeRequest { + r.body = &body + return r } /* FakeOuterCompositeSerialize Method for FakeOuterCompositeSerialize Test serialization of object with outer number type * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param optional nil or *FakeOuterCompositeSerializeOpts - Optional Parameters: - * @param "Body" (optional.Interface of OuterComposite) - Input composite as post body -@return OuterComposite +@return apiFakeOuterCompositeSerializeRequest +*/ +func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context) apiFakeOuterCompositeSerializeRequest { + return apiFakeOuterCompositeSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return OuterComposite */ -func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *_nethttp.Response, error) { +func (r apiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -223,7 +278,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local localVarReturnValue OuterComposite ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.FakeOuterCompositeSerialize") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterCompositeSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -233,7 +288,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -252,20 +307,13 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - if localVarOptionals != nil && localVarOptionals.Body.IsSet() { - localVarOptionalBody, localVarOptionalBodyok := localVarOptionals.Body.Value().(OuterComposite) - if !localVarOptionalBodyok { - return localVarReturnValue, nil, reportError("body should be OuterComposite") - } - localVarPostBody = &localVarOptionalBody - } - - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -283,7 +331,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local } if localVarHTTPResponse.StatusCode == 200 { var v OuterComposite - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -293,7 +341,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -304,21 +352,36 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local return localVarReturnValue, localVarHTTPResponse, nil } +type apiFakeOuterNumberSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + body *float32 +} + -// FakeOuterNumberSerializeOpts Optional parameters for the method 'FakeOuterNumberSerialize' -type FakeOuterNumberSerializeOpts struct { - Body optional.Float32 +func (r apiFakeOuterNumberSerializeRequest) Body(body float32) apiFakeOuterNumberSerializeRequest { + r.body = &body + return r } /* FakeOuterNumberSerialize Method for FakeOuterNumberSerialize Test serialization of outer number types * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param optional nil or *FakeOuterNumberSerializeOpts - Optional Parameters: - * @param "Body" (optional.Float32) - Input number as post body -@return float32 +@return apiFakeOuterNumberSerializeRequest */ -func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *_nethttp.Response, error) { +func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context) apiFakeOuterNumberSerializeRequest { + return apiFakeOuterNumberSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return float32 +*/ +func (r apiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -328,7 +391,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar localVarReturnValue float32 ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.FakeOuterNumberSerialize") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterNumberSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -338,7 +401,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -357,16 +420,13 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - if localVarOptionals != nil && localVarOptionals.Body.IsSet() { - localVarPostBody = localVarOptionals.Body.Value() - } - - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -384,7 +444,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar } if localVarHTTPResponse.StatusCode == 200 { var v float32 - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -394,7 +454,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -405,21 +465,36 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar return localVarReturnValue, localVarHTTPResponse, nil } +type apiFakeOuterStringSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + body *string +} -// FakeOuterStringSerializeOpts Optional parameters for the method 'FakeOuterStringSerialize' -type FakeOuterStringSerializeOpts struct { - Body optional.String + +func (r apiFakeOuterStringSerializeRequest) Body(body string) apiFakeOuterStringSerializeRequest { + r.body = &body + return r } /* FakeOuterStringSerialize Method for FakeOuterStringSerialize Test serialization of outer string types * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param optional nil or *FakeOuterStringSerializeOpts - Optional Parameters: - * @param "Body" (optional.String) - Input string as post body -@return string +@return apiFakeOuterStringSerializeRequest +*/ +func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context) apiFakeOuterStringSerializeRequest { + return apiFakeOuterStringSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return string */ -func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *_nethttp.Response, error) { +func (r apiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -429,7 +504,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar localVarReturnValue string ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.FakeOuterStringSerialize") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterStringSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -439,7 +514,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -458,16 +533,13 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - if localVarOptionals != nil && localVarOptionals.Body.IsSet() { - localVarPostBody = localVarOptionals.Body.Value() - } - - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -485,7 +557,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar } if localVarHTTPResponse.StatusCode == 200 { var v string - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -495,7 +567,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -506,23 +578,46 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar return localVarReturnValue, localVarHTTPResponse, nil } +type apiTestBodyWithFileSchemaRequest struct { + ctx _context.Context + apiService *FakeApiService + body *FileSchemaTestClass +} + + +func (r apiTestBodyWithFileSchemaRequest) Body(body FileSchemaTestClass) apiTestBodyWithFileSchemaRequest { + r.body = &body + return r +} /* TestBodyWithFileSchema Method for TestBodyWithFileSchema -For this test, the body for this request much reference a schema named `File`. +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 +@return apiTestBodyWithFileSchemaRequest +*/ +func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context) apiTestBodyWithFileSchemaRequest { + return apiTestBodyWithFileSchemaRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, body FileSchemaTestClass) (*_nethttp.Response, error) { +func (r apiTestBodyWithFileSchemaRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestBodyWithFileSchema") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithFileSchema") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -532,6 +627,10 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, body FileS localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.body == nil { + return nil, reportError("body is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -551,13 +650,13 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, body FileS localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -578,23 +677,51 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, body FileS return localVarHTTPResponse, nil } +type apiTestBodyWithQueryParamsRequest struct { + ctx _context.Context + apiService *FakeApiService + query *string + body *User +} + + +func (r apiTestBodyWithQueryParamsRequest) Query(query string) apiTestBodyWithQueryParamsRequest { + r.query = &query + return r +} + +func (r apiTestBodyWithQueryParamsRequest) Body(body User) apiTestBodyWithQueryParamsRequest { + r.body = &body + return r +} /* TestBodyWithQueryParams Method for TestBodyWithQueryParams * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param query - * @param body +@return apiTestBodyWithQueryParamsRequest */ -func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query string, body User) (*_nethttp.Response, error) { +func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context) apiTestBodyWithQueryParamsRequest { + return apiTestBodyWithQueryParamsRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + +*/ +func (r apiTestBodyWithQueryParamsRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestBodyWithQueryParams") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithQueryParams") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -604,8 +731,16 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query str localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.query == nil { + return nil, reportError("query is required and must be specified") + } + + if r.body == nil { + return nil, reportError("body is required and must be specified") + } - localVarQueryParams.Add("query", parameterToString(query, "")) + localVarQueryParams.Add("query", parameterToString(*r.query, "")) // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -624,13 +759,13 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query str localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -651,15 +786,36 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query str return localVarHTTPResponse, nil } +type apiTestClientModelRequest struct { + ctx _context.Context + apiService *FakeApiService + body *Client +} + + +func (r apiTestClientModelRequest) Body(body Client) apiTestClientModelRequest { + r.body = &body + return r +} /* TestClientModel To test \"client\" model -To test \"client\" model +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 apiTestClientModelRequest */ -func (a *FakeApiService) TestClientModel(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) { +func (a *FakeApiService) TestClientModel(ctx _context.Context) apiTestClientModelRequest { + return apiTestClientModelRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return Client +*/ +func (r apiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -669,7 +825,7 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, body Client) (Cli localVarReturnValue Client ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestClientModel") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestClientModel") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -679,6 +835,10 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, body Client) (Cli localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -698,13 +858,13 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, body Client) (Cli localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -722,7 +882,7 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, body Client) (Cli } if localVarHTTPResponse.StatusCode == 200 { var v Client - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -732,7 +892,7 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, body Client) (Cli return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -743,51 +903,127 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, body Client) (Cli return localVarReturnValue, localVarHTTPResponse, nil } +type apiTestEndpointParametersRequest struct { + ctx _context.Context + apiService *FakeApiService + number *float32 + double *float64 + patternWithoutDelimiter *string + byte_ *string + integer *int32 + int32_ *int32 + int64_ *int64 + float *float32 + string_ *string + binary **os.File + date *string + dateTime *time.Time + password *string + callback *string +} + + +func (r apiTestEndpointParametersRequest) Number(number float32) apiTestEndpointParametersRequest { + r.number = &number + return r +} + +func (r apiTestEndpointParametersRequest) Double(double float64) apiTestEndpointParametersRequest { + r.double = &double + return r +} + +func (r apiTestEndpointParametersRequest) PatternWithoutDelimiter(patternWithoutDelimiter string) apiTestEndpointParametersRequest { + r.patternWithoutDelimiter = &patternWithoutDelimiter + return r +} + +func (r apiTestEndpointParametersRequest) Byte_(byte_ string) apiTestEndpointParametersRequest { + r.byte_ = &byte_ + return r +} -// TestEndpointParametersOpts Optional parameters for the method 'TestEndpointParameters' -type TestEndpointParametersOpts struct { - Integer optional.Int32 - Int32_ optional.Int32 - Int64_ optional.Int64 - Float optional.Float32 - String_ optional.String - Binary optional.Interface - Date optional.String - DateTime optional.Time - Password optional.String - Callback optional.String +func (r apiTestEndpointParametersRequest) Integer(integer int32) apiTestEndpointParametersRequest { + r.integer = &integer + return r +} + +func (r apiTestEndpointParametersRequest) Int32_(int32_ int32) apiTestEndpointParametersRequest { + r.int32_ = &int32_ + return r +} + +func (r apiTestEndpointParametersRequest) Int64_(int64_ int64) apiTestEndpointParametersRequest { + r.int64_ = &int64_ + return r +} + +func (r apiTestEndpointParametersRequest) Float(float float32) apiTestEndpointParametersRequest { + r.float = &float + return r +} + +func (r apiTestEndpointParametersRequest) String_(string_ string) apiTestEndpointParametersRequest { + r.string_ = &string_ + return r +} + +func (r apiTestEndpointParametersRequest) Binary(binary *os.File) apiTestEndpointParametersRequest { + r.binary = &binary + return r +} + +func (r apiTestEndpointParametersRequest) Date(date string) apiTestEndpointParametersRequest { + r.date = &date + return r +} + +func (r apiTestEndpointParametersRequest) DateTime(dateTime time.Time) apiTestEndpointParametersRequest { + r.dateTime = &dateTime + return r +} + +func (r apiTestEndpointParametersRequest) Password(password string) apiTestEndpointParametersRequest { + r.password = &password + return r +} + +func (r apiTestEndpointParametersRequest) Callback(callback string) apiTestEndpointParametersRequest { + r.callback = &callback + return r } /* TestEndpointParameters Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +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 +@return apiTestEndpointParametersRequest +*/ +func (a *FakeApiService) TestEndpointParameters(ctx _context.Context) apiTestEndpointParametersRequest { + return apiTestEndpointParametersRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*_nethttp.Response, error) { +func (r apiTestEndpointParametersRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestEndpointParameters") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEndpointParameters") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -797,19 +1033,35 @@ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number flo localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if number < 32.1 { + + if r.number == nil { + return nil, reportError("number is required and must be specified") + } + if *r.number < 32.1 { return nil, reportError("number must be greater than 32.1") } - if number > 543.2 { + if *r.number > 543.2 { return nil, reportError("number must be less than 543.2") } - if double < 67.8 { + + if r.double == nil { + return nil, reportError("double is required and must be specified") + } + if *r.double < 67.8 { return nil, reportError("double must be greater than 67.8") } - if double > 123.4 { + if *r.double > 123.4 { return nil, reportError("double must be less than 123.4") } - + + if r.patternWithoutDelimiter == nil { + return nil, reportError("patternWithoutDelimiter is required and must be specified") + } + + if r.byte_ == nil { + return nil, reportError("byte_ is required and must be specified") + } + // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"} @@ -827,33 +1079,29 @@ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number flo if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if localVarOptionals != nil && localVarOptionals.Integer.IsSet() { - localVarFormParams.Add("integer", parameterToString(localVarOptionals.Integer.Value(), "")) + if r.integer != nil { + localVarFormParams.Add("integer", parameterToString(*r.integer, "")) } - if localVarOptionals != nil && localVarOptionals.Int32_.IsSet() { - localVarFormParams.Add("int32", parameterToString(localVarOptionals.Int32_.Value(), "")) + if r.int32_ != nil { + localVarFormParams.Add("int32", parameterToString(*r.int32_, "")) } - if localVarOptionals != nil && localVarOptionals.Int64_.IsSet() { - localVarFormParams.Add("int64", parameterToString(localVarOptionals.Int64_.Value(), "")) + if r.int64_ != nil { + localVarFormParams.Add("int64", parameterToString(*r.int64_, "")) } - localVarFormParams.Add("number", parameterToString(number, "")) - if localVarOptionals != nil && localVarOptionals.Float.IsSet() { - localVarFormParams.Add("float", parameterToString(localVarOptionals.Float.Value(), "")) + localVarFormParams.Add("number", parameterToString(*r.number, "")) + if r.float != nil { + localVarFormParams.Add("float", parameterToString(*r.float, "")) } - localVarFormParams.Add("double", parameterToString(double, "")) - if localVarOptionals != nil && localVarOptionals.String_.IsSet() { - localVarFormParams.Add("string", parameterToString(localVarOptionals.String_.Value(), "")) + localVarFormParams.Add("double", parameterToString(*r.double, "")) + if r.string_ != nil { + localVarFormParams.Add("string", parameterToString(*r.string_, "")) } - localVarFormParams.Add("pattern_without_delimiter", parameterToString(patternWithoutDelimiter, "")) - localVarFormParams.Add("byte", parameterToString(byte_, "")) + localVarFormParams.Add("pattern_without_delimiter", parameterToString(*r.patternWithoutDelimiter, "")) + localVarFormParams.Add("byte", parameterToString(*r.byte_, "")) localVarFormFileName = "binary" var localVarFile *os.File - if localVarOptionals != nil && localVarOptionals.Binary.IsSet() { - localVarFileOk := false - localVarFile, localVarFileOk = localVarOptionals.Binary.Value().(*os.File) - if !localVarFileOk { - return nil, reportError("binary should be *os.File") - } + if r.binary != nil { + localVarFile = *r.binary } if localVarFile != nil { fbs, _ := _ioutil.ReadAll(localVarFile) @@ -861,24 +1109,24 @@ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number flo localVarFileName = localVarFile.Name() localVarFile.Close() } - if localVarOptionals != nil && localVarOptionals.Date.IsSet() { - localVarFormParams.Add("date", parameterToString(localVarOptionals.Date.Value(), "")) + if r.date != nil { + localVarFormParams.Add("date", parameterToString(*r.date, "")) } - if localVarOptionals != nil && localVarOptionals.DateTime.IsSet() { - localVarFormParams.Add("dateTime", parameterToString(localVarOptionals.DateTime.Value(), "")) + if r.dateTime != nil { + localVarFormParams.Add("dateTime", parameterToString(*r.dateTime, "")) } - if localVarOptionals != nil && localVarOptionals.Password.IsSet() { - localVarFormParams.Add("password", parameterToString(localVarOptionals.Password.Value(), "")) + if r.password != nil { + localVarFormParams.Add("password", parameterToString(*r.password, "")) } - if localVarOptionals != nil && localVarOptionals.Callback.IsSet() { - localVarFormParams.Add("callback", parameterToString(localVarOptionals.Callback.Value(), "")) + if r.callback != nil { + localVarFormParams.Add("callback", parameterToString(*r.callback, "")) } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -899,43 +1147,88 @@ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number flo return localVarHTTPResponse, nil } +type apiTestEnumParametersRequest struct { + ctx _context.Context + apiService *FakeApiService + enumHeaderStringArray *[]string + enumHeaderString *string + enumQueryStringArray *[]string + enumQueryString *string + enumQueryInteger *int32 + enumQueryDouble *float64 + enumFormStringArray *[]string + enumFormString *string +} + + +func (r apiTestEnumParametersRequest) EnumHeaderStringArray(enumHeaderStringArray []string) apiTestEnumParametersRequest { + r.enumHeaderStringArray = &enumHeaderStringArray + return r +} -// TestEnumParametersOpts Optional parameters for the method 'TestEnumParameters' -type TestEnumParametersOpts struct { - EnumHeaderStringArray optional.Interface - EnumHeaderString optional.String - EnumQueryStringArray optional.Interface - EnumQueryString optional.String - EnumQueryInteger optional.Int32 - EnumQueryDouble optional.Float64 - EnumFormStringArray optional.Interface - EnumFormString optional.String +func (r apiTestEnumParametersRequest) EnumHeaderString(enumHeaderString string) apiTestEnumParametersRequest { + r.enumHeaderString = &enumHeaderString + return r +} + +func (r apiTestEnumParametersRequest) EnumQueryStringArray(enumQueryStringArray []string) apiTestEnumParametersRequest { + r.enumQueryStringArray = &enumQueryStringArray + return r +} + +func (r apiTestEnumParametersRequest) EnumQueryString(enumQueryString string) apiTestEnumParametersRequest { + r.enumQueryString = &enumQueryString + return r +} + +func (r apiTestEnumParametersRequest) EnumQueryInteger(enumQueryInteger int32) apiTestEnumParametersRequest { + r.enumQueryInteger = &enumQueryInteger + return r +} + +func (r apiTestEnumParametersRequest) EnumQueryDouble(enumQueryDouble float64) apiTestEnumParametersRequest { + r.enumQueryDouble = &enumQueryDouble + return r +} + +func (r apiTestEnumParametersRequest) EnumFormStringArray(enumFormStringArray []string) apiTestEnumParametersRequest { + r.enumFormStringArray = &enumFormStringArray + return r +} + +func (r apiTestEnumParametersRequest) EnumFormString(enumFormString string) apiTestEnumParametersRequest { + r.enumFormString = &enumFormString + return r } /* TestEnumParameters To test enum parameters To test enum parameters * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @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) +@return apiTestEnumParametersRequest +*/ +func (a *FakeApiService) TestEnumParameters(ctx _context.Context) apiTestEnumParametersRequest { + return apiTestEnumParametersRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOptionals *TestEnumParametersOpts) (*_nethttp.Response, error) { +func (r apiTestEnumParametersRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestEnumParameters") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEnumParameters") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -945,18 +1238,18 @@ func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOption localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - - if localVarOptionals != nil && localVarOptionals.EnumQueryStringArray.IsSet() { - localVarQueryParams.Add("enum_query_string_array", parameterToString(localVarOptionals.EnumQueryStringArray.Value(), "csv")) + + if r.enumQueryStringArray != nil { + localVarQueryParams.Add("enum_query_string_array", parameterToString(*r.enumQueryStringArray, "csv")) } - if localVarOptionals != nil && localVarOptionals.EnumQueryString.IsSet() { - localVarQueryParams.Add("enum_query_string", parameterToString(localVarOptionals.EnumQueryString.Value(), "")) + if r.enumQueryString != nil { + localVarQueryParams.Add("enum_query_string", parameterToString(*r.enumQueryString, "")) } - if localVarOptionals != nil && localVarOptionals.EnumQueryInteger.IsSet() { - localVarQueryParams.Add("enum_query_integer", parameterToString(localVarOptionals.EnumQueryInteger.Value(), "")) + if r.enumQueryInteger != nil { + localVarQueryParams.Add("enum_query_integer", parameterToString(*r.enumQueryInteger, "")) } - if localVarOptionals != nil && localVarOptionals.EnumQueryDouble.IsSet() { - localVarQueryParams.Add("enum_query_double", parameterToString(localVarOptionals.EnumQueryDouble.Value(), "")) + if r.enumQueryDouble != nil { + localVarQueryParams.Add("enum_query_double", parameterToString(*r.enumQueryDouble, "")) } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"} @@ -975,24 +1268,24 @@ func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOption if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if localVarOptionals != nil && localVarOptionals.EnumHeaderStringArray.IsSet() { - localVarHeaderParams["enum_header_string_array"] = parameterToString(localVarOptionals.EnumHeaderStringArray.Value(), "csv") + if r.enumHeaderStringArray != nil { + localVarHeaderParams["enum_header_string_array"] = parameterToString(*r.enumHeaderStringArray, "csv") } - if localVarOptionals != nil && localVarOptionals.EnumHeaderString.IsSet() { - localVarHeaderParams["enum_header_string"] = parameterToString(localVarOptionals.EnumHeaderString.Value(), "") + if r.enumHeaderString != nil { + localVarHeaderParams["enum_header_string"] = parameterToString(*r.enumHeaderString, "") } - if localVarOptionals != nil && localVarOptionals.EnumFormStringArray.IsSet() { - localVarFormParams.Add("enum_form_string_array", parameterToString(localVarOptionals.EnumFormStringArray.Value(), "csv")) + if r.enumFormStringArray != nil { + localVarFormParams.Add("enum_form_string_array", parameterToString(*r.enumFormStringArray, "csv")) } - if localVarOptionals != nil && localVarOptionals.EnumFormString.IsSet() { - localVarFormParams.Add("enum_form_string", parameterToString(localVarOptionals.EnumFormString.Value(), "")) + if r.enumFormString != nil { + localVarFormParams.Add("enum_form_string", parameterToString(*r.enumFormString, "")) } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1013,36 +1306,76 @@ func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOption return localVarHTTPResponse, nil } +type apiTestGroupParametersRequest struct { + ctx _context.Context + apiService *FakeApiService + requiredStringGroup *int32 + requiredBooleanGroup *bool + requiredInt64Group *int64 + stringGroup *int32 + booleanGroup *bool + int64Group *int64 +} + -// TestGroupParametersOpts Optional parameters for the method 'TestGroupParameters' -type TestGroupParametersOpts struct { - StringGroup optional.Int32 - BooleanGroup optional.Bool - Int64Group optional.Int64 +func (r apiTestGroupParametersRequest) RequiredStringGroup(requiredStringGroup int32) apiTestGroupParametersRequest { + r.requiredStringGroup = &requiredStringGroup + return r +} + +func (r apiTestGroupParametersRequest) RequiredBooleanGroup(requiredBooleanGroup bool) apiTestGroupParametersRequest { + r.requiredBooleanGroup = &requiredBooleanGroup + return r +} + +func (r apiTestGroupParametersRequest) RequiredInt64Group(requiredInt64Group int64) apiTestGroupParametersRequest { + r.requiredInt64Group = &requiredInt64Group + return r +} + +func (r apiTestGroupParametersRequest) StringGroup(stringGroup int32) apiTestGroupParametersRequest { + r.stringGroup = &stringGroup + return r +} + +func (r apiTestGroupParametersRequest) BooleanGroup(booleanGroup bool) apiTestGroupParametersRequest { + r.booleanGroup = &booleanGroup + return r +} + +func (r apiTestGroupParametersRequest) Int64Group(int64Group int64) apiTestGroupParametersRequest { + r.int64Group = &int64Group + return r } /* TestGroupParameters Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @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 +@return apiTestGroupParametersRequest +*/ +func (a *FakeApiService) TestGroupParameters(ctx _context.Context) apiTestGroupParametersRequest { + return apiTestGroupParametersRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStringGroup int32, requiredBooleanGroup bool, requiredInt64Group int64, localVarOptionals *TestGroupParametersOpts) (*_nethttp.Response, error) { +func (r apiTestGroupParametersRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestGroupParameters") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestGroupParameters") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1052,14 +1385,26 @@ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStrin localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - - localVarQueryParams.Add("required_string_group", parameterToString(requiredStringGroup, "")) - localVarQueryParams.Add("required_int64_group", parameterToString(requiredInt64Group, "")) - if localVarOptionals != nil && localVarOptionals.StringGroup.IsSet() { - localVarQueryParams.Add("string_group", parameterToString(localVarOptionals.StringGroup.Value(), "")) + + if r.requiredStringGroup == nil { + return nil, reportError("requiredStringGroup is required and must be specified") + } + + if r.requiredBooleanGroup == nil { + return nil, reportError("requiredBooleanGroup is required and must be specified") + } + + if r.requiredInt64Group == nil { + return nil, reportError("requiredInt64Group is required and must be specified") + } + + localVarQueryParams.Add("required_string_group", parameterToString(*r.requiredStringGroup, "")) + localVarQueryParams.Add("required_int64_group", parameterToString(*r.requiredInt64Group, "")) + if r.stringGroup != nil { + localVarQueryParams.Add("string_group", parameterToString(*r.stringGroup, "")) } - if localVarOptionals != nil && localVarOptionals.Int64Group.IsSet() { - localVarQueryParams.Add("int64_group", parameterToString(localVarOptionals.Int64Group.Value(), "")) + if r.int64Group != nil { + localVarQueryParams.Add("int64_group", parameterToString(*r.int64Group, "")) } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1078,16 +1423,16 @@ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStrin if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - localVarHeaderParams["required_boolean_group"] = parameterToString(requiredBooleanGroup, "") - if localVarOptionals != nil && localVarOptionals.BooleanGroup.IsSet() { - localVarHeaderParams["boolean_group"] = parameterToString(localVarOptionals.BooleanGroup.Value(), "") + localVarHeaderParams["required_boolean_group"] = parameterToString(*r.requiredBooleanGroup, "") + if r.booleanGroup != nil { + localVarHeaderParams["boolean_group"] = parameterToString(*r.booleanGroup, "") } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1108,22 +1453,45 @@ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStrin return localVarHTTPResponse, nil } +type apiTestInlineAdditionalPropertiesRequest struct { + ctx _context.Context + apiService *FakeApiService + param *map[string]string +} + + +func (r apiTestInlineAdditionalPropertiesRequest) Param(param map[string]string) apiTestInlineAdditionalPropertiesRequest { + r.param = ¶m + return r +} /* TestInlineAdditionalProperties test inline additionalProperties * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param param request body +@return apiTestInlineAdditionalPropertiesRequest +*/ +func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context) apiTestInlineAdditionalPropertiesRequest { + return apiTestInlineAdditionalPropertiesRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, param map[string]string) (*_nethttp.Response, error) { +func (r apiTestInlineAdditionalPropertiesRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestInlineAdditionalProperties") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestInlineAdditionalProperties") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1133,6 +1501,10 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, pa localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.param == nil { + return nil, reportError("param is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -1152,13 +1524,13 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, pa localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = ¶m - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.param + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1179,23 +1551,51 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, pa return localVarHTTPResponse, nil } +type apiTestJsonFormDataRequest struct { + ctx _context.Context + apiService *FakeApiService + param *string + param2 *string +} + + +func (r apiTestJsonFormDataRequest) Param(param string) apiTestJsonFormDataRequest { + r.param = ¶m + return r +} + +func (r apiTestJsonFormDataRequest) Param2(param2 string) apiTestJsonFormDataRequest { + r.param2 = ¶m2 + return r +} /* TestJsonFormData test json serialization of form data * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param param field1 - * @param param2 field2 +@return apiTestJsonFormDataRequest */ -func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, param2 string) (*_nethttp.Response, error) { +func (a *FakeApiService) TestJsonFormData(ctx _context.Context) apiTestJsonFormDataRequest { + return apiTestJsonFormDataRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + +*/ +func (r apiTestJsonFormDataRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestJsonFormData") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestJsonFormData") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1205,6 +1605,14 @@ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, pa localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.param == nil { + return nil, reportError("param is required and must be specified") + } + + if r.param2 == nil { + return nil, reportError("param2 is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"} @@ -1223,14 +1631,14 @@ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, pa if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - localVarFormParams.Add("param", parameterToString(param, "")) - localVarFormParams.Add("param2", parameterToString(param2, "")) - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarFormParams.Add("param", parameterToString(*r.param, "")) + localVarFormParams.Add("param2", parameterToString(*r.param2, "")) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1251,27 +1659,70 @@ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, pa return localVarHTTPResponse, nil } +type apiTestQueryParameterCollectionFormatRequest struct { + ctx _context.Context + apiService *FakeApiService + pipe *[]string + ioutil *[]string + http *[]string + url *[]string + context *[]string +} + + +func (r apiTestQueryParameterCollectionFormatRequest) Pipe(pipe []string) apiTestQueryParameterCollectionFormatRequest { + r.pipe = &pipe + return r +} + +func (r apiTestQueryParameterCollectionFormatRequest) Ioutil(ioutil []string) apiTestQueryParameterCollectionFormatRequest { + r.ioutil = &ioutil + return r +} + +func (r apiTestQueryParameterCollectionFormatRequest) Http(http []string) apiTestQueryParameterCollectionFormatRequest { + r.http = &http + return r +} + +func (r apiTestQueryParameterCollectionFormatRequest) Url(url []string) apiTestQueryParameterCollectionFormatRequest { + r.url = &url + return r +} + +func (r apiTestQueryParameterCollectionFormatRequest) Context(context []string) apiTestQueryParameterCollectionFormatRequest { + r.context = &context + return r +} /* TestQueryParameterCollectionFormat Method for TestQueryParameterCollectionFormat To test the collection format in query parameters * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param pipe - * @param ioutil - * @param http - * @param url - * @param context +@return apiTestQueryParameterCollectionFormatRequest */ -func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context, pipe []string, ioutil []string, http []string, url []string, context []string) (*_nethttp.Response, error) { +func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context) apiTestQueryParameterCollectionFormatRequest { + return apiTestQueryParameterCollectionFormatRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + +*/ +func (r apiTestQueryParameterCollectionFormatRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestQueryParameterCollectionFormat") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestQueryParameterCollectionFormat") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1281,12 +1732,32 @@ func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.pipe == nil { + return nil, reportError("pipe is required and must be specified") + } + + if r.ioutil == nil { + return nil, reportError("ioutil is required and must be specified") + } + + if r.http == nil { + return nil, reportError("http is required and must be specified") + } + + if r.url == nil { + return nil, reportError("url is required and must be specified") + } + + if r.context == nil { + return nil, reportError("context is required and must be specified") + } - localVarQueryParams.Add("pipe", parameterToString(pipe, "csv")) - localVarQueryParams.Add("ioutil", parameterToString(ioutil, "csv")) - localVarQueryParams.Add("http", parameterToString(http, "space")) - localVarQueryParams.Add("url", parameterToString(url, "csv")) - t:=context + localVarQueryParams.Add("pipe", parameterToString(*r.pipe, "csv")) + localVarQueryParams.Add("ioutil", parameterToString(*r.ioutil, "csv")) + localVarQueryParams.Add("http", parameterToString(*r.http, "space")) + localVarQueryParams.Add("url", parameterToString(*r.url, "csv")) + t := *r.context if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { @@ -1312,12 +1783,12 @@ func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.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 ef129021d825..e8d6b3687975 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,14 +24,36 @@ var ( // FakeClassnameTags123ApiService FakeClassnameTags123Api service type FakeClassnameTags123ApiService service +type apiTestClassnameRequest struct { + ctx _context.Context + apiService *FakeClassnameTags123ApiService + body *Client +} + + +func (r apiTestClassnameRequest) Body(body Client) apiTestClassnameRequest { + r.body = &body + return r +} + /* TestClassname To test class name in snake case To test class name in snake case * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body client model -@return Client +@return apiTestClassnameRequest */ -func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) { +func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context) apiTestClassnameRequest { + return apiTestClassnameRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return Client +*/ +func (r apiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -41,7 +63,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod localVarReturnValue Client ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeClassnameTags123ApiService.TestClassname") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeClassnameTags123ApiService.TestClassname") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -51,6 +73,10 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -70,10 +96,10 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &body - if ctx != nil { + localVarPostBody = r.body + if r.ctx != nil { // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { if auth, ok := auth["api_key_query"]; ok { var key string if auth.Prefix != "" { @@ -85,12 +111,12 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod } } } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -108,7 +134,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod } if localVarHTTPResponse.StatusCode == 200 { var v Client - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -118,7 +144,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, diff --git a/samples/client/petstore/go-experimental/go-petstore/api_pet.go b/samples/client/petstore/go-experimental/go-petstore/api_pet.go index 9b397dabb97d..94f6e4fa9d8d 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_pet.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_pet.go @@ -15,7 +15,6 @@ import ( _nethttp "net/http" _neturl "net/url" "strings" - "github.com/antihax/optional" "os" ) @@ -27,21 +26,45 @@ var ( // PetApiService PetApi service type PetApiService service +type apiAddPetRequest struct { + ctx _context.Context + apiService *PetApiService + body *Pet +} + + +func (r apiAddPetRequest) Body(body Pet) apiAddPetRequest { + r.body = &body + return r +} + /* AddPet Add a new pet to the store * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body Pet object that needs to be added to the store +@return apiAddPetRequest +*/ +func (a *PetApiService) AddPet(ctx _context.Context) apiAddPetRequest { + return apiAddPetRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *PetApiService) AddPet(ctx _context.Context, body Pet) (*_nethttp.Response, error) { +func (r apiAddPetRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.AddPet") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.AddPet") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -51,6 +74,10 @@ func (a *PetApiService) AddPet(ctx _context.Context, body Pet) (*_nethttp.Respon localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.body == nil { + return nil, reportError("body is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json", "application/xml"} @@ -70,13 +97,13 @@ func (a *PetApiService) AddPet(ctx _context.Context, body Pet) (*_nethttp.Respon localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -97,40 +124,60 @@ func (a *PetApiService) AddPet(ctx _context.Context, body Pet) (*_nethttp.Respon return localVarHTTPResponse, nil } +type apiDeletePetRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + apiKey *string +} + -// DeletePetOpts Optional parameters for the method 'DeletePet' -type DeletePetOpts struct { - ApiKey optional.String +func (r apiDeletePetRequest) ApiKey(apiKey string) apiDeletePetRequest { + r.apiKey = &apiKey + return r } /* DeletePet Deletes a pet * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param petId Pet id to delete - * @param optional nil or *DeletePetOpts - Optional Parameters: - * @param "ApiKey" (optional.String) - +@return apiDeletePetRequest */ -func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOptionals *DeletePetOpts) (*_nethttp.Response, error) { +func (a *PetApiService) DeletePet(ctx _context.Context, petId int64) apiDeletePetRequest { + return apiDeletePetRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request + +*/ +func (r apiDeletePetRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.DeletePet") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.DeletePet") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -148,15 +195,15 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if localVarOptionals != nil && localVarOptionals.ApiKey.IsSet() { - localVarHeaderParams["api_key"] = parameterToString(localVarOptionals.ApiKey.Value(), "") + if r.apiKey != nil { + localVarHeaderParams["api_key"] = parameterToString(*r.apiKey, "") } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -177,15 +224,36 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt return localVarHTTPResponse, nil } +type apiFindPetsByStatusRequest struct { + ctx _context.Context + apiService *PetApiService + status *[]string +} + + +func (r apiFindPetsByStatusRequest) Status(status []string) apiFindPetsByStatusRequest { + r.status = &status + return r +} /* FindPetsByStatus Finds Pets by status Multiple status values can be provided with comma separated strings * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param status Status values that need to be considered for filter -@return []Pet +@return apiFindPetsByStatusRequest +*/ +func (a *PetApiService) FindPetsByStatus(ctx _context.Context) apiFindPetsByStatusRequest { + return apiFindPetsByStatusRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return []Pet */ -func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) ([]Pet, *_nethttp.Response, error) { +func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -195,7 +263,7 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) localVarReturnValue []Pet ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.FindPetsByStatus") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByStatus") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -205,8 +273,12 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.status == nil { + return localVarReturnValue, nil, reportError("status is required and must be specified") + } - localVarQueryParams.Add("status", parameterToString(status, "csv")) + localVarQueryParams.Add("status", parameterToString(*r.status, "csv")) // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -224,12 +296,12 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -247,7 +319,7 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) } if localVarHTTPResponse.StatusCode == 200 { var v []Pet - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -258,7 +330,7 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -269,15 +341,36 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) return localVarReturnValue, localVarHTTPResponse, nil } +type apiFindPetsByTagsRequest struct { + ctx _context.Context + apiService *PetApiService + tags *[]string +} + + +func (r apiFindPetsByTagsRequest) Tags(tags []string) apiFindPetsByTagsRequest { + r.tags = &tags + return r +} /* FindPetsByTags Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param tags Tags to filter by -@return []Pet +@return apiFindPetsByTagsRequest */ -func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]Pet, *_nethttp.Response, error) { +func (a *PetApiService) FindPetsByTags(ctx _context.Context) apiFindPetsByTagsRequest { + return apiFindPetsByTagsRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return []Pet +*/ +func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -287,7 +380,7 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P localVarReturnValue []Pet ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.FindPetsByTags") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByTags") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -297,8 +390,12 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.tags == nil { + return localVarReturnValue, nil, reportError("tags is required and must be specified") + } - localVarQueryParams.Add("tags", parameterToString(tags, "csv")) + localVarQueryParams.Add("tags", parameterToString(*r.tags, "csv")) // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -316,12 +413,12 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -339,7 +436,7 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P } if localVarHTTPResponse.StatusCode == 200 { var v []Pet - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -350,7 +447,7 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -361,15 +458,33 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P return localVarReturnValue, localVarHTTPResponse, nil } +type apiGetPetByIdRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 +} + /* GetPetById Find pet by ID Returns a single pet * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param petId ID of pet to return -@return Pet +@return apiGetPetByIdRequest +*/ +func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) apiGetPetByIdRequest { + return apiGetPetByIdRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request + @return Pet */ -func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_nethttp.Response, error) { +func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -379,17 +494,18 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne localVarReturnValue Pet ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.GetPetById") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.GetPetById") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -408,9 +524,9 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if ctx != nil { + if r.ctx != nil { // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { if auth, ok := auth["api_key"]; ok { var key string if auth.Prefix != "" { @@ -422,12 +538,12 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne } } } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -445,7 +561,7 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne } if localVarHTTPResponse.StatusCode == 200 { var v Pet - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -456,7 +572,7 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -467,22 +583,45 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne return localVarReturnValue, localVarHTTPResponse, nil } +type apiUpdatePetRequest struct { + ctx _context.Context + apiService *PetApiService + body *Pet +} + + +func (r apiUpdatePetRequest) Body(body Pet) apiUpdatePetRequest { + r.body = &body + return r +} /* UpdatePet Update an existing pet * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body Pet object that needs to be added to the store +@return apiUpdatePetRequest +*/ +func (a *PetApiService) UpdatePet(ctx _context.Context) apiUpdatePetRequest { + return apiUpdatePetRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *PetApiService) UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Response, error) { +func (r apiUpdatePetRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UpdatePet") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePet") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -492,6 +631,10 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Res localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.body == nil { + return nil, reportError("body is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json", "application/xml"} @@ -511,13 +654,13 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Res localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -538,42 +681,66 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Res return localVarHTTPResponse, nil } +type apiUpdatePetWithFormRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + name *string + status *string +} + + +func (r apiUpdatePetWithFormRequest) Name(name string) apiUpdatePetWithFormRequest { + r.name = &name + return r +} -// UpdatePetWithFormOpts Optional parameters for the method 'UpdatePetWithForm' -type UpdatePetWithFormOpts struct { - Name optional.String - Status optional.String +func (r apiUpdatePetWithFormRequest) Status(status string) apiUpdatePetWithFormRequest { + r.status = &status + return r } /* UpdatePetWithForm Updates a pet in the store with form data * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param petId ID of pet that needs to be updated - * @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 +@return apiUpdatePetWithFormRequest +*/ +func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64) apiUpdatePetWithFormRequest { + return apiUpdatePetWithFormRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request + */ -func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*_nethttp.Response, error) { +func (r apiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UpdatePetWithForm") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePetWithForm") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + + // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"} @@ -591,18 +758,18 @@ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, loc if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if localVarOptionals != nil && localVarOptionals.Name.IsSet() { - localVarFormParams.Add("name", parameterToString(localVarOptionals.Name.Value(), "")) + if r.name != nil { + localVarFormParams.Add("name", parameterToString(*r.name, "")) } - if localVarOptionals != nil && localVarOptionals.Status.IsSet() { - localVarFormParams.Add("status", parameterToString(localVarOptionals.Status.Value(), "")) + if r.status != nil { + localVarFormParams.Add("status", parameterToString(*r.status, "")) } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -623,23 +790,44 @@ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, loc return localVarHTTPResponse, nil } +type apiUploadFileRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + additionalMetadata *string + file **os.File +} + + +func (r apiUploadFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileRequest { + r.additionalMetadata = &additionalMetadata + return r +} -// UploadFileOpts Optional parameters for the method 'UploadFile' -type UploadFileOpts struct { - AdditionalMetadata optional.String - File optional.Interface +func (r apiUploadFileRequest) File(file *os.File) apiUploadFileRequest { + r.file = &file + return r } /* UploadFile uploads an image * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param petId ID of pet to update - * @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 apiUploadFileRequest +*/ +func (a *PetApiService) UploadFile(ctx _context.Context, petId int64) apiUploadFileRequest { + return apiUploadFileRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request + @return ApiResponse */ -func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *_nethttp.Response, error) { +func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -649,18 +837,19 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp localVarReturnValue ApiResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UploadFile") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFile") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/pet/{petId}/uploadImage" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + + // to determine the Content-Type header localVarHTTPContentTypes := []string{"multipart/form-data"} @@ -678,17 +867,13 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() { - localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), "")) + if r.additionalMetadata != nil { + localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, "")) } localVarFormFileName = "file" var localVarFile *os.File - if localVarOptionals != nil && localVarOptionals.File.IsSet() { - localVarFileOk := false - localVarFile, localVarFileOk = localVarOptionals.File.Value().(*os.File) - if !localVarFileOk { - return localVarReturnValue, nil, reportError("file should be *os.File") - } + if r.file != nil { + localVarFile = *r.file } if localVarFile != nil { fbs, _ := _ioutil.ReadAll(localVarFile) @@ -696,12 +881,12 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp localVarFileName = localVarFile.Name() localVarFile.Close() } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -719,7 +904,7 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp } if localVarHTTPResponse.StatusCode == 200 { var v ApiResponse - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -729,7 +914,7 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -740,22 +925,44 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp return localVarReturnValue, localVarHTTPResponse, nil } +type apiUploadFileWithRequiredFileRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + requiredFile **os.File + additionalMetadata *string +} + + +func (r apiUploadFileWithRequiredFileRequest) RequiredFile(requiredFile *os.File) apiUploadFileWithRequiredFileRequest { + r.requiredFile = &requiredFile + return r +} -// UploadFileWithRequiredFileOpts Optional parameters for the method 'UploadFileWithRequiredFile' -type UploadFileWithRequiredFileOpts struct { - AdditionalMetadata optional.String +func (r apiUploadFileWithRequiredFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileWithRequiredFileRequest { + r.additionalMetadata = &additionalMetadata + return r } /* UploadFileWithRequiredFile uploads an image (required) * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param petId ID of pet to update - * @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 apiUploadFileWithRequiredFileRequest */ -func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *_nethttp.Response, error) { +func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64) apiUploadFileWithRequiredFileRequest { + return apiUploadFileWithRequiredFileRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request + @return ApiResponse +*/ +func (r apiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -765,18 +972,23 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i localVarReturnValue ApiResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UploadFileWithRequiredFile") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFileWithRequiredFile") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/fake/{petId}/uploadImageWithRequiredFile" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + + + if r.requiredFile == nil { + return localVarReturnValue, nil, reportError("requiredFile is required and must be specified") + } + // to determine the Content-Type header localVarHTTPContentTypes := []string{"multipart/form-data"} @@ -794,23 +1006,23 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() { - localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), "")) + if r.additionalMetadata != nil { + localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, "")) } localVarFormFileName = "requiredFile" - localVarFile := requiredFile + localVarFile := *r.requiredFile if localVarFile != nil { fbs, _ := _ioutil.ReadAll(localVarFile) localVarFileBytes = fbs localVarFileName = localVarFile.Name() localVarFile.Close() } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -828,7 +1040,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i } if localVarHTTPResponse.StatusCode == 200 { var v ApiResponse - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -838,7 +1050,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, diff --git a/samples/client/petstore/go-experimental/go-petstore/api_store.go b/samples/client/petstore/go-experimental/go-petstore/api_store.go index 12047d173577..cea4e105c204 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_store.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_store.go @@ -25,32 +25,54 @@ var ( // StoreApiService StoreApi service type StoreApiService service +type apiDeleteOrderRequest struct { + ctx _context.Context + apiService *StoreApiService + orderId string +} + + /* DeleteOrder Delete purchase order by ID -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param orderId ID of the order that needs to be deleted +@return apiDeleteOrderRequest +*/ +func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) apiDeleteOrderRequest { + return apiDeleteOrderRequest{ + apiService: a, + ctx: ctx, + orderId: orderId, + } +} + +/* +Execute executes the request + */ -func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_nethttp.Response, error) { +func (r apiDeleteOrderRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.DeleteOrder") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.DeleteOrder") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/store/order/{order_id}" - localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(r.orderId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -69,12 +91,12 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -95,14 +117,30 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n return localVarHTTPResponse, nil } +type apiGetInventoryRequest struct { + ctx _context.Context + apiService *StoreApiService +} + /* GetInventory Returns pet inventories by status Returns a map of status codes to quantities * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). -@return map[string]int32 +@return apiGetInventoryRequest +*/ +func (a *StoreApiService) GetInventory(ctx _context.Context) apiGetInventoryRequest { + return apiGetInventoryRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return map[string]int32 */ -func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, *_nethttp.Response, error) { +func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -112,7 +150,7 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, localVarReturnValue map[string]int32 ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.GetInventory") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetInventory") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -140,9 +178,9 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if ctx != nil { + if r.ctx != nil { // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { if auth, ok := auth["api_key"]; ok { var key string if auth.Prefix != "" { @@ -154,12 +192,12 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, } } } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -177,7 +215,7 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, } if localVarHTTPResponse.StatusCode == 200 { var v map[string]int32 - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -187,7 +225,7 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -198,15 +236,33 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, return localVarReturnValue, localVarHTTPResponse, nil } +type apiGetOrderByIdRequest struct { + ctx _context.Context + apiService *StoreApiService + orderId int64 +} + /* GetOrderById Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions +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 apiGetOrderByIdRequest +*/ +func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) apiGetOrderByIdRequest { + return apiGetOrderByIdRequest{ + apiService: a, + ctx: ctx, + orderId: orderId, + } +} + +/* +Execute executes the request + @return Order */ -func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Order, *_nethttp.Response, error) { +func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -216,21 +272,22 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord localVarReturnValue Order ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.GetOrderById") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetOrderById") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/store/order/{order_id}" - localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(r.orderId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if orderId < 1 { + + if r.orderId < 1 { return localVarReturnValue, nil, reportError("orderId must be greater than 1") } - if orderId > 5 { + if r.orderId > 5 { return localVarReturnValue, nil, reportError("orderId must be less than 5") } @@ -251,12 +308,12 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -274,7 +331,7 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord } if localVarHTTPResponse.StatusCode == 200 { var v Order - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -285,7 +342,7 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -296,14 +353,35 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord return localVarReturnValue, localVarHTTPResponse, nil } +type apiPlaceOrderRequest struct { + ctx _context.Context + apiService *StoreApiService + body *Order +} + + +func (r apiPlaceOrderRequest) Body(body Order) apiPlaceOrderRequest { + r.body = &body + return r +} /* PlaceOrder Place an order for a pet * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body order placed for purchasing the pet -@return Order +@return apiPlaceOrderRequest +*/ +func (a *StoreApiService) PlaceOrder(ctx _context.Context) apiPlaceOrderRequest { + return apiPlaceOrderRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return Order */ -func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, *_nethttp.Response, error) { +func (r apiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -313,7 +391,7 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, * localVarReturnValue Order ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.PlaceOrder") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.PlaceOrder") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -323,6 +401,10 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, * localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -342,13 +424,13 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, * localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -366,7 +448,7 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, * } if localVarHTTPResponse.StatusCode == 200 { var v Order - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -377,7 +459,7 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, * return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, diff --git a/samples/client/petstore/go-experimental/go-petstore/api_user.go b/samples/client/petstore/go-experimental/go-petstore/api_user.go index 5689de23b63c..1af43a5acb9b 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_user.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_user.go @@ -25,22 +25,46 @@ var ( // UserApiService UserApi service type UserApiService service +type apiCreateUserRequest struct { + ctx _context.Context + apiService *UserApiService + body *User +} + + +func (r apiCreateUserRequest) Body(body User) apiCreateUserRequest { + r.body = &body + return r +} + /* CreateUser Create user This can only be done by the logged in user. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body Created user object +@return apiCreateUserRequest +*/ +func (a *UserApiService) CreateUser(ctx _context.Context) apiCreateUserRequest { + return apiCreateUserRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp.Response, error) { +func (r apiCreateUserRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.CreateUser") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -50,6 +74,10 @@ func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp. localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.body == nil { + return nil, reportError("body is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -69,13 +97,13 @@ func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp. localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -96,22 +124,45 @@ func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp. return localVarHTTPResponse, nil } +type apiCreateUsersWithArrayInputRequest struct { + ctx _context.Context + apiService *UserApiService + body *[]User +} + + +func (r apiCreateUsersWithArrayInputRequest) Body(body []User) apiCreateUsersWithArrayInputRequest { + r.body = &body + return r +} /* CreateUsersWithArrayInput Creates list of users with given input array * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body List of user object +@return apiCreateUsersWithArrayInputRequest */ -func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body []User) (*_nethttp.Response, error) { +func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context) apiCreateUsersWithArrayInputRequest { + return apiCreateUsersWithArrayInputRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + +*/ +func (r apiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.CreateUsersWithArrayInput") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithArrayInput") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -121,6 +172,10 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body [] localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.body == nil { + return nil, reportError("body is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -140,13 +195,13 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body [] localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -167,22 +222,45 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body [] return localVarHTTPResponse, nil } +type apiCreateUsersWithListInputRequest struct { + ctx _context.Context + apiService *UserApiService + body *[]User +} + + +func (r apiCreateUsersWithListInputRequest) Body(body []User) apiCreateUsersWithListInputRequest { + r.body = &body + return r +} /* CreateUsersWithListInput Creates list of users with given input array * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body List of user object +@return apiCreateUsersWithListInputRequest +*/ +func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context) apiCreateUsersWithListInputRequest { + return apiCreateUsersWithListInputRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []User) (*_nethttp.Response, error) { +func (r apiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.CreateUsersWithListInput") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithListInput") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -192,6 +270,10 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []U localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.body == nil { + return nil, reportError("body is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -211,13 +293,13 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []U localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -238,33 +320,54 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []U return localVarHTTPResponse, nil } +type apiDeleteUserRequest struct { + ctx _context.Context + apiService *UserApiService + username string +} + /* DeleteUser Delete user This can only be done by the logged in user. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param username The name that needs to be deleted +@return apiDeleteUserRequest */ -func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_nethttp.Response, error) { +func (a *UserApiService) DeleteUser(ctx _context.Context, username string) apiDeleteUserRequest { + return apiDeleteUserRequest{ + apiService: a, + ctx: ctx, + username: username, + } +} + +/* +Execute executes the request + +*/ +func (r apiDeleteUserRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.DeleteUser") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.DeleteUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(r.username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -283,12 +386,12 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -309,14 +412,32 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne return localVarHTTPResponse, nil } +type apiGetUserByNameRequest struct { + ctx _context.Context + apiService *UserApiService + username string +} + /* GetUserByName Get user by user name * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param username The name that needs to be fetched. Use user1 for testing. -@return User +@return apiGetUserByNameRequest +*/ +func (a *UserApiService) GetUserByName(ctx _context.Context, username string) apiGetUserByNameRequest { + return apiGetUserByNameRequest{ + apiService: a, + ctx: ctx, + username: username, + } +} + +/* +Execute executes the request + @return User */ -func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (User, *_nethttp.Response, error) { +func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -326,17 +447,18 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U localVarReturnValue User ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.GetUserByName") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.GetUserByName") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(r.username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -355,12 +477,12 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -378,7 +500,7 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U } if localVarHTTPResponse.StatusCode == 200 { var v User - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -389,7 +511,7 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -400,15 +522,41 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U return localVarReturnValue, localVarHTTPResponse, nil } +type apiLoginUserRequest struct { + ctx _context.Context + apiService *UserApiService + username *string + password *string +} + + +func (r apiLoginUserRequest) Username(username string) apiLoginUserRequest { + r.username = &username + return r +} + +func (r apiLoginUserRequest) Password(password string) apiLoginUserRequest { + r.password = &password + return r +} /* LoginUser Logs user into the system * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param username The user name for login - * @param password The password for login in clear text -@return string +@return apiLoginUserRequest +*/ +func (a *UserApiService) LoginUser(ctx _context.Context) apiLoginUserRequest { + return apiLoginUserRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return string */ -func (a *UserApiService) LoginUser(ctx _context.Context, username string, password string) (string, *_nethttp.Response, error) { +func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -418,7 +566,7 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo localVarReturnValue string ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.LoginUser") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LoginUser") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -428,9 +576,17 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.username == nil { + return localVarReturnValue, nil, reportError("username is required and must be specified") + } + + if r.password == nil { + return localVarReturnValue, nil, reportError("password is required and must be specified") + } - localVarQueryParams.Add("username", parameterToString(username, "")) - localVarQueryParams.Add("password", parameterToString(password, "")) + localVarQueryParams.Add("username", parameterToString(*r.username, "")) + localVarQueryParams.Add("password", parameterToString(*r.password, "")) // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -448,12 +604,12 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -471,7 +627,7 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo } if localVarHTTPResponse.StatusCode == 200 { var v string - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -482,7 +638,7 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -493,21 +649,39 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo return localVarReturnValue, localVarHTTPResponse, nil } +type apiLogoutUserRequest struct { + ctx _context.Context + apiService *UserApiService +} + /* LogoutUser Logs out current logged in user session * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiLogoutUserRequest +*/ +func (a *UserApiService) LogoutUser(ctx _context.Context) apiLogoutUserRequest { + return apiLogoutUserRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, error) { +func (r apiLogoutUserRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.LogoutUser") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LogoutUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -535,12 +709,12 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -561,34 +735,64 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e return localVarHTTPResponse, nil } +type apiUpdateUserRequest struct { + ctx _context.Context + apiService *UserApiService + username string + body *User +} + + +func (r apiUpdateUserRequest) Body(body User) apiUpdateUserRequest { + r.body = &body + return r +} /* UpdateUser Updated user This can only be done by the logged in user. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param username name that need to be deleted - * @param body Updated user object +@return apiUpdateUserRequest +*/ +func (a *UserApiService) UpdateUser(ctx _context.Context, username string) apiUpdateUserRequest { + return apiUpdateUserRequest{ + apiService: a, + ctx: ctx, + username: username, + } +} + +/* +Execute executes the request + */ -func (a *UserApiService) UpdateUser(ctx _context.Context, username string, body User) (*_nethttp.Response, error) { +func (r apiUpdateUserRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.UpdateUser") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.UpdateUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(r.username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + + if r.body == nil { + return nil, reportError("body is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -608,13 +812,13 @@ func (a *UserApiService) UpdateUser(ctx _context.Context, username string, body localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md index 2c22f8f1b307..1c5c2b28dd62 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md @@ -10,19 +10,24 @@ Method | HTTP request | Description ## Call123TestSpecialTags -> Client Call123TestSpecialTags(ctx, body) +> Client Call123TestSpecialTags(ctx).Body(body).Execute() To test special tags -To test special tags and operation ID starting with number -### Required Parameters + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCall123TestSpecialTagsRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**body** | [**Client**](Client.md)| client model | + **body** | [**Client**](Client.md) | client model | ### Return type diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/FakeApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/FakeApi.md index 6ba47e807f38..c81d4523824a 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/FakeApi.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/FakeApi.md @@ -23,19 +23,24 @@ Method | HTTP request | Description ## CreateXmlItem -> CreateXmlItem(ctx, xmlItem) +> CreateXmlItem(ctx).XmlItem(xmlItem).Execute() creates an XmlItem -this route creates an XmlItem -### Required Parameters + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateXmlItemRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body | + **xmlItem** | [**XmlItem**](XmlItem.md) | XmlItem Body | ### Return type @@ -57,28 +62,24 @@ No authorization required ## FakeOuterBooleanSerialize -> bool FakeOuterBooleanSerialize(ctx, optional) +> bool FakeOuterBooleanSerialize(ctx).Body(body).Execute() -Test serialization of outer boolean types -### Required Parameters + +### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **optional** | ***FakeOuterBooleanSerializeOpts** | optional parameters | nil if no parameters -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a FakeOuterBooleanSerializeOpts struct +Other parameters are passed through a pointer to a apiFakeOuterBooleanSerializeRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **optional.Bool**| Input boolean as post body | + **body** | **bool** | Input boolean as post body | ### Return type @@ -100,28 +101,24 @@ No authorization required ## FakeOuterCompositeSerialize -> OuterComposite FakeOuterCompositeSerialize(ctx, optional) +> OuterComposite FakeOuterCompositeSerialize(ctx).Body(body).Execute() -Test serialization of object with outer number type -### Required Parameters +### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **optional** | ***FakeOuterCompositeSerializeOpts** | optional parameters | nil if no parameters -### Optional Parameters -Optional parameters are passed through a pointer to a FakeOuterCompositeSerializeOpts struct +### Other Parameters + +Other parameters are passed through a pointer to a apiFakeOuterCompositeSerializeRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**optional.Interface of OuterComposite**](OuterComposite.md)| Input composite as post body | + **body** | [**OuterComposite**](OuterComposite.md) | Input composite as post body | ### Return type @@ -143,28 +140,24 @@ No authorization required ## FakeOuterNumberSerialize -> float32 FakeOuterNumberSerialize(ctx, optional) +> float32 FakeOuterNumberSerialize(ctx).Body(body).Execute() -Test serialization of outer number types -### Required Parameters + +### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **optional** | ***FakeOuterNumberSerializeOpts** | optional parameters | nil if no parameters -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a FakeOuterNumberSerializeOpts struct +Other parameters are passed through a pointer to a apiFakeOuterNumberSerializeRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **optional.Float32**| Input number as post body | + **body** | **float32** | Input number as post body | ### Return type @@ -186,28 +179,24 @@ No authorization required ## FakeOuterStringSerialize -> string FakeOuterStringSerialize(ctx, optional) +> string FakeOuterStringSerialize(ctx).Body(body).Execute() -Test serialization of outer string types -### Required Parameters +### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **optional** | ***FakeOuterStringSerializeOpts** | optional parameters | nil if no parameters -### Optional Parameters -Optional parameters are passed through a pointer to a FakeOuterStringSerializeOpts struct +### Other Parameters + +Other parameters are passed through a pointer to a apiFakeOuterStringSerializeRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **optional.String**| Input string as post body | + **body** | **string** | Input string as post body | ### Return type @@ -229,19 +218,24 @@ No authorization required ## TestBodyWithFileSchema -> TestBodyWithFileSchema(ctx, body) +> TestBodyWithFileSchema(ctx).Body(body).Execute() + + + +### Path Parameters -For this test, the body for this request much reference a schema named `File`. -### Required Parameters + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestBodyWithFileSchemaRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md) | | ### Return type @@ -263,18 +257,23 @@ No authorization required ## TestBodyWithQueryParams -> TestBodyWithQueryParams(ctx, query, body) +> TestBodyWithQueryParams(ctx).Query(query).Body(body).Execute() + + +### Path Parameters -### Required Parameters + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestBodyWithQueryParamsRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**query** | **string**| | -**body** | [**User**](User.md)| | + **query** | **string** | | + **body** | [**User**](User.md) | | ### Return type @@ -296,19 +295,24 @@ No authorization required ## TestClientModel -> Client TestClientModel(ctx, body) +> Client TestClientModel(ctx).Body(body).Execute() To test \"client\" model -To test \"client\" model -### Required Parameters + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestClientModelRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**body** | [**Client**](Client.md)| client model | + **body** | [**Client**](Client.md) | client model | ### Return type @@ -330,45 +334,37 @@ No authorization required ## TestEndpointParameters -> TestEndpointParameters(ctx, number, double, patternWithoutDelimiter, byte_, optional) +> TestEndpointParameters(ctx).Number(number).Double(double).PatternWithoutDelimiter(patternWithoutDelimiter).Byte_(byte_).Integer(integer).Int32_(int32_).Int64_(int64_).Float(float).String_(string_).Binary(binary).Date(date).DateTime(dateTime).Password(password).Callback(callback).Execute() Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -### Required Parameters + +### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**number** | **float32**| None | -**double** | **float64**| None | -**patternWithoutDelimiter** | **string**| None | -**byte_** | **string**| None | - **optional** | ***TestEndpointParametersOpts** | optional parameters | nil if no parameters -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a TestEndpointParametersOpts struct +Other parameters are passed through a pointer to a apiTestEndpointParametersRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - - - - - **integer** | **optional.Int32**| None | - **int32_** | **optional.Int32**| None | - **int64_** | **optional.Int64**| None | - **float** | **optional.Float32**| None | - **string_** | **optional.String**| None | - **binary** | **optional.Interface of *os.File****optional.*os.File**| None | - **date** | **optional.String**| None | - **dateTime** | **optional.Time**| None | - **password** | **optional.String**| None | - **callback** | **optional.String**| None | + **number** | **float32** | None | + **double** | **float64** | None | + **patternWithoutDelimiter** | **string** | None | + **byte_** | **string** | None | + **integer** | **int32** | None | + **int32_** | **int32** | None | + **int64_** | **int64** | None | + **float** | **float32** | None | + **string_** | **string** | None | + **binary** | ***os.File** | None | + **date** | **string** | None | + **dateTime** | **time.Time** | None | + **password** | **string** | None | + **callback** | **string** | None | ### Return type @@ -390,35 +386,31 @@ Name | Type | Description | Notes ## TestEnumParameters -> TestEnumParameters(ctx, optional) +> TestEnumParameters(ctx).EnumHeaderStringArray(enumHeaderStringArray).EnumHeaderString(enumHeaderString).EnumQueryStringArray(enumQueryStringArray).EnumQueryString(enumQueryString).EnumQueryInteger(enumQueryInteger).EnumQueryDouble(enumQueryDouble).EnumFormStringArray(enumFormStringArray).EnumFormString(enumFormString).Execute() To test enum parameters -To test enum parameters -### Required Parameters + +### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **optional** | ***TestEnumParametersOpts** | optional parameters | nil if no parameters -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a TestEnumParametersOpts struct +Other parameters are passed through a pointer to a apiTestEnumParametersRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **enumHeaderStringArray** | [**optional.Interface of []string**](string.md)| Header parameter enum test (string array) | - **enumHeaderString** | **optional.String**| Header parameter enum test (string) | [default to -efg] - **enumQueryStringArray** | [**optional.Interface of []string**](string.md)| Query parameter enum test (string array) | - **enumQueryString** | **optional.String**| Query parameter enum test (string) | [default to -efg] - **enumQueryInteger** | **optional.Int32**| Query parameter enum test (double) | - **enumQueryDouble** | **optional.Float64**| Query parameter enum test (double) | - **enumFormStringArray** | [**optional.Interface of []string**](string.md)| Form parameter enum test (string array) | [default to $] - **enumFormString** | **optional.String**| Form parameter enum test (string) | [default to -efg] + **enumHeaderStringArray** | [**[]string**](string.md) | Header parameter enum test (string array) | + **enumHeaderString** | **string** | Header parameter enum test (string) | [default to -efg] + **enumQueryStringArray** | [**[]string**](string.md) | Query parameter enum test (string array) | + **enumQueryString** | **string** | Query parameter enum test (string) | [default to -efg] + **enumQueryInteger** | **int32** | Query parameter enum test (double) | + **enumQueryDouble** | **float64** | Query parameter enum test (double) | + **enumFormStringArray** | [**[]string**](string.md) | Form parameter enum test (string array) | [default to $] + **enumFormString** | **string** | Form parameter enum test (string) | [default to -efg] ### Return type @@ -440,36 +432,29 @@ No authorization required ## TestGroupParameters -> TestGroupParameters(ctx, requiredStringGroup, requiredBooleanGroup, requiredInt64Group, optional) +> TestGroupParameters(ctx).RequiredStringGroup(requiredStringGroup).RequiredBooleanGroup(requiredBooleanGroup).RequiredInt64Group(requiredInt64Group).StringGroup(stringGroup).BooleanGroup(booleanGroup).Int64Group(int64Group).Execute() Fake endpoint to test group parameters (optional) -Fake endpoint to test group parameters (optional) -### Required Parameters + +### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**requiredStringGroup** | **int32**| Required String in group parameters | -**requiredBooleanGroup** | **bool**| Required Boolean in group parameters | -**requiredInt64Group** | **int64**| Required Integer in group parameters | - **optional** | ***TestGroupParametersOpts** | optional parameters | nil if no parameters -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a TestGroupParametersOpts struct +Other parameters are passed through a pointer to a apiTestGroupParametersRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - - - - **stringGroup** | **optional.Int32**| String in group parameters | - **booleanGroup** | **optional.Bool**| Boolean in group parameters | - **int64Group** | **optional.Int64**| Integer in group parameters | + **requiredStringGroup** | **int32** | Required String in group parameters | + **requiredBooleanGroup** | **bool** | Required Boolean in group parameters | + **requiredInt64Group** | **int64** | Required Integer in group parameters | + **stringGroup** | **int32** | String in group parameters | + **booleanGroup** | **bool** | Boolean in group parameters | + **int64Group** | **int64** | Integer in group parameters | ### Return type @@ -491,17 +476,22 @@ No authorization required ## TestInlineAdditionalProperties -> TestInlineAdditionalProperties(ctx, param) +> TestInlineAdditionalProperties(ctx).Param(param).Execute() test inline additionalProperties -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestInlineAdditionalPropertiesRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**param** | [**map[string]string**](string.md)| request body | + **param** | [**map[string]string**](string.md) | request body | ### Return type @@ -523,18 +513,23 @@ No authorization required ## TestJsonFormData -> TestJsonFormData(ctx, param, param2) +> TestJsonFormData(ctx).Param(param).Param2(param2).Execute() test json serialization of form data -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestJsonFormDataRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**param** | **string**| field1 | -**param2** | **string**| field2 | + **param** | **string** | field1 | + **param2** | **string** | field2 | ### Return type @@ -556,23 +551,28 @@ No authorization required ## TestQueryParameterCollectionFormat -> TestQueryParameterCollectionFormat(ctx, pipe, ioutil, http, url, context) +> TestQueryParameterCollectionFormat(ctx).Pipe(pipe).Ioutil(ioutil).Http(http).Url(url).Context(context).Execute() + + + + + +### Path Parameters -To test the collection format in query parameters +### Other Parameters -### Required Parameters +Other parameters are passed through a pointer to a apiTestQueryParameterCollectionFormatRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**pipe** | [**[]string**](string.md)| | -**ioutil** | [**[]string**](string.md)| | -**http** | [**[]string**](string.md)| | -**url** | [**[]string**](string.md)| | -**context** | [**[]string**](string.md)| | + **pipe** | [**[]string**](string.md) | | + **ioutil** | [**[]string**](string.md) | | + **http** | [**[]string**](string.md) | | + **url** | [**[]string**](string.md) | | + **context** | [**[]string**](string.md) | | ### Return type diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md b/samples/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md index 224542b70517..804712218780 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md @@ -10,19 +10,24 @@ Method | HTTP request | Description ## TestClassname -> Client TestClassname(ctx, body) +> Client TestClassname(ctx).Body(body).Execute() To test class name in snake case -To test class name in snake case -### Required Parameters + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestClassnameRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**body** | [**Client**](Client.md)| client model | + **body** | [**Client**](Client.md) | client model | ### Return type diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/PetApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/PetApi.md index 6ee9afef754b..9d07d9e64fcc 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/PetApi.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/PetApi.md @@ -18,17 +18,22 @@ Method | HTTP request | Description ## AddPet -> AddPet(ctx, body) +> AddPet(ctx).Body(body).Execute() Add a new pet to the store -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiAddPetRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | ### Return type @@ -50,28 +55,27 @@ Name | Type | Description | Notes ## DeletePet -> DeletePet(ctx, petId, optional) +> DeletePet(ctx, petId).ApiKey(apiKey).Execute() Deletes a pet -### Required Parameters +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**petId** | **int64**| Pet id to delete | - **optional** | ***DeletePetOpts** | optional parameters | nil if no parameters +**petId** | **int64** | Pet id to delete | -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a DeletePetOpts struct +Other parameters are passed through a pointer to a apiDeletePetRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **apiKey** | **optional.String**| | + **apiKey** | **string** | | ### Return type @@ -93,19 +97,24 @@ Name | Type | Description | Notes ## FindPetsByStatus -> []Pet FindPetsByStatus(ctx, status) +> []Pet FindPetsByStatus(ctx).Status(status).Execute() Finds Pets by status -Multiple status values can be provided with comma separated strings -### Required Parameters + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFindPetsByStatusRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**status** | [**[]string**](string.md)| Status values that need to be considered for filter | + **status** | [**[]string**](string.md) | Status values that need to be considered for filter | ### Return type @@ -127,19 +136,24 @@ Name | Type | Description | Notes ## FindPetsByTags -> []Pet FindPetsByTags(ctx, tags) +> []Pet FindPetsByTags(ctx).Tags(tags).Execute() Finds Pets by tags -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. -### Required Parameters + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFindPetsByTagsRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**tags** | [**[]string**](string.md)| Tags to filter by | + **tags** | [**[]string**](string.md) | Tags to filter by | ### Return type @@ -161,19 +175,28 @@ Name | Type | Description | Notes ## GetPetById -> Pet GetPetById(ctx, petId) +> Pet GetPetById(ctx, petId).Execute() Find pet by ID -Returns a single pet -### Required Parameters + +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**petId** | **int64**| ID of pet to return | +**petId** | **int64** | ID of pet to return | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetPetByIdRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + ### Return type @@ -195,17 +218,22 @@ Name | Type | Description | Notes ## UpdatePet -> UpdatePet(ctx, body) +> UpdatePet(ctx).Body(body).Execute() Update an existing pet -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdatePetRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | ### Return type @@ -227,29 +255,28 @@ Name | Type | Description | Notes ## UpdatePetWithForm -> UpdatePetWithForm(ctx, petId, optional) +> UpdatePetWithForm(ctx, petId).Name(name).Status(status).Execute() Updates a pet in the store with form data -### Required Parameters +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**petId** | **int64**| ID of pet that needs to be updated | - **optional** | ***UpdatePetWithFormOpts** | optional parameters | nil if no parameters +**petId** | **int64** | ID of pet that needs to be updated | -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a UpdatePetWithFormOpts struct +Other parameters are passed through a pointer to a apiUpdatePetWithFormRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **name** | **optional.String**| Updated name of the pet | - **status** | **optional.String**| Updated status of the pet | + **name** | **string** | Updated name of the pet | + **status** | **string** | Updated status of the pet | ### Return type @@ -271,29 +298,28 @@ Name | Type | Description | Notes ## UploadFile -> ApiResponse UploadFile(ctx, petId, optional) +> ApiResponse UploadFile(ctx, petId).AdditionalMetadata(additionalMetadata).File(file).Execute() uploads an image -### Required Parameters +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**petId** | **int64**| ID of pet to update | - **optional** | ***UploadFileOpts** | optional parameters | nil if no parameters +**petId** | **int64** | ID of pet to update | -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a UploadFileOpts struct +Other parameters are passed through a pointer to a apiUploadFileRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **additionalMetadata** | **optional.String**| Additional data to pass to server | - **file** | **optional.Interface of *os.File****optional.*os.File**| file to upload | + **additionalMetadata** | **string** | Additional data to pass to server | + **file** | ***os.File** | file to upload | ### Return type @@ -315,30 +341,28 @@ Name | Type | Description | Notes ## UploadFileWithRequiredFile -> ApiResponse UploadFileWithRequiredFile(ctx, petId, requiredFile, optional) +> ApiResponse UploadFileWithRequiredFile(ctx, petId).RequiredFile(requiredFile).AdditionalMetadata(additionalMetadata).Execute() uploads an image (required) -### Required Parameters +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**petId** | **int64**| ID of pet to update | -**requiredFile** | ***os.File*****os.File**| file to upload | - **optional** | ***UploadFileWithRequiredFileOpts** | optional parameters | nil if no parameters +**petId** | **int64** | ID of pet to update | -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a UploadFileWithRequiredFileOpts struct +Other parameters are passed through a pointer to a apiUploadFileWithRequiredFileRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - - **additionalMetadata** | **optional.String**| Additional data to pass to server | + **requiredFile** | ***os.File** | file to upload | + **additionalMetadata** | **string** | Additional data to pass to server | ### Return type diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/StoreApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/StoreApi.md index 531ab09ff688..3d75ce0a56fd 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/StoreApi.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/StoreApi.md @@ -13,19 +13,28 @@ Method | HTTP request | Description ## DeleteOrder -> DeleteOrder(ctx, orderId) +> DeleteOrder(ctx, orderId).Execute() Delete purchase order by ID -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors -### Required Parameters + +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**orderId** | **string**| ID of the order that needs to be deleted | +**orderId** | **string** | ID of the order that needs to be deleted | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteOrderRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + ### Return type @@ -47,16 +56,21 @@ No authorization required ## GetInventory -> map[string]int32 GetInventory(ctx, ) +> map[string]int32 GetInventory(ctx).Execute() Returns pet inventories by status -Returns a map of status codes to quantities -### Required Parameters + +### Path Parameters This endpoint does not need any parameter. +### Other Parameters + +Other parameters are passed through a pointer to a apiGetInventoryRequest struct via the builder pattern + + ### Return type **map[string]int32** @@ -77,19 +91,28 @@ This endpoint does not need any parameter. ## GetOrderById -> Order GetOrderById(ctx, orderId) +> Order GetOrderById(ctx, orderId).Execute() Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions -### Required Parameters + +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**orderId** | **int64**| ID of pet that needs to be fetched | +**orderId** | **int64** | ID of pet that needs to be fetched | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetOrderByIdRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + ### Return type @@ -111,17 +134,22 @@ No authorization required ## PlaceOrder -> Order PlaceOrder(ctx, body) +> Order PlaceOrder(ctx).Body(body).Execute() Place an order for a pet -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiPlaceOrderRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**body** | [**Order**](Order.md)| order placed for purchasing the pet | + **body** | [**Order**](Order.md) | order placed for purchasing the pet | ### Return type diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/UserApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/UserApi.md index d9f16bb5fb0e..cee3024a24f1 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/UserApi.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/UserApi.md @@ -17,19 +17,24 @@ Method | HTTP request | Description ## CreateUser -> CreateUser(ctx, body) +> CreateUser(ctx).Body(body).Execute() Create user -This can only be done by the logged in user. -### Required Parameters + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUserRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**body** | [**User**](User.md)| Created user object | + **body** | [**User**](User.md) | Created user object | ### Return type @@ -51,17 +56,22 @@ No authorization required ## CreateUsersWithArrayInput -> CreateUsersWithArrayInput(ctx, body) +> CreateUsersWithArrayInput(ctx).Body(body).Execute() Creates list of users with given input array -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUsersWithArrayInputRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**body** | [**[]User**](User.md)| List of user object | + **body** | [**[]User**](User.md) | List of user object | ### Return type @@ -83,17 +93,22 @@ No authorization required ## CreateUsersWithListInput -> CreateUsersWithListInput(ctx, body) +> CreateUsersWithListInput(ctx).Body(body).Execute() Creates list of users with given input array -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUsersWithListInputRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**body** | [**[]User**](User.md)| List of user object | + **body** | [**[]User**](User.md) | List of user object | ### Return type @@ -115,19 +130,28 @@ No authorization required ## DeleteUser -> DeleteUser(ctx, username) +> DeleteUser(ctx, username).Execute() Delete user -This can only be done by the logged in user. -### Required Parameters + +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**username** | **string**| The name that needs to be deleted | +**username** | **string** | The name that needs to be deleted | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + ### Return type @@ -149,17 +173,26 @@ No authorization required ## GetUserByName -> User GetUserByName(ctx, username) +> User GetUserByName(ctx, username).Execute() Get user by user name -### Required Parameters +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**username** | **string**| The name that needs to be fetched. Use user1 for testing. | +**username** | **string** | The name that needs to be fetched. Use user1 for testing. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserByNameRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + ### Return type @@ -181,18 +214,23 @@ No authorization required ## LoginUser -> string LoginUser(ctx, username, password) +> string LoginUser(ctx).Username(username).Password(password).Execute() Logs user into the system -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiLoginUserRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**username** | **string**| The user name for login | -**password** | **string**| The password for login in clear text | + **username** | **string** | The user name for login | + **password** | **string** | The password for login in clear text | ### Return type @@ -214,14 +252,19 @@ No authorization required ## LogoutUser -> LogoutUser(ctx, ) +> LogoutUser(ctx).Execute() Logs out current logged in user session -### Required Parameters +### Path Parameters This endpoint does not need any parameter. +### Other Parameters + +Other parameters are passed through a pointer to a apiLogoutUserRequest struct via the builder pattern + + ### Return type (empty response body) @@ -242,20 +285,29 @@ No authorization required ## UpdateUser -> UpdateUser(ctx, username, body) +> UpdateUser(ctx, username).Body(body).Execute() Updated user -This can only be done by the logged in user. -### Required Parameters + +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**username** | **string**| name that need to be deleted | -**body** | [**User**](User.md)| Updated user object | +**username** | **string** | name that need to be deleted | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **body** | [**User**](User.md) | Updated user object | ### Return type diff --git a/samples/client/petstore/go-experimental/pet_api_test.go b/samples/client/petstore/go-experimental/pet_api_test.go index 847aa517af19..6cc33a62e1cb 100644 --- a/samples/client/petstore/go-experimental/pet_api_test.go +++ b/samples/client/petstore/go-experimental/pet_api_test.go @@ -6,7 +6,6 @@ import ( "os" "testing" - "github.com/antihax/optional" "github.com/stretchr/testify/assert" sw "./go-petstore" @@ -32,7 +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")}}}) - r, err := client.PetApi.AddPet(context.Background(), newPet) + r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute() if err != nil { t.Fatalf("Error while adding pet: %v", err) @@ -43,7 +42,7 @@ func TestAddPet(t *testing.T) { } func TestFindPetsByStatusWithMissingParam(t *testing.T) { - _, r, err := client.PetApi.FindPetsByStatus(context.Background(), nil) + _, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute() if err != nil { t.Fatalf("Error while testing TestFindPetsByStatusWithMissingParam: %v", err) @@ -58,7 +57,7 @@ func TestGetPetById(t *testing.T) { } func TestGetPetByIdWithInvalidID(t *testing.T) { - resp, r, err := client.PetApi.GetPetById(context.Background(), 999999999) + 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) @@ -75,10 +74,7 @@ func TestGetPetByIdWithInvalidID(t *testing.T) { } func TestUpdatePetWithForm(t *testing.T) { - r, err := client.PetApi.UpdatePetWithForm(context.Background(), 12830, &sw.UpdatePetWithFormOpts{ - Name: optional.NewString("golang"), - Status: optional.NewString("available"), - }) + 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,7 +89,7 @@ func TestUpdatePetWithForm(t *testing.T) { func TestFindPetsByTag(t *testing.T) { var found = false - resp, r, err := client.PetApi.FindPetsByTags(context.Background(), []string{"tag2"}) + 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) @@ -122,7 +118,7 @@ func TestFindPetsByTag(t *testing.T) { } func TestFindPetsByStatus(t *testing.T) { - resp, r, err := client.PetApi.FindPetsByStatus(context.Background(), []string{"available"}) + 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) @@ -145,10 +141,7 @@ func TestFindPetsByStatus(t *testing.T) { func TestUploadFile(t *testing.T) { file, _ := os.Open("../python/testfiles/foo.png") - _, r, err := client.PetApi.UploadFile(context.Background(), 12830, &sw.UploadFileOpts{ - AdditionalMetadata: optional.NewString("golang"), - File: optional.NewInterface(file), - }) + _, r, err := client.PetApi.UploadFile(context.Background(), 12830).AdditionalMetadata("golang").File(file).Execute() if err != nil { t.Fatalf("Error while uploading file: %v", err) @@ -163,11 +156,7 @@ func TestUploadFileRequired(t *testing.T) { return // remove when server supports this endpoint file, _ := os.Open("../python/testfiles/foo.png") - _, r, err := client.PetApi.UploadFileWithRequiredFile(context.Background(), 12830, - file, - &sw.UploadFileWithRequiredFileOpts{ - AdditionalMetadata: optional.NewString("golang"), - }) + _, r, err := client.PetApi.UploadFileWithRequiredFile(context.Background(), 12830).RequiredFile(file).AdditionalMetadata("golang").Execute() if err != nil { t.Fatalf("Error while uploading file: %v", err) @@ -179,7 +168,7 @@ func TestUploadFileRequired(t *testing.T) { } func TestDeletePet(t *testing.T) { - r, err := client.PetApi.DeletePet(context.Background(), 12830, nil) + r, err := client.PetApi.DeletePet(context.Background(), 12830).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -269,7 +258,7 @@ 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, nil) + r, err := client.PetApi.DeletePet(context.Background(), id).Execute() if err != nil { t.Fatalf("Error while deleting pet by id: %v", err) @@ -281,7 +270,7 @@ 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) + 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/store_api_test.go b/samples/client/petstore/go-experimental/store_api_test.go index 81f4fd7e33d9..f9f55273eb92 100644 --- a/samples/client/petstore/go-experimental/store_api_test.go +++ b/samples/client/petstore/go-experimental/store_api_test.go @@ -18,7 +18,7 @@ func TestPlaceOrder(t *testing.T) { Status: sw.PtrString("placed"), Complete: sw.PtrBool(false)} - _, r, err := client.StoreApi.PlaceOrder(context.Background(), newOrder) + _, 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 882608702097..720b14848f09 100644 --- a/samples/client/petstore/go-experimental/user_api_test.go +++ b/samples/client/petstore/go-experimental/user_api_test.go @@ -20,7 +20,7 @@ func TestCreateUser(t *testing.T) { Phone: sw.PtrString("5101112222"), UserStatus: sw.PtrInt32(1)} - apiResponse, err := client.UserApi.CreateUser(context.Background(), newUser) + apiResponse, err := client.UserApi.CreateUser(context.Background()).Body(newUser).Execute() if err != nil { t.Fatalf("Error while adding user: %v", err) @@ -55,7 +55,7 @@ func TestCreateUsersWithArrayInput(t *testing.T) { }, } - apiResponse, err := client.UserApi.CreateUsersWithArrayInput(context.Background(), newUsers) + apiResponse, err := client.UserApi.CreateUsersWithArrayInput(context.Background()).Body(newUsers).Execute() if err != nil { t.Fatalf("Error while adding users: %v", err) } @@ -64,13 +64,13 @@ func TestCreateUsersWithArrayInput(t *testing.T) { } //tear down - _, err1 := client.UserApi.DeleteUser(context.Background(), "gopher1") + _, err1 := client.UserApi.DeleteUser(context.Background(), "gopher1").Execute() if err1 != nil { t.Errorf("Error while deleting user") t.Log(err1) } - _, err2 := client.UserApi.DeleteUser(context.Background(), "gopher2") + _, err2 := client.UserApi.DeleteUser(context.Background(), "gopher2").Execute() if err2 != nil { t.Errorf("Error while deleting user") t.Log(err2) @@ -80,7 +80,7 @@ func TestCreateUsersWithArrayInput(t *testing.T) { func TestGetUserByName(t *testing.T) { assert := assert.New(t) - resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher") + resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher").Execute() if err != nil { t.Fatalf("Error while getting user by id: %v", err) } else { @@ -95,7 +95,7 @@ func TestGetUserByName(t *testing.T) { } func TestGetUserByNameWithInvalidID(t *testing.T) { - resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "999999999") + 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 { @@ -122,7 +122,7 @@ func TestUpdateUser(t *testing.T) { Phone: sw.PtrString("5101112222"), UserStatus: sw.PtrInt32(1)} - apiResponse, err := client.UserApi.UpdateUser(context.Background(), "gopher", newUser) + apiResponse, err := client.UserApi.UpdateUser(context.Background(), "gopher").Body(newUser).Execute() if err != nil { t.Fatalf("Error while deleting user by id: %v", err) } @@ -131,7 +131,7 @@ func TestUpdateUser(t *testing.T) { } //verify changings are correct - resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher") + resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher").Execute() if err != nil { t.Fatalf("Error while getting user by id: %v", err) } else { @@ -142,7 +142,7 @@ func TestUpdateUser(t *testing.T) { } func TestDeleteUser(t *testing.T) { - apiResponse, err := client.UserApi.DeleteUser(context.Background(), "gopher") + apiResponse, err := client.UserApi.DeleteUser(context.Background(), "gopher").Execute() if err != nil { t.Fatalf("Error while deleting user: %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 70a24791ad27..16dc072e9674 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,14 +24,36 @@ var ( // AnotherFakeApiService AnotherFakeApi service type AnotherFakeApiService service +type apiCall123TestSpecialTagsRequest struct { + ctx _context.Context + apiService *AnotherFakeApiService + client *Client +} + + +func (r apiCall123TestSpecialTagsRequest) Client(client Client) apiCall123TestSpecialTagsRequest { + r.client = &client + return r +} + /* Call123TestSpecialTags To test special tags To test special tags and operation ID starting with number * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param client client model -@return Client +@return apiCall123TestSpecialTagsRequest */ -func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, client Client) (Client, *_nethttp.Response, error) { +func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context) apiCall123TestSpecialTagsRequest { + return apiCall123TestSpecialTagsRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return Client +*/ +func (r apiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -41,7 +63,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, cli localVarReturnValue Client ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "AnotherFakeApiService.Call123TestSpecialTags") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "AnotherFakeApiService.Call123TestSpecialTags") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -51,6 +73,10 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, cli localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.client == nil { + return localVarReturnValue, nil, reportError("client is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -70,13 +96,13 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, cli localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &client - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.client + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -94,7 +120,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, cli } if localVarHTTPResponse.StatusCode == 200 { var v Client - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -104,7 +130,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, cli return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_default.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_default.go index dd977e26c038..6fce4e6b2eb4 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,12 +24,29 @@ var ( // DefaultApiService DefaultApi service type DefaultApiService service +type apiFooGetRequest struct { + ctx _context.Context + apiService *DefaultApiService +} + + /* FooGet Method for FooGet * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). -@return InlineResponseDefault +@return apiFooGetRequest +*/ +func (a *DefaultApiService) FooGet(ctx _context.Context) apiFooGetRequest { + return apiFooGetRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return InlineResponseDefault */ -func (a *DefaultApiService) FooGet(ctx _context.Context) (InlineResponseDefault, *_nethttp.Response, error) { +func (r apiFooGetRequest) Execute() (InlineResponseDefault, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -39,7 +56,7 @@ func (a *DefaultApiService) FooGet(ctx _context.Context) (InlineResponseDefault, localVarReturnValue InlineResponseDefault ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "DefaultApiService.FooGet") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.FooGet") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -67,12 +84,12 @@ func (a *DefaultApiService) FooGet(ctx _context.Context) (InlineResponseDefault, if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -89,7 +106,7 @@ func (a *DefaultApiService) FooGet(ctx _context.Context) (InlineResponseDefault, error: localVarHTTPResponse.Status, } var v InlineResponseDefault - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -98,7 +115,7 @@ func (a *DefaultApiService) FooGet(ctx _context.Context) (InlineResponseDefault, return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_fake.go index 7f38a455470f..11699dfe9af7 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 @@ -14,8 +14,8 @@ import ( _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" - "github.com/antihax/optional" "os" + "time" "reflect" ) @@ -27,12 +27,29 @@ var ( // FakeApiService FakeApi service type FakeApiService service +type apiFakeHealthGetRequest struct { + ctx _context.Context + apiService *FakeApiService +} + + /* FakeHealthGet Health check endpoint * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). -@return HealthCheckResult +@return apiFakeHealthGetRequest +*/ +func (a *FakeApiService) FakeHealthGet(ctx _context.Context) apiFakeHealthGetRequest { + return apiFakeHealthGetRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return HealthCheckResult */ -func (a *FakeApiService) FakeHealthGet(ctx _context.Context) (HealthCheckResult, *_nethttp.Response, error) { +func (r apiFakeHealthGetRequest) Execute() (HealthCheckResult, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -42,7 +59,7 @@ func (a *FakeApiService) FakeHealthGet(ctx _context.Context) (HealthCheckResult, localVarReturnValue HealthCheckResult ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.FakeHealthGet") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeHealthGet") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -70,12 +87,12 @@ func (a *FakeApiService) FakeHealthGet(ctx _context.Context) (HealthCheckResult, if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -93,7 +110,7 @@ func (a *FakeApiService) FakeHealthGet(ctx _context.Context) (HealthCheckResult, } if localVarHTTPResponse.StatusCode == 200 { var v HealthCheckResult - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -103,7 +120,7 @@ func (a *FakeApiService) FakeHealthGet(ctx _context.Context) (HealthCheckResult, return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -114,21 +131,36 @@ func (a *FakeApiService) FakeHealthGet(ctx _context.Context) (HealthCheckResult, return localVarReturnValue, localVarHTTPResponse, nil } +type apiFakeOuterBooleanSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + body *bool +} -// FakeOuterBooleanSerializeOpts Optional parameters for the method 'FakeOuterBooleanSerialize' -type FakeOuterBooleanSerializeOpts struct { - Body optional.Bool + +func (r apiFakeOuterBooleanSerializeRequest) Body(body bool) apiFakeOuterBooleanSerializeRequest { + r.body = &body + return r } /* FakeOuterBooleanSerialize Method for FakeOuterBooleanSerialize Test serialization of outer boolean types * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param optional nil or *FakeOuterBooleanSerializeOpts - Optional Parameters: - * @param "Body" (optional.Bool) - Input boolean as post body -@return bool +@return apiFakeOuterBooleanSerializeRequest +*/ +func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context) apiFakeOuterBooleanSerializeRequest { + return apiFakeOuterBooleanSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return bool */ -func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *_nethttp.Response, error) { +func (r apiFakeOuterBooleanSerializeRequest) Execute() (bool, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -138,7 +170,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa localVarReturnValue bool ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.FakeOuterBooleanSerialize") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterBooleanSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -148,7 +180,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -167,16 +199,13 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - if localVarOptionals != nil && localVarOptionals.Body.IsSet() { - localVarPostBody = localVarOptionals.Body.Value() - } - - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -194,7 +223,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa } if localVarHTTPResponse.StatusCode == 200 { var v bool - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -204,7 +233,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -215,21 +244,36 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx _context.Context, localVa return localVarReturnValue, localVarHTTPResponse, nil } +type apiFakeOuterCompositeSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + outerComposite *OuterComposite +} + -// FakeOuterCompositeSerializeOpts Optional parameters for the method 'FakeOuterCompositeSerialize' -type FakeOuterCompositeSerializeOpts struct { - OuterComposite optional.Interface +func (r apiFakeOuterCompositeSerializeRequest) OuterComposite(outerComposite OuterComposite) apiFakeOuterCompositeSerializeRequest { + r.outerComposite = &outerComposite + return r } /* FakeOuterCompositeSerialize Method for FakeOuterCompositeSerialize Test serialization of object with outer number type * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param optional nil or *FakeOuterCompositeSerializeOpts - Optional Parameters: - * @param "OuterComposite" (optional.Interface of OuterComposite) - Input composite as post body -@return OuterComposite +@return apiFakeOuterCompositeSerializeRequest +*/ +func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context) apiFakeOuterCompositeSerializeRequest { + return apiFakeOuterCompositeSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return OuterComposite */ -func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *_nethttp.Response, error) { +func (r apiFakeOuterCompositeSerializeRequest) Execute() (OuterComposite, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -239,7 +283,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local localVarReturnValue OuterComposite ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.FakeOuterCompositeSerialize") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterCompositeSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -249,7 +293,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -268,20 +312,13 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - if localVarOptionals != nil && localVarOptionals.OuterComposite.IsSet() { - localVarOptionalOuterComposite, localVarOptionalOuterCompositeok := localVarOptionals.OuterComposite.Value().(OuterComposite) - if !localVarOptionalOuterCompositeok { - return localVarReturnValue, nil, reportError("outerComposite should be OuterComposite") - } - localVarPostBody = &localVarOptionalOuterComposite - } - - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.outerComposite + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -299,7 +336,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local } if localVarHTTPResponse.StatusCode == 200 { var v OuterComposite - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -309,7 +346,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -320,21 +357,36 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx _context.Context, local return localVarReturnValue, localVarHTTPResponse, nil } +type apiFakeOuterNumberSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + body *float32 +} -// FakeOuterNumberSerializeOpts Optional parameters for the method 'FakeOuterNumberSerialize' -type FakeOuterNumberSerializeOpts struct { - Body optional.Float32 + +func (r apiFakeOuterNumberSerializeRequest) Body(body float32) apiFakeOuterNumberSerializeRequest { + r.body = &body + return r } /* FakeOuterNumberSerialize Method for FakeOuterNumberSerialize Test serialization of outer number types * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param optional nil or *FakeOuterNumberSerializeOpts - Optional Parameters: - * @param "Body" (optional.Float32) - Input number as post body -@return float32 +@return apiFakeOuterNumberSerializeRequest +*/ +func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context) apiFakeOuterNumberSerializeRequest { + return apiFakeOuterNumberSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return float32 */ -func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *_nethttp.Response, error) { +func (r apiFakeOuterNumberSerializeRequest) Execute() (float32, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -344,7 +396,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar localVarReturnValue float32 ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.FakeOuterNumberSerialize") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterNumberSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -354,7 +406,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -373,16 +425,13 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - if localVarOptionals != nil && localVarOptionals.Body.IsSet() { - localVarPostBody = localVarOptionals.Body.Value() - } - - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -400,7 +449,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar } if localVarHTTPResponse.StatusCode == 200 { var v float32 - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -410,7 +459,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -421,21 +470,36 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx _context.Context, localVar return localVarReturnValue, localVarHTTPResponse, nil } +type apiFakeOuterStringSerializeRequest struct { + ctx _context.Context + apiService *FakeApiService + body *string +} + -// FakeOuterStringSerializeOpts Optional parameters for the method 'FakeOuterStringSerialize' -type FakeOuterStringSerializeOpts struct { - Body optional.String +func (r apiFakeOuterStringSerializeRequest) Body(body string) apiFakeOuterStringSerializeRequest { + r.body = &body + return r } /* FakeOuterStringSerialize Method for FakeOuterStringSerialize Test serialization of outer string types * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param optional nil or *FakeOuterStringSerializeOpts - Optional Parameters: - * @param "Body" (optional.String) - Input string as post body -@return string +@return apiFakeOuterStringSerializeRequest */ -func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *_nethttp.Response, error) { +func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context) apiFakeOuterStringSerializeRequest { + return apiFakeOuterStringSerializeRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return string +*/ +func (r apiFakeOuterStringSerializeRequest) Execute() (string, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -445,7 +509,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar localVarReturnValue string ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.FakeOuterStringSerialize") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.FakeOuterStringSerialize") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -455,7 +519,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -474,16 +538,13 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - if localVarOptionals != nil && localVarOptionals.Body.IsSet() { - localVarPostBody = localVarOptionals.Body.Value() - } - - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.body + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -501,7 +562,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar } if localVarHTTPResponse.StatusCode == 200 { var v string - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -511,7 +572,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -522,23 +583,46 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx _context.Context, localVar return localVarReturnValue, localVarHTTPResponse, nil } +type apiTestBodyWithFileSchemaRequest struct { + ctx _context.Context + apiService *FakeApiService + fileSchemaTestClass *FileSchemaTestClass +} + + +func (r apiTestBodyWithFileSchemaRequest) FileSchemaTestClass(fileSchemaTestClass FileSchemaTestClass) apiTestBodyWithFileSchemaRequest { + r.fileSchemaTestClass = &fileSchemaTestClass + return r +} /* TestBodyWithFileSchema Method for TestBodyWithFileSchema -For this test, the body for this request much reference a schema named `File`. +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 +@return apiTestBodyWithFileSchemaRequest */ -func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, fileSchemaTestClass FileSchemaTestClass) (*_nethttp.Response, error) { +func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context) apiTestBodyWithFileSchemaRequest { + return apiTestBodyWithFileSchemaRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + +*/ +func (r apiTestBodyWithFileSchemaRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestBodyWithFileSchema") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithFileSchema") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -548,6 +632,10 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, fileSchema localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.fileSchemaTestClass == nil { + return nil, reportError("fileSchemaTestClass is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -567,13 +655,13 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, fileSchema localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &fileSchemaTestClass - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.fileSchemaTestClass + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -594,23 +682,51 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx _context.Context, fileSchema return localVarHTTPResponse, nil } +type apiTestBodyWithQueryParamsRequest struct { + ctx _context.Context + apiService *FakeApiService + query *string + user *User +} + + +func (r apiTestBodyWithQueryParamsRequest) Query(query string) apiTestBodyWithQueryParamsRequest { + r.query = &query + return r +} + +func (r apiTestBodyWithQueryParamsRequest) User(user User) apiTestBodyWithQueryParamsRequest { + r.user = &user + return r +} /* TestBodyWithQueryParams Method for TestBodyWithQueryParams * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param query - * @param user +@return apiTestBodyWithQueryParamsRequest */ -func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query string, user User) (*_nethttp.Response, error) { +func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context) apiTestBodyWithQueryParamsRequest { + return apiTestBodyWithQueryParamsRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + +*/ +func (r apiTestBodyWithQueryParamsRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestBodyWithQueryParams") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithQueryParams") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -620,8 +736,16 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query str localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.query == nil { + return nil, reportError("query is required and must be specified") + } + + if r.user == nil { + return nil, reportError("user is required and must be specified") + } - localVarQueryParams.Add("query", parameterToString(query, "")) + localVarQueryParams.Add("query", parameterToString(*r.query, "")) // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -640,13 +764,13 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query str localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &user - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.user + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -667,15 +791,36 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx _context.Context, query str return localVarHTTPResponse, nil } +type apiTestClientModelRequest struct { + ctx _context.Context + apiService *FakeApiService + client *Client +} + + +func (r apiTestClientModelRequest) Client(client Client) apiTestClientModelRequest { + r.client = &client + return r +} /* TestClientModel To test \"client\" model -To test \"client\" model +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 apiTestClientModelRequest +*/ +func (a *FakeApiService) TestClientModel(ctx _context.Context) apiTestClientModelRequest { + return apiTestClientModelRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return Client */ -func (a *FakeApiService) TestClientModel(ctx _context.Context, client Client) (Client, *_nethttp.Response, error) { +func (r apiTestClientModelRequest) Execute() (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -685,7 +830,7 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, client Client) (C localVarReturnValue Client ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestClientModel") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestClientModel") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -695,6 +840,10 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, client Client) (C localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.client == nil { + return localVarReturnValue, nil, reportError("client is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -714,13 +863,13 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, client Client) (C localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &client - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.client + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -738,7 +887,7 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, client Client) (C } if localVarHTTPResponse.StatusCode == 200 { var v Client - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -748,7 +897,7 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, client Client) (C return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -759,51 +908,128 @@ func (a *FakeApiService) TestClientModel(ctx _context.Context, client Client) (C return localVarReturnValue, localVarHTTPResponse, nil } +type apiTestEndpointParametersRequest struct { + ctx _context.Context + apiService *FakeApiService + number *float32 + double *float64 + patternWithoutDelimiter *string + byte_ *string + integer *int32 + int32_ *int32 + int64_ *int64 + float *float32 + string_ *string + binary **os.File + date *string + dateTime *time.Time + password *string + callback *string +} + + +func (r apiTestEndpointParametersRequest) Number(number float32) apiTestEndpointParametersRequest { + r.number = &number + return r +} + +func (r apiTestEndpointParametersRequest) Double(double float64) apiTestEndpointParametersRequest { + r.double = &double + return r +} + +func (r apiTestEndpointParametersRequest) PatternWithoutDelimiter(patternWithoutDelimiter string) apiTestEndpointParametersRequest { + r.patternWithoutDelimiter = &patternWithoutDelimiter + return r +} + +func (r apiTestEndpointParametersRequest) Byte_(byte_ string) apiTestEndpointParametersRequest { + r.byte_ = &byte_ + return r +} + +func (r apiTestEndpointParametersRequest) Integer(integer int32) apiTestEndpointParametersRequest { + r.integer = &integer + return r +} + +func (r apiTestEndpointParametersRequest) Int32_(int32_ int32) apiTestEndpointParametersRequest { + r.int32_ = &int32_ + return r +} + +func (r apiTestEndpointParametersRequest) Int64_(int64_ int64) apiTestEndpointParametersRequest { + r.int64_ = &int64_ + return r +} + +func (r apiTestEndpointParametersRequest) Float(float float32) apiTestEndpointParametersRequest { + r.float = &float + return r +} + +func (r apiTestEndpointParametersRequest) String_(string_ string) apiTestEndpointParametersRequest { + r.string_ = &string_ + return r +} + +func (r apiTestEndpointParametersRequest) Binary(binary *os.File) apiTestEndpointParametersRequest { + r.binary = &binary + return r +} + +func (r apiTestEndpointParametersRequest) Date(date string) apiTestEndpointParametersRequest { + r.date = &date + return r +} + +func (r apiTestEndpointParametersRequest) DateTime(dateTime time.Time) apiTestEndpointParametersRequest { + r.dateTime = &dateTime + return r +} + +func (r apiTestEndpointParametersRequest) Password(password string) apiTestEndpointParametersRequest { + r.password = &password + return r +} -// TestEndpointParametersOpts Optional parameters for the method 'TestEndpointParameters' -type TestEndpointParametersOpts struct { - Integer optional.Int32 - Int32_ optional.Int32 - Int64_ optional.Int64 - Float optional.Float32 - String_ optional.String - Binary optional.Interface - Date optional.String - DateTime optional.Time - Password optional.String - Callback optional.String +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 假端點 偽のエンドポイント 가짜 엔드 포인트 +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 +@return apiTestEndpointParametersRequest +*/ +func (a *FakeApiService) TestEndpointParameters(ctx _context.Context) apiTestEndpointParametersRequest { + return apiTestEndpointParametersRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*_nethttp.Response, error) { +func (r apiTestEndpointParametersRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestEndpointParameters") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEndpointParameters") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -813,19 +1039,35 @@ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number flo localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if number < 32.1 { + + if r.number == nil { + return nil, reportError("number is required and must be specified") + } + if *r.number < 32.1 { return nil, reportError("number must be greater than 32.1") } - if number > 543.2 { + if *r.number > 543.2 { return nil, reportError("number must be less than 543.2") } - if double < 67.8 { + + if r.double == nil { + return nil, reportError("double is required and must be specified") + } + if *r.double < 67.8 { return nil, reportError("double must be greater than 67.8") } - if double > 123.4 { + if *r.double > 123.4 { return nil, reportError("double must be less than 123.4") } - + + if r.patternWithoutDelimiter == nil { + return nil, reportError("patternWithoutDelimiter is required and must be specified") + } + + if r.byte_ == nil { + return nil, reportError("byte_ is required and must be specified") + } + // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"} @@ -843,33 +1085,29 @@ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number flo if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if localVarOptionals != nil && localVarOptionals.Integer.IsSet() { - localVarFormParams.Add("integer", parameterToString(localVarOptionals.Integer.Value(), "")) + if r.integer != nil { + localVarFormParams.Add("integer", parameterToString(*r.integer, "")) } - if localVarOptionals != nil && localVarOptionals.Int32_.IsSet() { - localVarFormParams.Add("int32", parameterToString(localVarOptionals.Int32_.Value(), "")) + if r.int32_ != nil { + localVarFormParams.Add("int32", parameterToString(*r.int32_, "")) } - if localVarOptionals != nil && localVarOptionals.Int64_.IsSet() { - localVarFormParams.Add("int64", parameterToString(localVarOptionals.Int64_.Value(), "")) + if r.int64_ != nil { + localVarFormParams.Add("int64", parameterToString(*r.int64_, "")) } - localVarFormParams.Add("number", parameterToString(number, "")) - if localVarOptionals != nil && localVarOptionals.Float.IsSet() { - localVarFormParams.Add("float", parameterToString(localVarOptionals.Float.Value(), "")) + localVarFormParams.Add("number", parameterToString(*r.number, "")) + if r.float != nil { + localVarFormParams.Add("float", parameterToString(*r.float, "")) } - localVarFormParams.Add("double", parameterToString(double, "")) - if localVarOptionals != nil && localVarOptionals.String_.IsSet() { - localVarFormParams.Add("string", parameterToString(localVarOptionals.String_.Value(), "")) + localVarFormParams.Add("double", parameterToString(*r.double, "")) + if r.string_ != nil { + localVarFormParams.Add("string", parameterToString(*r.string_, "")) } - localVarFormParams.Add("pattern_without_delimiter", parameterToString(patternWithoutDelimiter, "")) - localVarFormParams.Add("byte", parameterToString(byte_, "")) + localVarFormParams.Add("pattern_without_delimiter", parameterToString(*r.patternWithoutDelimiter, "")) + localVarFormParams.Add("byte", parameterToString(*r.byte_, "")) localVarFormFileName = "binary" var localVarFile *os.File - if localVarOptionals != nil && localVarOptionals.Binary.IsSet() { - localVarFileOk := false - localVarFile, localVarFileOk = localVarOptionals.Binary.Value().(*os.File) - if !localVarFileOk { - return nil, reportError("binary should be *os.File") - } + if r.binary != nil { + localVarFile = *r.binary } if localVarFile != nil { fbs, _ := _ioutil.ReadAll(localVarFile) @@ -877,24 +1115,24 @@ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number flo localVarFileName = localVarFile.Name() localVarFile.Close() } - if localVarOptionals != nil && localVarOptionals.Date.IsSet() { - localVarFormParams.Add("date", parameterToString(localVarOptionals.Date.Value(), "")) + if r.date != nil { + localVarFormParams.Add("date", parameterToString(*r.date, "")) } - if localVarOptionals != nil && localVarOptionals.DateTime.IsSet() { - localVarFormParams.Add("dateTime", parameterToString(localVarOptionals.DateTime.Value(), "")) + if r.dateTime != nil { + localVarFormParams.Add("dateTime", parameterToString(*r.dateTime, "")) } - if localVarOptionals != nil && localVarOptionals.Password.IsSet() { - localVarFormParams.Add("password", parameterToString(localVarOptionals.Password.Value(), "")) + if r.password != nil { + localVarFormParams.Add("password", parameterToString(*r.password, "")) } - if localVarOptionals != nil && localVarOptionals.Callback.IsSet() { - localVarFormParams.Add("callback", parameterToString(localVarOptionals.Callback.Value(), "")) + if r.callback != nil { + localVarFormParams.Add("callback", parameterToString(*r.callback, "")) } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -915,43 +1153,88 @@ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number flo return localVarHTTPResponse, nil } +type apiTestEnumParametersRequest struct { + ctx _context.Context + apiService *FakeApiService + enumHeaderStringArray *[]string + enumHeaderString *string + enumQueryStringArray *[]string + enumQueryString *string + enumQueryInteger *int32 + enumQueryDouble *float64 + enumFormStringArray *[]string + enumFormString *string +} + + +func (r apiTestEnumParametersRequest) EnumHeaderStringArray(enumHeaderStringArray []string) apiTestEnumParametersRequest { + r.enumHeaderStringArray = &enumHeaderStringArray + return r +} + +func (r apiTestEnumParametersRequest) EnumHeaderString(enumHeaderString string) apiTestEnumParametersRequest { + r.enumHeaderString = &enumHeaderString + return r +} + +func (r apiTestEnumParametersRequest) EnumQueryStringArray(enumQueryStringArray []string) apiTestEnumParametersRequest { + r.enumQueryStringArray = &enumQueryStringArray + return r +} + +func (r apiTestEnumParametersRequest) EnumQueryString(enumQueryString string) apiTestEnumParametersRequest { + r.enumQueryString = &enumQueryString + return r +} + +func (r apiTestEnumParametersRequest) EnumQueryInteger(enumQueryInteger int32) apiTestEnumParametersRequest { + r.enumQueryInteger = &enumQueryInteger + return r +} -// TestEnumParametersOpts Optional parameters for the method 'TestEnumParameters' -type TestEnumParametersOpts struct { - EnumHeaderStringArray optional.Interface - EnumHeaderString optional.String - EnumQueryStringArray optional.Interface - EnumQueryString optional.String - EnumQueryInteger optional.Int32 - EnumQueryDouble optional.Float64 - EnumFormStringArray optional.Interface - EnumFormString optional.String +func (r apiTestEnumParametersRequest) EnumQueryDouble(enumQueryDouble float64) apiTestEnumParametersRequest { + r.enumQueryDouble = &enumQueryDouble + return r +} + +func (r apiTestEnumParametersRequest) EnumFormStringArray(enumFormStringArray []string) apiTestEnumParametersRequest { + r.enumFormStringArray = &enumFormStringArray + return r +} + +func (r apiTestEnumParametersRequest) EnumFormString(enumFormString string) apiTestEnumParametersRequest { + r.enumFormString = &enumFormString + return r } /* TestEnumParameters To test enum parameters To test enum parameters * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @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) +@return apiTestEnumParametersRequest +*/ +func (a *FakeApiService) TestEnumParameters(ctx _context.Context) apiTestEnumParametersRequest { + return apiTestEnumParametersRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOptionals *TestEnumParametersOpts) (*_nethttp.Response, error) { +func (r apiTestEnumParametersRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestEnumParameters") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEnumParameters") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -961,9 +1244,9 @@ func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOption localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - - if localVarOptionals != nil && localVarOptionals.EnumQueryStringArray.IsSet() { - t:=localVarOptionals.EnumQueryStringArray.Value() + + if r.enumQueryStringArray != nil { + t := *r.enumQueryStringArray if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { @@ -973,14 +1256,14 @@ func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOption localVarQueryParams.Add("enum_query_string_array", parameterToString(t, "multi")) } } - if localVarOptionals != nil && localVarOptionals.EnumQueryString.IsSet() { - localVarQueryParams.Add("enum_query_string", parameterToString(localVarOptionals.EnumQueryString.Value(), "")) + if r.enumQueryString != nil { + localVarQueryParams.Add("enum_query_string", parameterToString(*r.enumQueryString, "")) } - if localVarOptionals != nil && localVarOptionals.EnumQueryInteger.IsSet() { - localVarQueryParams.Add("enum_query_integer", parameterToString(localVarOptionals.EnumQueryInteger.Value(), "")) + if r.enumQueryInteger != nil { + localVarQueryParams.Add("enum_query_integer", parameterToString(*r.enumQueryInteger, "")) } - if localVarOptionals != nil && localVarOptionals.EnumQueryDouble.IsSet() { - localVarQueryParams.Add("enum_query_double", parameterToString(localVarOptionals.EnumQueryDouble.Value(), "")) + if r.enumQueryDouble != nil { + localVarQueryParams.Add("enum_query_double", parameterToString(*r.enumQueryDouble, "")) } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"} @@ -999,24 +1282,24 @@ func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOption if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if localVarOptionals != nil && localVarOptionals.EnumHeaderStringArray.IsSet() { - localVarHeaderParams["enum_header_string_array"] = parameterToString(localVarOptionals.EnumHeaderStringArray.Value(), "csv") + if r.enumHeaderStringArray != nil { + localVarHeaderParams["enum_header_string_array"] = parameterToString(*r.enumHeaderStringArray, "csv") } - if localVarOptionals != nil && localVarOptionals.EnumHeaderString.IsSet() { - localVarHeaderParams["enum_header_string"] = parameterToString(localVarOptionals.EnumHeaderString.Value(), "") + if r.enumHeaderString != nil { + localVarHeaderParams["enum_header_string"] = parameterToString(*r.enumHeaderString, "") } - if localVarOptionals != nil && localVarOptionals.EnumFormStringArray.IsSet() { - localVarFormParams.Add("enum_form_string_array", parameterToString(localVarOptionals.EnumFormStringArray.Value(), "csv")) + if r.enumFormStringArray != nil { + localVarFormParams.Add("enum_form_string_array", parameterToString(*r.enumFormStringArray, "csv")) } - if localVarOptionals != nil && localVarOptionals.EnumFormString.IsSet() { - localVarFormParams.Add("enum_form_string", parameterToString(localVarOptionals.EnumFormString.Value(), "")) + if r.enumFormString != nil { + localVarFormParams.Add("enum_form_string", parameterToString(*r.enumFormString, "")) } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1037,36 +1320,76 @@ func (a *FakeApiService) TestEnumParameters(ctx _context.Context, localVarOption return localVarHTTPResponse, nil } +type apiTestGroupParametersRequest struct { + ctx _context.Context + apiService *FakeApiService + requiredStringGroup *int32 + requiredBooleanGroup *bool + requiredInt64Group *int64 + stringGroup *int32 + booleanGroup *bool + int64Group *int64 +} + -// TestGroupParametersOpts Optional parameters for the method 'TestGroupParameters' -type TestGroupParametersOpts struct { - StringGroup optional.Int32 - BooleanGroup optional.Bool - Int64Group optional.Int64 +func (r apiTestGroupParametersRequest) RequiredStringGroup(requiredStringGroup int32) apiTestGroupParametersRequest { + r.requiredStringGroup = &requiredStringGroup + return r +} + +func (r apiTestGroupParametersRequest) RequiredBooleanGroup(requiredBooleanGroup bool) apiTestGroupParametersRequest { + r.requiredBooleanGroup = &requiredBooleanGroup + return r +} + +func (r apiTestGroupParametersRequest) RequiredInt64Group(requiredInt64Group int64) apiTestGroupParametersRequest { + r.requiredInt64Group = &requiredInt64Group + return r +} + +func (r apiTestGroupParametersRequest) StringGroup(stringGroup int32) apiTestGroupParametersRequest { + r.stringGroup = &stringGroup + return r +} + +func (r apiTestGroupParametersRequest) BooleanGroup(booleanGroup bool) apiTestGroupParametersRequest { + r.booleanGroup = &booleanGroup + return r +} + +func (r apiTestGroupParametersRequest) Int64Group(int64Group int64) apiTestGroupParametersRequest { + r.int64Group = &int64Group + return r } /* TestGroupParameters Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @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 +@return apiTestGroupParametersRequest */ -func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStringGroup int32, requiredBooleanGroup bool, requiredInt64Group int64, localVarOptionals *TestGroupParametersOpts) (*_nethttp.Response, error) { +func (a *FakeApiService) TestGroupParameters(ctx _context.Context) apiTestGroupParametersRequest { + return apiTestGroupParametersRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + +*/ +func (r apiTestGroupParametersRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestGroupParameters") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestGroupParameters") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1076,14 +1399,26 @@ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStrin localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - - localVarQueryParams.Add("required_string_group", parameterToString(requiredStringGroup, "")) - localVarQueryParams.Add("required_int64_group", parameterToString(requiredInt64Group, "")) - if localVarOptionals != nil && localVarOptionals.StringGroup.IsSet() { - localVarQueryParams.Add("string_group", parameterToString(localVarOptionals.StringGroup.Value(), "")) + + if r.requiredStringGroup == nil { + return nil, reportError("requiredStringGroup is required and must be specified") + } + + if r.requiredBooleanGroup == nil { + return nil, reportError("requiredBooleanGroup is required and must be specified") } - if localVarOptionals != nil && localVarOptionals.Int64Group.IsSet() { - localVarQueryParams.Add("int64_group", parameterToString(localVarOptionals.Int64Group.Value(), "")) + + if r.requiredInt64Group == nil { + return nil, reportError("requiredInt64Group is required and must be specified") + } + + localVarQueryParams.Add("required_string_group", parameterToString(*r.requiredStringGroup, "")) + localVarQueryParams.Add("required_int64_group", parameterToString(*r.requiredInt64Group, "")) + if r.stringGroup != nil { + localVarQueryParams.Add("string_group", parameterToString(*r.stringGroup, "")) + } + if r.int64Group != nil { + localVarQueryParams.Add("int64_group", parameterToString(*r.int64Group, "")) } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1102,16 +1437,16 @@ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStrin if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - localVarHeaderParams["required_boolean_group"] = parameterToString(requiredBooleanGroup, "") - if localVarOptionals != nil && localVarOptionals.BooleanGroup.IsSet() { - localVarHeaderParams["boolean_group"] = parameterToString(localVarOptionals.BooleanGroup.Value(), "") + localVarHeaderParams["required_boolean_group"] = parameterToString(*r.requiredBooleanGroup, "") + if r.booleanGroup != nil { + localVarHeaderParams["boolean_group"] = parameterToString(*r.booleanGroup, "") } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1132,22 +1467,45 @@ func (a *FakeApiService) TestGroupParameters(ctx _context.Context, requiredStrin return localVarHTTPResponse, nil } +type apiTestInlineAdditionalPropertiesRequest struct { + ctx _context.Context + apiService *FakeApiService + requestBody *map[string]string +} + + +func (r apiTestInlineAdditionalPropertiesRequest) RequestBody(requestBody map[string]string) apiTestInlineAdditionalPropertiesRequest { + r.requestBody = &requestBody + return r +} /* TestInlineAdditionalProperties test inline additionalProperties * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param requestBody request body +@return apiTestInlineAdditionalPropertiesRequest */ -func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, requestBody map[string]string) (*_nethttp.Response, error) { +func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context) apiTestInlineAdditionalPropertiesRequest { + return apiTestInlineAdditionalPropertiesRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + +*/ +func (r apiTestInlineAdditionalPropertiesRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestInlineAdditionalProperties") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestInlineAdditionalProperties") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1157,6 +1515,10 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, re localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.requestBody == nil { + return nil, reportError("requestBody is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -1176,13 +1538,13 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, re localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &requestBody - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.requestBody + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1203,23 +1565,51 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx _context.Context, re return localVarHTTPResponse, nil } +type apiTestJsonFormDataRequest struct { + ctx _context.Context + apiService *FakeApiService + param *string + param2 *string +} + + +func (r apiTestJsonFormDataRequest) Param(param string) apiTestJsonFormDataRequest { + r.param = ¶m + return r +} + +func (r apiTestJsonFormDataRequest) Param2(param2 string) apiTestJsonFormDataRequest { + r.param2 = ¶m2 + return r +} /* TestJsonFormData test json serialization of form data * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param param field1 - * @param param2 field2 +@return apiTestJsonFormDataRequest +*/ +func (a *FakeApiService) TestJsonFormData(ctx _context.Context) apiTestJsonFormDataRequest { + return apiTestJsonFormDataRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, param2 string) (*_nethttp.Response, error) { +func (r apiTestJsonFormDataRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestJsonFormData") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestJsonFormData") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1229,6 +1619,14 @@ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, pa localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.param == nil { + return nil, reportError("param is required and must be specified") + } + + if r.param2 == nil { + return nil, reportError("param2 is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"} @@ -1247,14 +1645,14 @@ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, pa if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - localVarFormParams.Add("param", parameterToString(param, "")) - localVarFormParams.Add("param2", parameterToString(param2, "")) - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarFormParams.Add("param", parameterToString(*r.param, "")) + localVarFormParams.Add("param2", parameterToString(*r.param2, "")) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -1275,27 +1673,70 @@ func (a *FakeApiService) TestJsonFormData(ctx _context.Context, param string, pa return localVarHTTPResponse, nil } +type apiTestQueryParameterCollectionFormatRequest struct { + ctx _context.Context + apiService *FakeApiService + pipe *[]string + ioutil *[]string + http *[]string + url *[]string + context *[]string +} + + +func (r apiTestQueryParameterCollectionFormatRequest) Pipe(pipe []string) apiTestQueryParameterCollectionFormatRequest { + r.pipe = &pipe + return r +} + +func (r apiTestQueryParameterCollectionFormatRequest) Ioutil(ioutil []string) apiTestQueryParameterCollectionFormatRequest { + r.ioutil = &ioutil + return r +} + +func (r apiTestQueryParameterCollectionFormatRequest) Http(http []string) apiTestQueryParameterCollectionFormatRequest { + r.http = &http + return r +} + +func (r apiTestQueryParameterCollectionFormatRequest) Url(url []string) apiTestQueryParameterCollectionFormatRequest { + r.url = &url + return r +} + +func (r apiTestQueryParameterCollectionFormatRequest) Context(context []string) apiTestQueryParameterCollectionFormatRequest { + r.context = &context + return r +} /* TestQueryParameterCollectionFormat Method for TestQueryParameterCollectionFormat To test the collection format in query parameters * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param pipe - * @param ioutil - * @param http - * @param url - * @param context +@return apiTestQueryParameterCollectionFormatRequest */ -func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context, pipe []string, ioutil []string, http []string, url []string, context []string) (*_nethttp.Response, error) { +func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context) apiTestQueryParameterCollectionFormatRequest { + return apiTestQueryParameterCollectionFormatRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + +*/ +func (r apiTestQueryParameterCollectionFormatRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeApiService.TestQueryParameterCollectionFormat") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestQueryParameterCollectionFormat") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -1305,8 +1746,28 @@ func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.pipe == nil { + return nil, reportError("pipe is required and must be specified") + } + + if r.ioutil == nil { + return nil, reportError("ioutil is required and must be specified") + } + + if r.http == nil { + return nil, reportError("http is required and must be specified") + } + + if r.url == nil { + return nil, reportError("url is required and must be specified") + } + + if r.context == nil { + return nil, reportError("context is required and must be specified") + } - t:=pipe + t := *r.pipe if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { @@ -1315,10 +1776,10 @@ func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context } else { localVarQueryParams.Add("pipe", parameterToString(t, "multi")) } - localVarQueryParams.Add("ioutil", parameterToString(ioutil, "csv")) - localVarQueryParams.Add("http", parameterToString(http, "space")) - localVarQueryParams.Add("url", parameterToString(url, "csv")) - t:=context + localVarQueryParams.Add("ioutil", parameterToString(*r.ioutil, "csv")) + localVarQueryParams.Add("http", parameterToString(*r.http, "space")) + localVarQueryParams.Add("url", parameterToString(*r.url, "csv")) + t := *r.context if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { @@ -1344,12 +1805,12 @@ func (a *FakeApiService) TestQueryParameterCollectionFormat(ctx _context.Context if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.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 a85385b85fd4..d305d41b1e4d 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,14 +24,36 @@ var ( // FakeClassnameTags123ApiService FakeClassnameTags123Api service type FakeClassnameTags123ApiService service +type apiTestClassnameRequest struct { + ctx _context.Context + apiService *FakeClassnameTags123ApiService + client *Client +} + + +func (r apiTestClassnameRequest) Client(client Client) apiTestClassnameRequest { + r.client = &client + return r +} + /* TestClassname To test class name in snake case To test class name in snake case * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param client client model -@return Client +@return apiTestClassnameRequest */ -func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, client Client) (Client, *_nethttp.Response, error) { +func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context) apiTestClassnameRequest { + return apiTestClassnameRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return Client +*/ +func (r apiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -41,7 +63,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, cli localVarReturnValue Client ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeClassnameTags123ApiService.TestClassname") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeClassnameTags123ApiService.TestClassname") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -51,6 +73,10 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, cli localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.client == nil { + return localVarReturnValue, nil, reportError("client is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -70,10 +96,10 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, cli localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &client - if ctx != nil { + localVarPostBody = r.client + if r.ctx != nil { // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { if auth, ok := auth["api_key_query"]; ok { var key string if auth.Prefix != "" { @@ -85,12 +111,12 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, cli } } } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -108,7 +134,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, cli } if localVarHTTPResponse.StatusCode == 200 { var v Client - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -118,7 +144,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, cli return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_pet.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_pet.go index e52c8158f5c8..d3043440519c 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 @@ -15,7 +15,6 @@ import ( _nethttp "net/http" _neturl "net/url" "strings" - "github.com/antihax/optional" "os" ) @@ -27,21 +26,45 @@ var ( // PetApiService PetApi service type PetApiService service +type apiAddPetRequest struct { + ctx _context.Context + apiService *PetApiService + pet *Pet +} + + +func (r apiAddPetRequest) Pet(pet Pet) apiAddPetRequest { + r.pet = &pet + return r +} + /* AddPet Add a new pet to the store * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param pet Pet object that needs to be added to the store +@return apiAddPetRequest +*/ +func (a *PetApiService) AddPet(ctx _context.Context) apiAddPetRequest { + return apiAddPetRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *PetApiService) AddPet(ctx _context.Context, pet Pet) (*_nethttp.Response, error) { +func (r apiAddPetRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.AddPet") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.AddPet") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -51,6 +74,10 @@ func (a *PetApiService) AddPet(ctx _context.Context, pet Pet) (*_nethttp.Respons localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.pet == nil { + return nil, reportError("pet is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json", "application/xml"} @@ -70,13 +97,13 @@ func (a *PetApiService) AddPet(ctx _context.Context, pet Pet) (*_nethttp.Respons localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &pet - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.pet + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -97,40 +124,60 @@ func (a *PetApiService) AddPet(ctx _context.Context, pet Pet) (*_nethttp.Respons return localVarHTTPResponse, nil } +type apiDeletePetRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + apiKey *string +} + -// DeletePetOpts Optional parameters for the method 'DeletePet' -type DeletePetOpts struct { - ApiKey optional.String +func (r apiDeletePetRequest) ApiKey(apiKey string) apiDeletePetRequest { + r.apiKey = &apiKey + return r } /* DeletePet Deletes a pet * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param petId Pet id to delete - * @param optional nil or *DeletePetOpts - Optional Parameters: - * @param "ApiKey" (optional.String) - +@return apiDeletePetRequest */ -func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOptionals *DeletePetOpts) (*_nethttp.Response, error) { +func (a *PetApiService) DeletePet(ctx _context.Context, petId int64) apiDeletePetRequest { + return apiDeletePetRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request + +*/ +func (r apiDeletePetRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.DeletePet") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.DeletePet") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -148,15 +195,15 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if localVarOptionals != nil && localVarOptionals.ApiKey.IsSet() { - localVarHeaderParams["api_key"] = parameterToString(localVarOptionals.ApiKey.Value(), "") + if r.apiKey != nil { + localVarHeaderParams["api_key"] = parameterToString(*r.apiKey, "") } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -177,15 +224,36 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt return localVarHTTPResponse, nil } +type apiFindPetsByStatusRequest struct { + ctx _context.Context + apiService *PetApiService + status *[]string +} + + +func (r apiFindPetsByStatusRequest) Status(status []string) apiFindPetsByStatusRequest { + r.status = &status + return r +} /* FindPetsByStatus Finds Pets by status Multiple status values can be provided with comma separated strings * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param status Status values that need to be considered for filter -@return []Pet +@return apiFindPetsByStatusRequest +*/ +func (a *PetApiService) FindPetsByStatus(ctx _context.Context) apiFindPetsByStatusRequest { + return apiFindPetsByStatusRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return []Pet */ -func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) ([]Pet, *_nethttp.Response, error) { +func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -195,7 +263,7 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) localVarReturnValue []Pet ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.FindPetsByStatus") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByStatus") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -205,8 +273,12 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.status == nil { + return localVarReturnValue, nil, reportError("status is required and must be specified") + } - localVarQueryParams.Add("status", parameterToString(status, "csv")) + localVarQueryParams.Add("status", parameterToString(*r.status, "csv")) // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -224,12 +296,12 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -247,7 +319,7 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) } if localVarHTTPResponse.StatusCode == 200 { var v []Pet - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -258,7 +330,7 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -269,15 +341,36 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) return localVarReturnValue, localVarHTTPResponse, nil } +type apiFindPetsByTagsRequest struct { + ctx _context.Context + apiService *PetApiService + tags *[]string +} + + +func (r apiFindPetsByTagsRequest) Tags(tags []string) apiFindPetsByTagsRequest { + r.tags = &tags + return r +} /* FindPetsByTags Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param tags Tags to filter by -@return []Pet +@return apiFindPetsByTagsRequest */ -func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]Pet, *_nethttp.Response, error) { +func (a *PetApiService) FindPetsByTags(ctx _context.Context) apiFindPetsByTagsRequest { + return apiFindPetsByTagsRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return []Pet +*/ +func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -287,7 +380,7 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P localVarReturnValue []Pet ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.FindPetsByTags") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByTags") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -297,8 +390,12 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.tags == nil { + return localVarReturnValue, nil, reportError("tags is required and must be specified") + } - localVarQueryParams.Add("tags", parameterToString(tags, "csv")) + localVarQueryParams.Add("tags", parameterToString(*r.tags, "csv")) // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -316,12 +413,12 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -339,7 +436,7 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P } if localVarHTTPResponse.StatusCode == 200 { var v []Pet - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -350,7 +447,7 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -361,15 +458,33 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P return localVarReturnValue, localVarHTTPResponse, nil } +type apiGetPetByIdRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 +} + /* GetPetById Find pet by ID Returns a single pet * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param petId ID of pet to return -@return Pet +@return apiGetPetByIdRequest +*/ +func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) apiGetPetByIdRequest { + return apiGetPetByIdRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request + @return Pet */ -func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_nethttp.Response, error) { +func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -379,17 +494,18 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne localVarReturnValue Pet ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.GetPetById") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.GetPetById") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -408,9 +524,9 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if ctx != nil { + if r.ctx != nil { // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { if auth, ok := auth["api_key"]; ok { var key string if auth.Prefix != "" { @@ -422,12 +538,12 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne } } } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -445,7 +561,7 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne } if localVarHTTPResponse.StatusCode == 200 { var v Pet - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -456,7 +572,7 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -467,22 +583,45 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne return localVarReturnValue, localVarHTTPResponse, nil } +type apiUpdatePetRequest struct { + ctx _context.Context + apiService *PetApiService + pet *Pet +} + + +func (r apiUpdatePetRequest) Pet(pet Pet) apiUpdatePetRequest { + r.pet = &pet + return r +} /* UpdatePet Update an existing pet * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param pet Pet object that needs to be added to the store +@return apiUpdatePetRequest +*/ +func (a *PetApiService) UpdatePet(ctx _context.Context) apiUpdatePetRequest { + return apiUpdatePetRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *PetApiService) UpdatePet(ctx _context.Context, pet Pet) (*_nethttp.Response, error) { +func (r apiUpdatePetRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UpdatePet") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePet") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -492,6 +631,10 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, pet Pet) (*_nethttp.Resp localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.pet == nil { + return nil, reportError("pet is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json", "application/xml"} @@ -511,13 +654,13 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, pet Pet) (*_nethttp.Resp localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &pet - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.pet + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -538,42 +681,66 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, pet Pet) (*_nethttp.Resp return localVarHTTPResponse, nil } +type apiUpdatePetWithFormRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + name *string + status *string +} + + +func (r apiUpdatePetWithFormRequest) Name(name string) apiUpdatePetWithFormRequest { + r.name = &name + return r +} -// UpdatePetWithFormOpts Optional parameters for the method 'UpdatePetWithForm' -type UpdatePetWithFormOpts struct { - Name optional.String - Status optional.String +func (r apiUpdatePetWithFormRequest) Status(status string) apiUpdatePetWithFormRequest { + r.status = &status + return r } /* UpdatePetWithForm Updates a pet in the store with form data * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param petId ID of pet that needs to be updated - * @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 +@return apiUpdatePetWithFormRequest +*/ +func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64) apiUpdatePetWithFormRequest { + return apiUpdatePetWithFormRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request + */ -func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*_nethttp.Response, error) { +func (r apiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UpdatePetWithForm") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePetWithForm") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/pet/{petId}" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + + // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"} @@ -591,18 +758,18 @@ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, loc if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if localVarOptionals != nil && localVarOptionals.Name.IsSet() { - localVarFormParams.Add("name", parameterToString(localVarOptionals.Name.Value(), "")) + if r.name != nil { + localVarFormParams.Add("name", parameterToString(*r.name, "")) } - if localVarOptionals != nil && localVarOptionals.Status.IsSet() { - localVarFormParams.Add("status", parameterToString(localVarOptionals.Status.Value(), "")) + if r.status != nil { + localVarFormParams.Add("status", parameterToString(*r.status, "")) } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -623,23 +790,44 @@ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, loc return localVarHTTPResponse, nil } +type apiUploadFileRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + additionalMetadata *string + file **os.File +} + + +func (r apiUploadFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileRequest { + r.additionalMetadata = &additionalMetadata + return r +} -// UploadFileOpts Optional parameters for the method 'UploadFile' -type UploadFileOpts struct { - AdditionalMetadata optional.String - File optional.Interface +func (r apiUploadFileRequest) File(file *os.File) apiUploadFileRequest { + r.file = &file + return r } /* UploadFile uploads an image * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param petId ID of pet to update - * @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 apiUploadFileRequest +*/ +func (a *PetApiService) UploadFile(ctx _context.Context, petId int64) apiUploadFileRequest { + return apiUploadFileRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request + @return ApiResponse */ -func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *_nethttp.Response, error) { +func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -649,18 +837,19 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp localVarReturnValue ApiResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UploadFile") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFile") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/pet/{petId}/uploadImage" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + + // to determine the Content-Type header localVarHTTPContentTypes := []string{"multipart/form-data"} @@ -678,17 +867,13 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() { - localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), "")) + if r.additionalMetadata != nil { + localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, "")) } localVarFormFileName = "file" var localVarFile *os.File - if localVarOptionals != nil && localVarOptionals.File.IsSet() { - localVarFileOk := false - localVarFile, localVarFileOk = localVarOptionals.File.Value().(*os.File) - if !localVarFileOk { - return localVarReturnValue, nil, reportError("file should be *os.File") - } + if r.file != nil { + localVarFile = *r.file } if localVarFile != nil { fbs, _ := _ioutil.ReadAll(localVarFile) @@ -696,12 +881,12 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp localVarFileName = localVarFile.Name() localVarFile.Close() } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -719,7 +904,7 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp } if localVarHTTPResponse.StatusCode == 200 { var v ApiResponse - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -729,7 +914,7 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -740,22 +925,44 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp return localVarReturnValue, localVarHTTPResponse, nil } +type apiUploadFileWithRequiredFileRequest struct { + ctx _context.Context + apiService *PetApiService + petId int64 + requiredFile **os.File + additionalMetadata *string +} + + +func (r apiUploadFileWithRequiredFileRequest) RequiredFile(requiredFile *os.File) apiUploadFileWithRequiredFileRequest { + r.requiredFile = &requiredFile + return r +} -// UploadFileWithRequiredFileOpts Optional parameters for the method 'UploadFileWithRequiredFile' -type UploadFileWithRequiredFileOpts struct { - AdditionalMetadata optional.String +func (r apiUploadFileWithRequiredFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileWithRequiredFileRequest { + r.additionalMetadata = &additionalMetadata + return r } /* UploadFileWithRequiredFile uploads an image (required) * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param petId ID of pet to update - * @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 apiUploadFileWithRequiredFileRequest */ -func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *_nethttp.Response, error) { +func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64) apiUploadFileWithRequiredFileRequest { + return apiUploadFileWithRequiredFileRequest{ + apiService: a, + ctx: ctx, + petId: petId, + } +} + +/* +Execute executes the request + @return ApiResponse +*/ +func (r apiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -765,18 +972,23 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i localVarReturnValue ApiResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UploadFileWithRequiredFile") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFileWithRequiredFile") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/fake/{petId}/uploadImageWithRequiredFile" - localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - + + + if r.requiredFile == nil { + return localVarReturnValue, nil, reportError("requiredFile is required and must be specified") + } + // to determine the Content-Type header localVarHTTPContentTypes := []string{"multipart/form-data"} @@ -794,23 +1006,23 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() { - localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), "")) + if r.additionalMetadata != nil { + localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, "")) } localVarFormFileName = "requiredFile" - localVarFile := requiredFile + localVarFile := *r.requiredFile if localVarFile != nil { fbs, _ := _ioutil.ReadAll(localVarFile) localVarFileBytes = fbs localVarFileName = localVarFile.Name() localVarFile.Close() } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -828,7 +1040,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i } if localVarHTTPResponse.StatusCode == 200 { var v ApiResponse - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -838,7 +1050,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_store.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_store.go index f1162bb61c3e..3e82fd51a70e 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,32 +25,54 @@ var ( // StoreApiService StoreApi service type StoreApiService service +type apiDeleteOrderRequest struct { + ctx _context.Context + apiService *StoreApiService + orderId string +} + + /* DeleteOrder Delete purchase order by ID -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param orderId ID of the order that needs to be deleted +@return apiDeleteOrderRequest +*/ +func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) apiDeleteOrderRequest { + return apiDeleteOrderRequest{ + apiService: a, + ctx: ctx, + orderId: orderId, + } +} + +/* +Execute executes the request + */ -func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_nethttp.Response, error) { +func (r apiDeleteOrderRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.DeleteOrder") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.DeleteOrder") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/store/order/{order_id}" - localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(r.orderId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -69,12 +91,12 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -95,14 +117,30 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n return localVarHTTPResponse, nil } +type apiGetInventoryRequest struct { + ctx _context.Context + apiService *StoreApiService +} + /* GetInventory Returns pet inventories by status Returns a map of status codes to quantities * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). -@return map[string]int32 +@return apiGetInventoryRequest +*/ +func (a *StoreApiService) GetInventory(ctx _context.Context) apiGetInventoryRequest { + return apiGetInventoryRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return map[string]int32 */ -func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, *_nethttp.Response, error) { +func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -112,7 +150,7 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, localVarReturnValue map[string]int32 ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.GetInventory") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetInventory") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -140,9 +178,9 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if ctx != nil { + if r.ctx != nil { // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { if auth, ok := auth["api_key"]; ok { var key string if auth.Prefix != "" { @@ -154,12 +192,12 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, } } } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -177,7 +215,7 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, } if localVarHTTPResponse.StatusCode == 200 { var v map[string]int32 - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -187,7 +225,7 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -198,15 +236,33 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, return localVarReturnValue, localVarHTTPResponse, nil } +type apiGetOrderByIdRequest struct { + ctx _context.Context + apiService *StoreApiService + orderId int64 +} + /* GetOrderById Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions +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 apiGetOrderByIdRequest +*/ +func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) apiGetOrderByIdRequest { + return apiGetOrderByIdRequest{ + apiService: a, + ctx: ctx, + orderId: orderId, + } +} + +/* +Execute executes the request + @return Order */ -func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Order, *_nethttp.Response, error) { +func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -216,21 +272,22 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord localVarReturnValue Order ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.GetOrderById") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetOrderById") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/store/order/{order_id}" - localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(r.orderId, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if orderId < 1 { + + if r.orderId < 1 { return localVarReturnValue, nil, reportError("orderId must be greater than 1") } - if orderId > 5 { + if r.orderId > 5 { return localVarReturnValue, nil, reportError("orderId must be less than 5") } @@ -251,12 +308,12 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -274,7 +331,7 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord } if localVarHTTPResponse.StatusCode == 200 { var v Order - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -285,7 +342,7 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -296,14 +353,35 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord return localVarReturnValue, localVarHTTPResponse, nil } +type apiPlaceOrderRequest struct { + ctx _context.Context + apiService *StoreApiService + order *Order +} + + +func (r apiPlaceOrderRequest) Order(order Order) apiPlaceOrderRequest { + r.order = &order + return r +} /* PlaceOrder Place an order for a pet * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param order order placed for purchasing the pet -@return Order +@return apiPlaceOrderRequest +*/ +func (a *StoreApiService) PlaceOrder(ctx _context.Context) apiPlaceOrderRequest { + return apiPlaceOrderRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return Order */ -func (a *StoreApiService) PlaceOrder(ctx _context.Context, order Order) (Order, *_nethttp.Response, error) { +func (r apiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -313,7 +391,7 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, order Order) (Order, localVarReturnValue Order ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.PlaceOrder") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.PlaceOrder") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -323,6 +401,10 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, order Order) (Order, localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.order == nil { + return localVarReturnValue, nil, reportError("order is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -342,13 +424,13 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, order Order) (Order, localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &order - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.order + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -366,7 +448,7 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, order Order) (Order, } if localVarHTTPResponse.StatusCode == 200 { var v Order - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -377,7 +459,7 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, order Order) (Order, return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api_user.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/api_user.go index 3d3d76f52a92..318759017aab 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,22 +25,46 @@ var ( // UserApiService UserApi service type UserApiService service +type apiCreateUserRequest struct { + ctx _context.Context + apiService *UserApiService + user *User +} + + +func (r apiCreateUserRequest) User(user User) apiCreateUserRequest { + r.user = &user + return r +} + /* CreateUser Create user This can only be done by the logged in user. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param user Created user object +@return apiCreateUserRequest +*/ +func (a *UserApiService) CreateUser(ctx _context.Context) apiCreateUserRequest { + return apiCreateUserRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *UserApiService) CreateUser(ctx _context.Context, user User) (*_nethttp.Response, error) { +func (r apiCreateUserRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.CreateUser") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -50,6 +74,10 @@ func (a *UserApiService) CreateUser(ctx _context.Context, user User) (*_nethttp. localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.user == nil { + return nil, reportError("user is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -69,13 +97,13 @@ func (a *UserApiService) CreateUser(ctx _context.Context, user User) (*_nethttp. localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &user - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.user + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -96,22 +124,45 @@ func (a *UserApiService) CreateUser(ctx _context.Context, user User) (*_nethttp. return localVarHTTPResponse, nil } +type apiCreateUsersWithArrayInputRequest struct { + ctx _context.Context + apiService *UserApiService + user *[]User +} + + +func (r apiCreateUsersWithArrayInputRequest) User(user []User) apiCreateUsersWithArrayInputRequest { + r.user = &user + return r +} /* CreateUsersWithArrayInput Creates list of users with given input array * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param user List of user object +@return apiCreateUsersWithArrayInputRequest */ -func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, user []User) (*_nethttp.Response, error) { +func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context) apiCreateUsersWithArrayInputRequest { + return apiCreateUsersWithArrayInputRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + +*/ +func (r apiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.CreateUsersWithArrayInput") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithArrayInput") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -121,6 +172,10 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, user [] localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.user == nil { + return nil, reportError("user is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -140,13 +195,13 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, user [] localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &user - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.user + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -167,22 +222,45 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, user [] return localVarHTTPResponse, nil } +type apiCreateUsersWithListInputRequest struct { + ctx _context.Context + apiService *UserApiService + user *[]User +} + + +func (r apiCreateUsersWithListInputRequest) User(user []User) apiCreateUsersWithListInputRequest { + r.user = &user + return r +} /* CreateUsersWithListInput Creates list of users with given input array * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param user List of user object +@return apiCreateUsersWithListInputRequest +*/ +func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context) apiCreateUsersWithListInputRequest { + return apiCreateUsersWithListInputRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, user []User) (*_nethttp.Response, error) { +func (r apiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.CreateUsersWithListInput") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithListInput") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -192,6 +270,10 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, user []U localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.user == nil { + return nil, reportError("user is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -211,13 +293,13 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, user []U localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &user - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.user + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -238,33 +320,54 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, user []U return localVarHTTPResponse, nil } +type apiDeleteUserRequest struct { + ctx _context.Context + apiService *UserApiService + username string +} + /* DeleteUser Delete user This can only be done by the logged in user. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param username The name that needs to be deleted +@return apiDeleteUserRequest */ -func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_nethttp.Response, error) { +func (a *UserApiService) DeleteUser(ctx _context.Context, username string) apiDeleteUserRequest { + return apiDeleteUserRequest{ + apiService: a, + ctx: ctx, + username: username, + } +} + +/* +Execute executes the request + +*/ +func (r apiDeleteUserRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.DeleteUser") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.DeleteUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(r.username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -283,12 +386,12 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -309,14 +412,32 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne return localVarHTTPResponse, nil } +type apiGetUserByNameRequest struct { + ctx _context.Context + apiService *UserApiService + username string +} + /* GetUserByName Get user by user name * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param username The name that needs to be fetched. Use user1 for testing. -@return User +@return apiGetUserByNameRequest +*/ +func (a *UserApiService) GetUserByName(ctx _context.Context, username string) apiGetUserByNameRequest { + return apiGetUserByNameRequest{ + apiService: a, + ctx: ctx, + username: username, + } +} + +/* +Execute executes the request + @return User */ -func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (User, *_nethttp.Response, error) { +func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -326,17 +447,18 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U localVarReturnValue User ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.GetUserByName") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.GetUserByName") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(r.username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -355,12 +477,12 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -378,7 +500,7 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U } if localVarHTTPResponse.StatusCode == 200 { var v User - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -389,7 +511,7 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -400,15 +522,41 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U return localVarReturnValue, localVarHTTPResponse, nil } +type apiLoginUserRequest struct { + ctx _context.Context + apiService *UserApiService + username *string + password *string +} + + +func (r apiLoginUserRequest) Username(username string) apiLoginUserRequest { + r.username = &username + return r +} + +func (r apiLoginUserRequest) Password(password string) apiLoginUserRequest { + r.password = &password + return r +} /* LoginUser Logs user into the system * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param username The user name for login - * @param password The password for login in clear text -@return string +@return apiLoginUserRequest +*/ +func (a *UserApiService) LoginUser(ctx _context.Context) apiLoginUserRequest { + return apiLoginUserRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + @return string */ -func (a *UserApiService) LoginUser(ctx _context.Context, username string, password string) (string, *_nethttp.Response, error) { +func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -418,7 +566,7 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo localVarReturnValue string ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.LoginUser") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LoginUser") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -428,9 +576,17 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + if r.username == nil { + return localVarReturnValue, nil, reportError("username is required and must be specified") + } + + if r.password == nil { + return localVarReturnValue, nil, reportError("password is required and must be specified") + } - localVarQueryParams.Add("username", parameterToString(username, "")) - localVarQueryParams.Add("password", parameterToString(password, "")) + localVarQueryParams.Add("username", parameterToString(*r.username, "")) + localVarQueryParams.Add("password", parameterToString(*r.password, "")) // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -448,12 +604,12 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } @@ -471,7 +627,7 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo } if localVarHTTPResponse.StatusCode == 200 { var v string - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr @@ -482,7 +638,7 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, @@ -493,21 +649,39 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo return localVarReturnValue, localVarHTTPResponse, nil } +type apiLogoutUserRequest struct { + ctx _context.Context + apiService *UserApiService +} + /* LogoutUser Logs out current logged in user session * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return apiLogoutUserRequest +*/ +func (a *UserApiService) LogoutUser(ctx _context.Context) apiLogoutUserRequest { + return apiLogoutUserRequest{ + apiService: a, + ctx: ctx, + } +} + +/* +Execute executes the request + */ -func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, error) { +func (r apiLogoutUserRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.LogoutUser") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LogoutUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -535,12 +709,12 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } @@ -561,34 +735,64 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e return localVarHTTPResponse, nil } +type apiUpdateUserRequest struct { + ctx _context.Context + apiService *UserApiService + username string + user *User +} + + +func (r apiUpdateUserRequest) User(user User) apiUpdateUserRequest { + r.user = &user + return r +} /* UpdateUser Updated user This can only be done by the logged in user. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param username name that need to be deleted - * @param user Updated user object +@return apiUpdateUserRequest +*/ +func (a *UserApiService) UpdateUser(ctx _context.Context, username string) apiUpdateUserRequest { + return apiUpdateUserRequest{ + apiService: a, + ctx: ctx, + username: username, + } +} + +/* +Execute executes the request + */ -func (a *UserApiService) UpdateUser(ctx _context.Context, username string, user User) (*_nethttp.Response, error) { +func (r apiUpdateUserRequest) Execute() (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + ) - localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.UpdateUser") + localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.UpdateUser") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/user/{username}" - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(r.username, "")) , -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + + + if r.user == nil { + return nil, reportError("user is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -608,13 +812,13 @@ func (a *UserApiService) UpdateUser(ctx _context.Context, username string, user localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = &user - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + localVarPostBody = r.user + req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } - localVarHTTPResponse, err := a.client.callAPI(r) + localVarHTTPResponse, err := r.apiService.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md index fb674f202e19..c4e2c2863bff 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md @@ -10,19 +10,24 @@ Method | HTTP request | Description ## Call123TestSpecialTags -> Client Call123TestSpecialTags(ctx, client) +> Client Call123TestSpecialTags(ctx).Client(client).Execute() To test special tags -To test special tags and operation ID starting with number -### Required Parameters + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCall123TestSpecialTagsRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**client** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md) | client model | ### Return type diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/DefaultApi.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/DefaultApi.md index daf779c8e3e7..4dd83db2463b 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/DefaultApi.md @@ -10,14 +10,19 @@ Method | HTTP request | Description ## FooGet -> InlineResponseDefault FooGet(ctx, ) +> InlineResponseDefault FooGet(ctx).Execute() -### Required Parameters +### Path Parameters This endpoint does not need any parameter. +### Other Parameters + +Other parameters are passed through a pointer to a apiFooGetRequest struct via the builder pattern + + ### Return type [**InlineResponseDefault**](inline_response_default.md) diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeApi.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeApi.md index 3634a8771e29..ca236912338a 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeApi.md @@ -23,14 +23,19 @@ Method | HTTP request | Description ## FakeHealthGet -> HealthCheckResult FakeHealthGet(ctx, ) +> HealthCheckResult FakeHealthGet(ctx).Execute() Health check endpoint -### Required Parameters +### Path Parameters This endpoint does not need any parameter. +### Other Parameters + +Other parameters are passed through a pointer to a apiFakeHealthGetRequest struct via the builder pattern + + ### Return type [**HealthCheckResult**](HealthCheckResult.md) @@ -51,28 +56,24 @@ No authorization required ## FakeOuterBooleanSerialize -> bool FakeOuterBooleanSerialize(ctx, optional) +> bool FakeOuterBooleanSerialize(ctx).Body(body).Execute() -Test serialization of outer boolean types -### Required Parameters + +### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **optional** | ***FakeOuterBooleanSerializeOpts** | optional parameters | nil if no parameters -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a FakeOuterBooleanSerializeOpts struct +Other parameters are passed through a pointer to a apiFakeOuterBooleanSerializeRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **optional.Bool**| Input boolean as post body | + **body** | **bool** | Input boolean as post body | ### Return type @@ -94,28 +95,24 @@ No authorization required ## FakeOuterCompositeSerialize -> OuterComposite FakeOuterCompositeSerialize(ctx, optional) +> OuterComposite FakeOuterCompositeSerialize(ctx).OuterComposite(outerComposite).Execute() -Test serialization of object with outer number type -### Required Parameters +### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **optional** | ***FakeOuterCompositeSerializeOpts** | optional parameters | nil if no parameters -### Optional Parameters -Optional parameters are passed through a pointer to a FakeOuterCompositeSerializeOpts struct +### Other Parameters + +Other parameters are passed through a pointer to a apiFakeOuterCompositeSerializeRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **outerComposite** | [**optional.Interface of OuterComposite**](OuterComposite.md)| Input composite as post body | + **outerComposite** | [**OuterComposite**](OuterComposite.md) | Input composite as post body | ### Return type @@ -137,28 +134,24 @@ No authorization required ## FakeOuterNumberSerialize -> float32 FakeOuterNumberSerialize(ctx, optional) +> float32 FakeOuterNumberSerialize(ctx).Body(body).Execute() -Test serialization of outer number types -### Required Parameters + +### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **optional** | ***FakeOuterNumberSerializeOpts** | optional parameters | nil if no parameters -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a FakeOuterNumberSerializeOpts struct +Other parameters are passed through a pointer to a apiFakeOuterNumberSerializeRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **optional.Float32**| Input number as post body | + **body** | **float32** | Input number as post body | ### Return type @@ -180,28 +173,24 @@ No authorization required ## FakeOuterStringSerialize -> string FakeOuterStringSerialize(ctx, optional) +> string FakeOuterStringSerialize(ctx).Body(body).Execute() -Test serialization of outer string types -### Required Parameters +### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **optional** | ***FakeOuterStringSerializeOpts** | optional parameters | nil if no parameters -### Optional Parameters -Optional parameters are passed through a pointer to a FakeOuterStringSerializeOpts struct +### Other Parameters + +Other parameters are passed through a pointer to a apiFakeOuterStringSerializeRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **optional.String**| Input string as post body | + **body** | **string** | Input string as post body | ### Return type @@ -223,19 +212,24 @@ No authorization required ## TestBodyWithFileSchema -> TestBodyWithFileSchema(ctx, fileSchemaTestClass) +> TestBodyWithFileSchema(ctx).FileSchemaTestClass(fileSchemaTestClass).Execute() + -For this test, the body for this request much reference a schema named `File`. -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestBodyWithFileSchemaRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md) | | ### Return type @@ -257,18 +251,23 @@ No authorization required ## TestBodyWithQueryParams -> TestBodyWithQueryParams(ctx, query, user) +> TestBodyWithQueryParams(ctx).Query(query).User(user).Execute() + + + +### Path Parameters + +### Other Parameters -### Required Parameters +Other parameters are passed through a pointer to a apiTestBodyWithQueryParamsRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**query** | **string**| | -**user** | [**User**](User.md)| | + **query** | **string** | | + **user** | [**User**](User.md) | | ### Return type @@ -290,19 +289,24 @@ No authorization required ## TestClientModel -> Client TestClientModel(ctx, client) +> Client TestClientModel(ctx).Client(client).Execute() To test \"client\" model -To test \"client\" model -### Required Parameters + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestClientModelRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**client** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md) | client model | ### Return type @@ -324,45 +328,37 @@ No authorization required ## TestEndpointParameters -> TestEndpointParameters(ctx, number, double, patternWithoutDelimiter, byte_, optional) +> TestEndpointParameters(ctx).Number(number).Double(double).PatternWithoutDelimiter(patternWithoutDelimiter).Byte_(byte_).Integer(integer).Int32_(int32_).Int64_(int64_).Float(float).String_(string_).Binary(binary).Date(date).DateTime(dateTime).Password(password).Callback(callback).Execute() Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -### Required Parameters +### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**number** | **float32**| None | -**double** | **float64**| None | -**patternWithoutDelimiter** | **string**| None | -**byte_** | **string**| None | - **optional** | ***TestEndpointParametersOpts** | optional parameters | nil if no parameters -### Optional Parameters -Optional parameters are passed through a pointer to a TestEndpointParametersOpts struct +### Other Parameters + +Other parameters are passed through a pointer to a apiTestEndpointParametersRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - - - - - **integer** | **optional.Int32**| None | - **int32_** | **optional.Int32**| None | - **int64_** | **optional.Int64**| None | - **float** | **optional.Float32**| None | - **string_** | **optional.String**| None | - **binary** | **optional.Interface of *os.File****optional.*os.File**| None | - **date** | **optional.String**| None | - **dateTime** | **optional.Time**| None | - **password** | **optional.String**| None | - **callback** | **optional.String**| None | + **number** | **float32** | None | + **double** | **float64** | None | + **patternWithoutDelimiter** | **string** | None | + **byte_** | **string** | None | + **integer** | **int32** | None | + **int32_** | **int32** | None | + **int64_** | **int64** | None | + **float** | **float32** | None | + **string_** | **string** | None | + **binary** | ***os.File** | None | + **date** | **string** | None | + **dateTime** | **time.Time** | None | + **password** | **string** | None | + **callback** | **string** | None | ### Return type @@ -384,35 +380,31 @@ Name | Type | Description | Notes ## TestEnumParameters -> TestEnumParameters(ctx, optional) +> TestEnumParameters(ctx).EnumHeaderStringArray(enumHeaderStringArray).EnumHeaderString(enumHeaderString).EnumQueryStringArray(enumQueryStringArray).EnumQueryString(enumQueryString).EnumQueryInteger(enumQueryInteger).EnumQueryDouble(enumQueryDouble).EnumFormStringArray(enumFormStringArray).EnumFormString(enumFormString).Execute() To test enum parameters -To test enum parameters -### Required Parameters +### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **optional** | ***TestEnumParametersOpts** | optional parameters | nil if no parameters -### Optional Parameters -Optional parameters are passed through a pointer to a TestEnumParametersOpts struct +### Other Parameters + +Other parameters are passed through a pointer to a apiTestEnumParametersRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **enumHeaderStringArray** | [**optional.Interface of []string**](string.md)| Header parameter enum test (string array) | - **enumHeaderString** | **optional.String**| Header parameter enum test (string) | [default to -efg] - **enumQueryStringArray** | [**optional.Interface of []string**](string.md)| Query parameter enum test (string array) | - **enumQueryString** | **optional.String**| Query parameter enum test (string) | [default to -efg] - **enumQueryInteger** | **optional.Int32**| Query parameter enum test (double) | - **enumQueryDouble** | **optional.Float64**| Query parameter enum test (double) | - **enumFormStringArray** | [**optional.Interface of []string**](string.md)| Form parameter enum test (string array) | [default to $] - **enumFormString** | **optional.String**| Form parameter enum test (string) | [default to -efg] + **enumHeaderStringArray** | [**[]string**](string.md) | Header parameter enum test (string array) | + **enumHeaderString** | **string** | Header parameter enum test (string) | [default to -efg] + **enumQueryStringArray** | [**[]string**](string.md) | Query parameter enum test (string array) | + **enumQueryString** | **string** | Query parameter enum test (string) | [default to -efg] + **enumQueryInteger** | **int32** | Query parameter enum test (double) | + **enumQueryDouble** | **float64** | Query parameter enum test (double) | + **enumFormStringArray** | [**[]string**](string.md) | Form parameter enum test (string array) | [default to $] + **enumFormString** | **string** | Form parameter enum test (string) | [default to -efg] ### Return type @@ -434,36 +426,29 @@ No authorization required ## TestGroupParameters -> TestGroupParameters(ctx, requiredStringGroup, requiredBooleanGroup, requiredInt64Group, optional) +> TestGroupParameters(ctx).RequiredStringGroup(requiredStringGroup).RequiredBooleanGroup(requiredBooleanGroup).RequiredInt64Group(requiredInt64Group).StringGroup(stringGroup).BooleanGroup(booleanGroup).Int64Group(int64Group).Execute() Fake endpoint to test group parameters (optional) -Fake endpoint to test group parameters (optional) -### Required Parameters +### Path Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**requiredStringGroup** | **int32**| Required String in group parameters | -**requiredBooleanGroup** | **bool**| Required Boolean in group parameters | -**requiredInt64Group** | **int64**| Required Integer in group parameters | - **optional** | ***TestGroupParametersOpts** | optional parameters | nil if no parameters -### Optional Parameters -Optional parameters are passed through a pointer to a TestGroupParametersOpts struct +### Other Parameters + +Other parameters are passed through a pointer to a apiTestGroupParametersRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - - - - **stringGroup** | **optional.Int32**| String in group parameters | - **booleanGroup** | **optional.Bool**| Boolean in group parameters | - **int64Group** | **optional.Int64**| Integer in group parameters | + **requiredStringGroup** | **int32** | Required String in group parameters | + **requiredBooleanGroup** | **bool** | Required Boolean in group parameters | + **requiredInt64Group** | **int64** | Required Integer in group parameters | + **stringGroup** | **int32** | String in group parameters | + **booleanGroup** | **bool** | Boolean in group parameters | + **int64Group** | **int64** | Integer in group parameters | ### Return type @@ -485,17 +470,22 @@ Name | Type | Description | Notes ## TestInlineAdditionalProperties -> TestInlineAdditionalProperties(ctx, requestBody) +> TestInlineAdditionalProperties(ctx).RequestBody(requestBody).Execute() test inline additionalProperties -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestInlineAdditionalPropertiesRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**requestBody** | [**map[string]string**](string.md)| request body | + **requestBody** | [**map[string]string**](string.md) | request body | ### Return type @@ -517,18 +507,23 @@ No authorization required ## TestJsonFormData -> TestJsonFormData(ctx, param, param2) +> TestJsonFormData(ctx).Param(param).Param2(param2).Execute() test json serialization of form data -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestJsonFormDataRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**param** | **string**| field1 | -**param2** | **string**| field2 | + **param** | **string** | field1 | + **param2** | **string** | field2 | ### Return type @@ -550,23 +545,28 @@ No authorization required ## TestQueryParameterCollectionFormat -> TestQueryParameterCollectionFormat(ctx, pipe, ioutil, http, url, context) +> TestQueryParameterCollectionFormat(ctx).Pipe(pipe).Ioutil(ioutil).Http(http).Url(url).Context(context).Execute() + + + + + +### Path Parameters -To test the collection format in query parameters +### Other Parameters -### Required Parameters +Other parameters are passed through a pointer to a apiTestQueryParameterCollectionFormatRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**pipe** | [**[]string**](string.md)| | -**ioutil** | [**[]string**](string.md)| | -**http** | [**[]string**](string.md)| | -**url** | [**[]string**](string.md)| | -**context** | [**[]string**](string.md)| | + **pipe** | [**[]string**](string.md) | | + **ioutil** | [**[]string**](string.md) | | + **http** | [**[]string**](string.md) | | + **url** | [**[]string**](string.md) | | + **context** | [**[]string**](string.md) | | ### Return type diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md index b070326cc328..4a1ce5a56fa6 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md @@ -10,19 +10,24 @@ Method | HTTP request | Description ## TestClassname -> Client TestClassname(ctx, client) +> Client TestClassname(ctx).Client(client).Execute() To test class name in snake case -To test class name in snake case -### Required Parameters + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestClassnameRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**client** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md) | client model | ### Return type diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/PetApi.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/PetApi.md index 8118df7009bc..a3c4f9457760 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/PetApi.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/PetApi.md @@ -18,17 +18,22 @@ Method | HTTP request | Description ## AddPet -> AddPet(ctx, pet) +> AddPet(ctx).Pet(pet).Execute() Add a new pet to the store -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiAddPetRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | ### Return type @@ -50,28 +55,27 @@ Name | Type | Description | Notes ## DeletePet -> DeletePet(ctx, petId, optional) +> DeletePet(ctx, petId).ApiKey(apiKey).Execute() Deletes a pet -### Required Parameters +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**petId** | **int64**| Pet id to delete | - **optional** | ***DeletePetOpts** | optional parameters | nil if no parameters +**petId** | **int64** | Pet id to delete | -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a DeletePetOpts struct +Other parameters are passed through a pointer to a apiDeletePetRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **apiKey** | **optional.String**| | + **apiKey** | **string** | | ### Return type @@ -93,19 +97,24 @@ Name | Type | Description | Notes ## FindPetsByStatus -> []Pet FindPetsByStatus(ctx, status) +> []Pet FindPetsByStatus(ctx).Status(status).Execute() Finds Pets by status -Multiple status values can be provided with comma separated strings -### Required Parameters + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFindPetsByStatusRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**status** | [**[]string**](string.md)| Status values that need to be considered for filter | + **status** | [**[]string**](string.md) | Status values that need to be considered for filter | ### Return type @@ -127,19 +136,24 @@ Name | Type | Description | Notes ## FindPetsByTags -> []Pet FindPetsByTags(ctx, tags) +> []Pet FindPetsByTags(ctx).Tags(tags).Execute() Finds Pets by tags -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. -### Required Parameters + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiFindPetsByTagsRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**tags** | [**[]string**](string.md)| Tags to filter by | + **tags** | [**[]string**](string.md) | Tags to filter by | ### Return type @@ -161,19 +175,28 @@ Name | Type | Description | Notes ## GetPetById -> Pet GetPetById(ctx, petId) +> Pet GetPetById(ctx, petId).Execute() Find pet by ID -Returns a single pet -### Required Parameters + +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**petId** | **int64**| ID of pet to return | +**petId** | **int64** | ID of pet to return | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetPetByIdRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + ### Return type @@ -195,17 +218,22 @@ Name | Type | Description | Notes ## UpdatePet -> UpdatePet(ctx, pet) +> UpdatePet(ctx).Pet(pet).Execute() Update an existing pet -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdatePetRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | ### Return type @@ -227,29 +255,28 @@ Name | Type | Description | Notes ## UpdatePetWithForm -> UpdatePetWithForm(ctx, petId, optional) +> UpdatePetWithForm(ctx, petId).Name(name).Status(status).Execute() Updates a pet in the store with form data -### Required Parameters +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**petId** | **int64**| ID of pet that needs to be updated | - **optional** | ***UpdatePetWithFormOpts** | optional parameters | nil if no parameters +**petId** | **int64** | ID of pet that needs to be updated | -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a UpdatePetWithFormOpts struct +Other parameters are passed through a pointer to a apiUpdatePetWithFormRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **name** | **optional.String**| Updated name of the pet | - **status** | **optional.String**| Updated status of the pet | + **name** | **string** | Updated name of the pet | + **status** | **string** | Updated status of the pet | ### Return type @@ -271,29 +298,28 @@ Name | Type | Description | Notes ## UploadFile -> ApiResponse UploadFile(ctx, petId, optional) +> ApiResponse UploadFile(ctx, petId).AdditionalMetadata(additionalMetadata).File(file).Execute() uploads an image -### Required Parameters +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**petId** | **int64**| ID of pet to update | - **optional** | ***UploadFileOpts** | optional parameters | nil if no parameters +**petId** | **int64** | ID of pet to update | -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a UploadFileOpts struct +Other parameters are passed through a pointer to a apiUploadFileRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **additionalMetadata** | **optional.String**| Additional data to pass to server | - **file** | **optional.Interface of *os.File****optional.*os.File**| file to upload | + **additionalMetadata** | **string** | Additional data to pass to server | + **file** | ***os.File** | file to upload | ### Return type @@ -315,30 +341,28 @@ Name | Type | Description | Notes ## UploadFileWithRequiredFile -> ApiResponse UploadFileWithRequiredFile(ctx, petId, requiredFile, optional) +> ApiResponse UploadFileWithRequiredFile(ctx, petId).RequiredFile(requiredFile).AdditionalMetadata(additionalMetadata).Execute() uploads an image (required) -### Required Parameters +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**petId** | **int64**| ID of pet to update | -**requiredFile** | ***os.File*****os.File**| file to upload | - **optional** | ***UploadFileWithRequiredFileOpts** | optional parameters | nil if no parameters +**petId** | **int64** | ID of pet to update | -### Optional Parameters +### Other Parameters -Optional parameters are passed through a pointer to a UploadFileWithRequiredFileOpts struct +Other parameters are passed through a pointer to a apiUploadFileWithRequiredFileRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - - **additionalMetadata** | **optional.String**| Additional data to pass to server | + **requiredFile** | ***os.File** | file to upload | + **additionalMetadata** | **string** | Additional data to pass to server | ### Return type diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/StoreApi.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/StoreApi.md index c24d87bbfd68..d3ec7e487392 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/StoreApi.md @@ -13,19 +13,28 @@ Method | HTTP request | Description ## DeleteOrder -> DeleteOrder(ctx, orderId) +> DeleteOrder(ctx, orderId).Execute() Delete purchase order by ID -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors -### Required Parameters + +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**orderId** | **string**| ID of the order that needs to be deleted | +**orderId** | **string** | ID of the order that needs to be deleted | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteOrderRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + ### Return type @@ -47,16 +56,21 @@ No authorization required ## GetInventory -> map[string]int32 GetInventory(ctx, ) +> map[string]int32 GetInventory(ctx).Execute() Returns pet inventories by status -Returns a map of status codes to quantities -### Required Parameters + +### Path Parameters This endpoint does not need any parameter. +### Other Parameters + +Other parameters are passed through a pointer to a apiGetInventoryRequest struct via the builder pattern + + ### Return type **map[string]int32** @@ -77,19 +91,28 @@ This endpoint does not need any parameter. ## GetOrderById -> Order GetOrderById(ctx, orderId) +> Order GetOrderById(ctx, orderId).Execute() Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions -### Required Parameters + +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**orderId** | **int64**| ID of pet that needs to be fetched | +**orderId** | **int64** | ID of pet that needs to be fetched | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetOrderByIdRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + ### Return type @@ -111,17 +134,22 @@ No authorization required ## PlaceOrder -> Order PlaceOrder(ctx, order) +> Order PlaceOrder(ctx).Order(order).Execute() Place an order for a pet -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiPlaceOrderRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**order** | [**Order**](Order.md)| order placed for purchasing the pet | + **order** | [**Order**](Order.md) | order placed for purchasing the pet | ### Return type diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/UserApi.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/UserApi.md index 01d05d555cf2..af86ff9b85ac 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/UserApi.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/UserApi.md @@ -17,19 +17,24 @@ Method | HTTP request | Description ## CreateUser -> CreateUser(ctx, user) +> CreateUser(ctx).User(user).Execute() Create user -This can only be done by the logged in user. -### Required Parameters + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUserRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**user** | [**User**](User.md)| Created user object | + **user** | [**User**](User.md) | Created user object | ### Return type @@ -51,17 +56,22 @@ No authorization required ## CreateUsersWithArrayInput -> CreateUsersWithArrayInput(ctx, user) +> CreateUsersWithArrayInput(ctx).User(user).Execute() Creates list of users with given input array -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUsersWithArrayInputRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**user** | [**[]User**](User.md)| List of user object | + **user** | [**[]User**](User.md) | List of user object | ### Return type @@ -83,17 +93,22 @@ No authorization required ## CreateUsersWithListInput -> CreateUsersWithListInput(ctx, user) +> CreateUsersWithListInput(ctx).User(user).Execute() Creates list of users with given input array -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateUsersWithListInputRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**user** | [**[]User**](User.md)| List of user object | + **user** | [**[]User**](User.md) | List of user object | ### Return type @@ -115,19 +130,28 @@ No authorization required ## DeleteUser -> DeleteUser(ctx, username) +> DeleteUser(ctx, username).Execute() Delete user -This can only be done by the logged in user. -### Required Parameters + +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**username** | **string**| The name that needs to be deleted | +**username** | **string** | The name that needs to be deleted | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + ### Return type @@ -149,17 +173,26 @@ No authorization required ## GetUserByName -> User GetUserByName(ctx, username) +> User GetUserByName(ctx, username).Execute() Get user by user name -### Required Parameters +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**username** | **string**| The name that needs to be fetched. Use user1 for testing. | +**username** | **string** | The name that needs to be fetched. Use user1 for testing. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserByNameRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + ### Return type @@ -181,18 +214,23 @@ No authorization required ## LoginUser -> string LoginUser(ctx, username, password) +> string LoginUser(ctx).Username(username).Password(password).Execute() Logs user into the system -### Required Parameters +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiLoginUserRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**username** | **string**| The user name for login | -**password** | **string**| The password for login in clear text | + **username** | **string** | The user name for login | + **password** | **string** | The password for login in clear text | ### Return type @@ -214,14 +252,19 @@ No authorization required ## LogoutUser -> LogoutUser(ctx, ) +> LogoutUser(ctx).Execute() Logs out current logged in user session -### Required Parameters +### Path Parameters This endpoint does not need any parameter. +### Other Parameters + +Other parameters are passed through a pointer to a apiLogoutUserRequest struct via the builder pattern + + ### Return type (empty response body) @@ -242,20 +285,29 @@ No authorization required ## UpdateUser -> UpdateUser(ctx, username, user) +> UpdateUser(ctx, username).User(user).Execute() Updated user -This can only be done by the logged in user. -### Required Parameters + +### Path Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**username** | **string**| name that need to be deleted | -**user** | [**User**](User.md)| Updated user object | +**username** | **string** | name that need to be deleted | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **user** | [**User**](User.md) | Updated user object | ### Return type