diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache index 852e70bd447b..6e540d3f8767 100644 --- a/modules/swagger-codegen/src/main/resources/go/api.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api.mustache @@ -37,7 +37,7 @@ func New{{classname}}WithBasePath(basePath string) *{{classname}}{ {{#allParams}} * @param {{paramName}} {{description}} {{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} */ -func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}ApiResponse, error) { +func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}APIResponse, error) { var httpMethod = "{{httpMethod}}" // create path and map variables @@ -49,7 +49,7 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{ {{#required}} // verify the required parameter '{{paramName}}' is set if &{{paramName}} == nil { - return {{#returnType}}*new({{{returnType}}}), {{/returnType}}*NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") + return {{#returnType}}*new({{{returnType}}}), {{/returnType}}*NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") } {{/required}} {{/allParams}} @@ -64,11 +64,11 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{ {{#authMethods}}// authentication ({{name}}) required {{#isApiKey}}{{#isKeyInHeader}} // set key with prefix in header - headerParams["{{keyParamName}}"] = a.Configuration.GetApiKeyWithPrefix("{{keyParamName}}") + headerParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}") {{/isKeyInHeader}}{{#isKeyInQuery}} // set key with prefix in querystring {{#hasKeyParamName}} - queryParams["{{keyParamName}}"] = a.Configuration.GetApiKeyWithPrefix("{{keyParamName}}") + queryParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}") {{/hasKeyParamName}} {{/isKeyInQuery}}{{/isApiKey}} {{#isBasic}} @@ -92,7 +92,7 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{ {{#hasQueryParams}} {{#queryParams}} - queryParams["{{paramName}}"] = a.Configuration.ApiClient.ParameterToString({{paramName}}) + queryParams["{{paramName}}"] = a.Configuration.APIClient.ParameterToString({{paramName}}) {{/queryParams}} {{/hasQueryParams}} @@ -103,7 +103,7 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{ {{/consumes}} } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -114,7 +114,7 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{ {{/produces}} } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } @@ -134,18 +134,18 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{ postBody = &{{paramName}} {{/bodyParams}}{{/hasBodyParam}} {{#returnType}} var successPayload = new({{returnType}}){{/returnType}} - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return {{#returnType}}*successPayload, {{/returnType}}*NewApiResponse(httpResponse.RawResponse), err + return {{#returnType}}*successPayload, {{/returnType}}*NewAPIResponse(httpResponse.RawResponse), err } {{#returnType}} err = json.Unmarshal(httpResponse.Body(), &successPayload) {{/returnType}} - return {{#returnType}}*successPayload, {{/returnType}}*NewApiResponse(httpResponse.RawResponse), err + return {{#returnType}}*successPayload, {{/returnType}}*NewAPIResponse(httpResponse.RawResponse), err } {{/operation}} {{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/go/api_client.mustache b/modules/swagger-codegen/src/main/resources/go/api_client.mustache index 91a845517002..a88445656d77 100644 --- a/modules/swagger-codegen/src/main/resources/go/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api_client.mustache @@ -3,17 +3,17 @@ package {{packageName}} import ( "strings" "github.com/go-resty/resty" - "errors" + "fmt" "reflect" "bytes" "path/filepath" ) -type ApiClient struct { +type APIClient struct { } -func (c *ApiClient) SelectHeaderContentType(contentTypes []string) string { +func (c *APIClient) SelectHeaderContentType(contentTypes []string) string { if (len(contentTypes) == 0){ return "" } @@ -24,7 +24,7 @@ func (c *ApiClient) SelectHeaderContentType(contentTypes []string) string { return contentTypes[0] // use the first content type specified in 'consumes' } -func (c *ApiClient) SelectHeaderAccept(accepts []string) string { +func (c *APIClient) SelectHeaderAccept(accepts []string) string { if (len(accepts) == 0){ return "" } @@ -46,7 +46,7 @@ func contains(source []string, containvalue string) bool { } -func (c *ApiClient) CallApi(path string, method string, +func (c *APIClient) CallAPI(path string, method string, postBody interface{}, headerParams map[string]string, queryParams map[string]string, @@ -78,10 +78,10 @@ func (c *ApiClient) CallApi(path string, method string, return response, err } - return nil, errors.New("Invalid method " + method) + return nil, fmt.Errorf("invalid method %v", method) } -func (c *ApiClient) ParameterToString(obj interface{}) string { +func (c *APIClient) ParameterToString(obj interface{}) string { if reflect.TypeOf(obj).String() == "[]string" { return strings.Join(obj.([]string), ",") } else { diff --git a/modules/swagger-codegen/src/main/resources/go/api_response.mustache b/modules/swagger-codegen/src/main/resources/go/api_response.mustache index b9110bd9eda6..2a34a8cf35ac 100644 --- a/modules/swagger-codegen/src/main/resources/go/api_response.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api_response.mustache @@ -5,20 +5,20 @@ import ( ) -type ApiResponse struct { +type APIResponse struct { *http.Response Message string `json:"message,omitempty"` } -func NewApiResponse(r *http.Response) *ApiResponse { - response := &ApiResponse{Response: r} +func NewAPIResponse(r *http.Response) *APIResponse { + response := &APIResponse{Response: r} return response } -func NewApiResponseWithError(errorMessage string) *ApiResponse { - response := &ApiResponse{Message: errorMessage} +func NewAPIResponseWithError(errorMessage string) *APIResponse { + response := &APIResponse{Message: errorMessage} return response } \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/go/configuration.mustache b/modules/swagger-codegen/src/main/resources/go/configuration.mustache index e5f05a63c12f..d971bf0373b7 100644 --- a/modules/swagger-codegen/src/main/resources/go/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/go/configuration.mustache @@ -7,8 +7,8 @@ import ( type Configuration struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` - ApiKeyPrefix map[string] string `json:"apiKeyPrefix,omitempty"` - ApiKey map[string] string `json:"apiKey,omitempty"` + APIKeyPrefix map[string] string `json:"APIKeyPrefix,omitempty"` + APIKey map[string] string `json:"APIKey,omitempty"` debug bool `json:"debug,omitempty"` DebugFile string `json:"debugFile,omitempty"` OAuthToken string `json:"oAuthToken,omitempty"` @@ -19,7 +19,7 @@ type Configuration struct { AccessToken string `json:"accessToken,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` - ApiClient ApiClient `json:"apiClient,omitempty"` + APIClient APIClient `json:"APIClient,omitempty"` } func NewConfiguration() *Configuration { @@ -28,8 +28,8 @@ func NewConfiguration() *Configuration { UserName: "", debug: false, DefaultHeader: make(map[string]string), - ApiKey: make(map[string]string), - ApiKeyPrefix: make(map[string]string), + APIKey: make(map[string]string), + APIKeyPrefix: make(map[string]string), UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{packageVersion}}}/go{{/httpUserAgent}}", } } @@ -42,12 +42,12 @@ func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } -func (c *Configuration) GetApiKeyWithPrefix(apiKeyIdentifier string) string { - if c.ApiKeyPrefix[apiKeyIdentifier] != ""{ - return c.ApiKeyPrefix[apiKeyIdentifier] + " " + c.ApiKey[apiKeyIdentifier] +func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string { + if c.APIKeyPrefix[APIKeyIdentifier] != ""{ + return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier] } - return c.ApiKey[apiKeyIdentifier] + return c.APIKey[APIKeyIdentifier] } func (c *Configuration) SetDebug(enable bool){ diff --git a/samples/client/petstore/go/go-petstore/api_client.go b/samples/client/petstore/go/go-petstore/api_client.go index 1c04e52fdc47..d4b53512c68c 100644 --- a/samples/client/petstore/go/go-petstore/api_client.go +++ b/samples/client/petstore/go/go-petstore/api_client.go @@ -3,17 +3,17 @@ package swagger import ( "strings" "github.com/go-resty/resty" - "errors" + "fmt" "reflect" "bytes" "path/filepath" ) -type ApiClient struct { +type APIClient struct { } -func (c *ApiClient) SelectHeaderContentType(contentTypes []string) string { +func (c *APIClient) SelectHeaderContentType(contentTypes []string) string { if (len(contentTypes) == 0){ return "" } @@ -24,7 +24,7 @@ func (c *ApiClient) SelectHeaderContentType(contentTypes []string) string { return contentTypes[0] // use the first content type specified in 'consumes' } -func (c *ApiClient) SelectHeaderAccept(accepts []string) string { +func (c *APIClient) SelectHeaderAccept(accepts []string) string { if (len(accepts) == 0){ return "" } @@ -46,7 +46,7 @@ func contains(source []string, containvalue string) bool { } -func (c *ApiClient) CallApi(path string, method string, +func (c *APIClient) CallAPI(path string, method string, postBody interface{}, headerParams map[string]string, queryParams map[string]string, @@ -78,10 +78,10 @@ func (c *ApiClient) CallApi(path string, method string, return response, err } - return nil, errors.New("Invalid method " + method) + return nil, fmt.Errorf("invalid method %v", method) } -func (c *ApiClient) ParameterToString(obj interface{}) string { +func (c *APIClient) ParameterToString(obj interface{}) string { if reflect.TypeOf(obj).String() == "[]string" { return strings.Join(obj.([]string), ",") } else { diff --git a/samples/client/petstore/go/go-petstore/api_response.go b/samples/client/petstore/go/go-petstore/api_response.go index b9110bd9eda6..2a34a8cf35ac 100644 --- a/samples/client/petstore/go/go-petstore/api_response.go +++ b/samples/client/petstore/go/go-petstore/api_response.go @@ -5,20 +5,20 @@ import ( ) -type ApiResponse struct { +type APIResponse struct { *http.Response Message string `json:"message,omitempty"` } -func NewApiResponse(r *http.Response) *ApiResponse { - response := &ApiResponse{Response: r} +func NewAPIResponse(r *http.Response) *APIResponse { + response := &APIResponse{Response: r} return response } -func NewApiResponseWithError(errorMessage string) *ApiResponse { - response := &ApiResponse{Message: errorMessage} +func NewAPIResponseWithError(errorMessage string) *APIResponse { + response := &APIResponse{Message: errorMessage} return response } \ No newline at end of file diff --git a/samples/client/petstore/go/go-petstore/configuration.go b/samples/client/petstore/go/go-petstore/configuration.go index 3fe94d36c265..2a1b4096399b 100644 --- a/samples/client/petstore/go/go-petstore/configuration.go +++ b/samples/client/petstore/go/go-petstore/configuration.go @@ -7,8 +7,8 @@ import ( type Configuration struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` - ApiKeyPrefix map[string] string `json:"apiKeyPrefix,omitempty"` - ApiKey map[string] string `json:"apiKey,omitempty"` + APIKeyPrefix map[string] string `json:"APIKeyPrefix,omitempty"` + APIKey map[string] string `json:"APIKey,omitempty"` debug bool `json:"debug,omitempty"` DebugFile string `json:"debugFile,omitempty"` OAuthToken string `json:"oAuthToken,omitempty"` @@ -19,7 +19,7 @@ type Configuration struct { AccessToken string `json:"accessToken,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` - ApiClient ApiClient `json:"apiClient,omitempty"` + APIClient APIClient `json:"APIClient,omitempty"` } func NewConfiguration() *Configuration { @@ -28,8 +28,8 @@ func NewConfiguration() *Configuration { UserName: "", debug: false, DefaultHeader: make(map[string]string), - ApiKey: make(map[string]string), - ApiKeyPrefix: make(map[string]string), + APIKey: make(map[string]string), + APIKeyPrefix: make(map[string]string), UserAgent: "Swagger-Codegen/1.0.0/go", } } @@ -42,12 +42,12 @@ func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } -func (c *Configuration) GetApiKeyWithPrefix(apiKeyIdentifier string) string { - if c.ApiKeyPrefix[apiKeyIdentifier] != ""{ - return c.ApiKeyPrefix[apiKeyIdentifier] + " " + c.ApiKey[apiKeyIdentifier] +func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string { + if c.APIKeyPrefix[APIKeyIdentifier] != ""{ + return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier] } - return c.ApiKey[apiKeyIdentifier] + return c.APIKey[APIKeyIdentifier] } func (c *Configuration) SetDebug(enable bool){ diff --git a/samples/client/petstore/go/go-petstore/pet_api.go b/samples/client/petstore/go/go-petstore/pet_api.go index e9ebdf44de4e..423e8a795a72 100644 --- a/samples/client/petstore/go/go-petstore/pet_api.go +++ b/samples/client/petstore/go/go-petstore/pet_api.go @@ -35,7 +35,7 @@ func NewPetApiWithBasePath(basePath string) *PetApi{ * @param body Pet object that needs to be added to the store * @return void */ -func (a PetApi) AddPet (body Pet) (ApiResponse, error) { +func (a PetApi) AddPet (body Pet) (APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -43,7 +43,7 @@ func (a PetApi) AddPet (body Pet) (ApiResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->AddPet") + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->AddPet") } headerParams := make(map[string]string) @@ -72,7 +72,7 @@ func (a PetApi) AddPet (body Pet) (ApiResponse, error) { "application/xml", } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -82,7 +82,7 @@ func (a PetApi) AddPet (body Pet) (ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } @@ -91,14 +91,14 @@ func (a PetApi) AddPet (body Pet) (ApiResponse, error) { postBody = &body - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } /** * Deletes a pet @@ -107,7 +107,7 @@ func (a PetApi) AddPet (body Pet) (ApiResponse, error) { * @param apiKey * @return void */ -func (a PetApi) DeletePet (petId int64, apiKey string) (ApiResponse, error) { +func (a PetApi) DeletePet (petId int64, apiKey string) (APIResponse, error) { var httpMethod = "Delete" // create path and map variables @@ -116,7 +116,7 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (ApiResponse, error) { // verify the required parameter 'petId' is set if &petId == nil { - return *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->DeletePet") + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->DeletePet") } headerParams := make(map[string]string) @@ -143,7 +143,7 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (ApiResponse, error) { localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -153,7 +153,7 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } @@ -162,14 +162,14 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (ApiResponse, error) { - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } /** * Finds Pets by status @@ -177,7 +177,7 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (ApiResponse, error) { * @param status Status values that need to be considered for filter * @return []Pet */ -func (a PetApi) FindPetsByStatus (status []string) ([]Pet, ApiResponse, error) { +func (a PetApi) FindPetsByStatus (status []string) ([]Pet, APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -185,7 +185,7 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, ApiResponse, error) { // verify the required parameter 'status' is set if &status == nil { - return *new([]Pet), *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus") + return *new([]Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus") } headerParams := make(map[string]string) @@ -207,13 +207,13 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, ApiResponse, error) { headerParams[key] = a.Configuration.DefaultHeader[key] } - queryParams["status"] = a.Configuration.ApiClient.ParameterToString(status) + queryParams["status"] = a.Configuration.APIClient.ParameterToString(status) // to determine the Content-Type header localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -223,23 +223,23 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } var successPayload = new([]Pet) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } /** * Finds Pets by tags @@ -247,7 +247,7 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, ApiResponse, error) { * @param tags Tags to filter by * @return []Pet */ -func (a PetApi) FindPetsByTags (tags []string) ([]Pet, ApiResponse, error) { +func (a PetApi) FindPetsByTags (tags []string) ([]Pet, APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -255,7 +255,7 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, ApiResponse, error) { // verify the required parameter 'tags' is set if &tags == nil { - return *new([]Pet), *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags") + return *new([]Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags") } headerParams := make(map[string]string) @@ -277,13 +277,13 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, ApiResponse, error) { headerParams[key] = a.Configuration.DefaultHeader[key] } - queryParams["tags"] = a.Configuration.ApiClient.ParameterToString(tags) + queryParams["tags"] = a.Configuration.APIClient.ParameterToString(tags) // to determine the Content-Type header localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -293,23 +293,23 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } var successPayload = new([]Pet) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } /** * Find pet by ID @@ -317,7 +317,7 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, ApiResponse, error) { * @param petId ID of pet to return * @return Pet */ -func (a PetApi) GetPetById (petId int64) (Pet, ApiResponse, error) { +func (a PetApi) GetPetById (petId int64) (Pet, APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -326,7 +326,7 @@ func (a PetApi) GetPetById (petId int64) (Pet, ApiResponse, error) { // verify the required parameter 'petId' is set if &petId == nil { - return *new(Pet), *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById") + return *new(Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById") } headerParams := make(map[string]string) @@ -339,7 +339,7 @@ func (a PetApi) GetPetById (petId int64) (Pet, ApiResponse, error) { // authentication (api_key) required // set key with prefix in header - headerParams["api_key"] = a.Configuration.GetApiKeyWithPrefix("api_key") + headerParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key") // add default headers if any @@ -352,7 +352,7 @@ func (a PetApi) GetPetById (petId int64) (Pet, ApiResponse, error) { localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -362,23 +362,23 @@ func (a PetApi) GetPetById (petId int64) (Pet, ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } var successPayload = new(Pet) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } /** * Update an existing pet @@ -386,7 +386,7 @@ func (a PetApi) GetPetById (petId int64) (Pet, ApiResponse, error) { * @param body Pet object that needs to be added to the store * @return void */ -func (a PetApi) UpdatePet (body Pet) (ApiResponse, error) { +func (a PetApi) UpdatePet (body Pet) (APIResponse, error) { var httpMethod = "Put" // create path and map variables @@ -394,7 +394,7 @@ func (a PetApi) UpdatePet (body Pet) (ApiResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->UpdatePet") + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->UpdatePet") } headerParams := make(map[string]string) @@ -423,7 +423,7 @@ func (a PetApi) UpdatePet (body Pet) (ApiResponse, error) { "application/xml", } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -433,7 +433,7 @@ func (a PetApi) UpdatePet (body Pet) (ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } @@ -442,14 +442,14 @@ func (a PetApi) UpdatePet (body Pet) (ApiResponse, error) { postBody = &body - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } /** * Updates a pet in the store with form data @@ -459,7 +459,7 @@ func (a PetApi) UpdatePet (body Pet) (ApiResponse, error) { * @param status Updated status of the pet * @return void */ -func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (ApiResponse, error) { +func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -468,7 +468,7 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (Api // verify the required parameter 'petId' is set if &petId == nil { - return *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm") + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm") } headerParams := make(map[string]string) @@ -496,7 +496,7 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (Api "application/x-www-form-urlencoded", } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -506,7 +506,7 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (Api "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } @@ -515,14 +515,14 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (Api formParams["status"] = status - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } /** * uploads an image @@ -532,7 +532,7 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (Api * @param file file to upload * @return ModelApiResponse */ -func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.File) (ModelApiResponse, ApiResponse, error) { +func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.File) (ModelApiResponse, APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -541,7 +541,7 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil // verify the required parameter 'petId' is set if &petId == nil { - return *new(ModelApiResponse), *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile") + return *new(ModelApiResponse), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile") } headerParams := make(map[string]string) @@ -569,7 +569,7 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil "multipart/form-data", } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -578,7 +578,7 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } @@ -589,14 +589,14 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil fileName = file.Name() var successPayload = new(ModelApiResponse) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } diff --git a/samples/client/petstore/go/go-petstore/store_api.go b/samples/client/petstore/go/go-petstore/store_api.go index 5da713a7d957..a8b48f63b397 100644 --- a/samples/client/petstore/go/go-petstore/store_api.go +++ b/samples/client/petstore/go/go-petstore/store_api.go @@ -33,7 +33,7 @@ func NewStoreApiWithBasePath(basePath string) *StoreApi{ * @param orderId ID of the order that needs to be deleted * @return void */ -func (a StoreApi) DeleteOrder (orderId string) (ApiResponse, error) { +func (a StoreApi) DeleteOrder (orderId string) (APIResponse, error) { var httpMethod = "Delete" // create path and map variables @@ -42,7 +42,7 @@ func (a StoreApi) DeleteOrder (orderId string) (ApiResponse, error) { // verify the required parameter 'orderId' is set if &orderId == nil { - return *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->DeleteOrder") + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->DeleteOrder") } headerParams := make(map[string]string) @@ -63,7 +63,7 @@ func (a StoreApi) DeleteOrder (orderId string) (ApiResponse, error) { localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -73,28 +73,28 @@ func (a StoreApi) DeleteOrder (orderId string) (ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } /** * Returns pet inventories by status * Returns a map of status codes to quantities * @return map[string]int32 */ -func (a StoreApi) GetInventory () (map[string]int32, ApiResponse, error) { +func (a StoreApi) GetInventory () (map[string]int32, APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -111,7 +111,7 @@ func (a StoreApi) GetInventory () (map[string]int32, ApiResponse, error) { // authentication (api_key) required // set key with prefix in header - headerParams["api_key"] = a.Configuration.GetApiKeyWithPrefix("api_key") + headerParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key") // add default headers if any @@ -124,7 +124,7 @@ func (a StoreApi) GetInventory () (map[string]int32, ApiResponse, error) { localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -133,23 +133,23 @@ func (a StoreApi) GetInventory () (map[string]int32, ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } var successPayload = new(map[string]int32) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } /** * Find purchase order by ID @@ -157,7 +157,7 @@ func (a StoreApi) GetInventory () (map[string]int32, ApiResponse, error) { * @param orderId ID of pet that needs to be fetched * @return Order */ -func (a StoreApi) GetOrderById (orderId int64) (Order, ApiResponse, error) { +func (a StoreApi) GetOrderById (orderId int64) (Order, APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -166,7 +166,7 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, ApiResponse, error) { // verify the required parameter 'orderId' is set if &orderId == nil { - return *new(Order), *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById") + return *new(Order), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById") } headerParams := make(map[string]string) @@ -187,7 +187,7 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, ApiResponse, error) { localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -197,23 +197,23 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } var successPayload = new(Order) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } /** * Place an order for a pet @@ -221,7 +221,7 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, ApiResponse, error) { * @param body order placed for purchasing the pet * @return Order */ -func (a StoreApi) PlaceOrder (body Order) (Order, ApiResponse, error) { +func (a StoreApi) PlaceOrder (body Order) (Order, APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -229,7 +229,7 @@ func (a StoreApi) PlaceOrder (body Order) (Order, ApiResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *new(Order), *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder") + return *new(Order), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder") } headerParams := make(map[string]string) @@ -250,7 +250,7 @@ func (a StoreApi) PlaceOrder (body Order) (Order, ApiResponse, error) { localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -260,7 +260,7 @@ func (a StoreApi) PlaceOrder (body Order) (Order, ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } @@ -269,14 +269,14 @@ func (a StoreApi) PlaceOrder (body Order) (Order, ApiResponse, error) { postBody = &body var successPayload = new(Order) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } diff --git a/samples/client/petstore/go/go-petstore/user_api.go b/samples/client/petstore/go/go-petstore/user_api.go index 6a6188074b3b..228c8d3f9bdc 100644 --- a/samples/client/petstore/go/go-petstore/user_api.go +++ b/samples/client/petstore/go/go-petstore/user_api.go @@ -33,7 +33,7 @@ func NewUserApiWithBasePath(basePath string) *UserApi{ * @param body Created user object * @return void */ -func (a UserApi) CreateUser (body User) (ApiResponse, error) { +func (a UserApi) CreateUser (body User) (APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -41,7 +41,7 @@ func (a UserApi) CreateUser (body User) (ApiResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUser") + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUser") } headerParams := make(map[string]string) @@ -62,7 +62,7 @@ func (a UserApi) CreateUser (body User) (ApiResponse, error) { localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -72,7 +72,7 @@ func (a UserApi) CreateUser (body User) (ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } @@ -81,14 +81,14 @@ func (a UserApi) CreateUser (body User) (ApiResponse, error) { postBody = &body - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } /** * Creates list of users with given input array @@ -96,7 +96,7 @@ func (a UserApi) CreateUser (body User) (ApiResponse, error) { * @param body List of user object * @return void */ -func (a UserApi) CreateUsersWithArrayInput (body []User) (ApiResponse, error) { +func (a UserApi) CreateUsersWithArrayInput (body []User) (APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -104,7 +104,7 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (ApiResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput") + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput") } headerParams := make(map[string]string) @@ -125,7 +125,7 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (ApiResponse, error) { localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -135,7 +135,7 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } @@ -144,14 +144,14 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (ApiResponse, error) { postBody = &body - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } /** * Creates list of users with given input array @@ -159,7 +159,7 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (ApiResponse, error) { * @param body List of user object * @return void */ -func (a UserApi) CreateUsersWithListInput (body []User) (ApiResponse, error) { +func (a UserApi) CreateUsersWithListInput (body []User) (APIResponse, error) { var httpMethod = "Post" // create path and map variables @@ -167,7 +167,7 @@ func (a UserApi) CreateUsersWithListInput (body []User) (ApiResponse, error) { // verify the required parameter 'body' is set if &body == nil { - return *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput") + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput") } headerParams := make(map[string]string) @@ -188,7 +188,7 @@ func (a UserApi) CreateUsersWithListInput (body []User) (ApiResponse, error) { localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -198,7 +198,7 @@ func (a UserApi) CreateUsersWithListInput (body []User) (ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } @@ -207,14 +207,14 @@ func (a UserApi) CreateUsersWithListInput (body []User) (ApiResponse, error) { postBody = &body - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } /** * Delete user @@ -222,7 +222,7 @@ func (a UserApi) CreateUsersWithListInput (body []User) (ApiResponse, error) { * @param username The name that needs to be deleted * @return void */ -func (a UserApi) DeleteUser (username string) (ApiResponse, error) { +func (a UserApi) DeleteUser (username string) (APIResponse, error) { var httpMethod = "Delete" // create path and map variables @@ -231,7 +231,7 @@ func (a UserApi) DeleteUser (username string) (ApiResponse, error) { // verify the required parameter 'username' is set if &username == nil { - return *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->DeleteUser") + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->DeleteUser") } headerParams := make(map[string]string) @@ -252,7 +252,7 @@ func (a UserApi) DeleteUser (username string) (ApiResponse, error) { localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -262,21 +262,21 @@ func (a UserApi) DeleteUser (username string) (ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } /** * Get user by user name @@ -284,7 +284,7 @@ func (a UserApi) DeleteUser (username string) (ApiResponse, error) { * @param username The name that needs to be fetched. Use user1 for testing. * @return User */ -func (a UserApi) GetUserByName (username string) (User, ApiResponse, error) { +func (a UserApi) GetUserByName (username string) (User, APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -293,7 +293,7 @@ func (a UserApi) GetUserByName (username string) (User, ApiResponse, error) { // verify the required parameter 'username' is set if &username == nil { - return *new(User), *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName") + return *new(User), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName") } headerParams := make(map[string]string) @@ -314,7 +314,7 @@ func (a UserApi) GetUserByName (username string) (User, ApiResponse, error) { localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -324,23 +324,23 @@ func (a UserApi) GetUserByName (username string) (User, ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } var successPayload = new(User) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } /** * Logs user into the system @@ -349,7 +349,7 @@ func (a UserApi) GetUserByName (username string) (User, ApiResponse, error) { * @param password The password for login in clear text * @return string */ -func (a UserApi) LoginUser (username string, password string) (string, ApiResponse, error) { +func (a UserApi) LoginUser (username string, password string) (string, APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -357,11 +357,11 @@ func (a UserApi) LoginUser (username string, password string) (string, ApiRespon // verify the required parameter 'username' is set if &username == nil { - return *new(string), *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->LoginUser") + return *new(string), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->LoginUser") } // verify the required parameter 'password' is set if &password == nil { - return *new(string), *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'password' when calling UserApi->LoginUser") + return *new(string), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'password' when calling UserApi->LoginUser") } headerParams := make(map[string]string) @@ -377,14 +377,14 @@ func (a UserApi) LoginUser (username string, password string) (string, ApiRespon headerParams[key] = a.Configuration.DefaultHeader[key] } - queryParams["username"] = a.Configuration.ApiClient.ParameterToString(username) - queryParams["password"] = a.Configuration.ApiClient.ParameterToString(password) + queryParams["username"] = a.Configuration.APIClient.ParameterToString(username) + queryParams["password"] = a.Configuration.APIClient.ParameterToString(password) // to determine the Content-Type header localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -394,30 +394,30 @@ func (a UserApi) LoginUser (username string, password string) (string, ApiRespon "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } var successPayload = new(string) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } err = json.Unmarshal(httpResponse.Body(), &successPayload) - return *successPayload, *NewApiResponse(httpResponse.RawResponse), err + return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err } /** * Logs out current logged in user session * * @return void */ -func (a UserApi) LogoutUser () (ApiResponse, error) { +func (a UserApi) LogoutUser () (APIResponse, error) { var httpMethod = "Get" // create path and map variables @@ -442,7 +442,7 @@ func (a UserApi) LogoutUser () (ApiResponse, error) { localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -452,21 +452,21 @@ func (a UserApi) LogoutUser () (ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } /** * Updated user @@ -475,7 +475,7 @@ func (a UserApi) LogoutUser () (ApiResponse, error) { * @param body Updated user object * @return void */ -func (a UserApi) UpdateUser (username string, body User) (ApiResponse, error) { +func (a UserApi) UpdateUser (username string, body User) (APIResponse, error) { var httpMethod = "Put" // create path and map variables @@ -484,11 +484,11 @@ func (a UserApi) UpdateUser (username string, body User) (ApiResponse, error) { // verify the required parameter 'username' is set if &username == nil { - return *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->UpdateUser") + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->UpdateUser") } // verify the required parameter 'body' is set if &body == nil { - return *NewApiResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->UpdateUser") + return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->UpdateUser") } headerParams := make(map[string]string) @@ -509,7 +509,7 @@ func (a UserApi) UpdateUser (username string, body User) (ApiResponse, error) { localVarHttpContentTypes := []string { } //set Content-Type header - localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { headerParams["Content-Type"] = localVarHttpContentType } @@ -519,7 +519,7 @@ func (a UserApi) UpdateUser (username string, body User) (ApiResponse, error) { "application/json", } //set Accept header - localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { headerParams["Accept"] = localVarHttpHeaderAccept } @@ -528,12 +528,12 @@ func (a UserApi) UpdateUser (username string, body User) (ApiResponse, error) { postBody = &body - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err } - return *NewApiResponse(httpResponse.RawResponse), err + return *NewAPIResponse(httpResponse.RawResponse), err }