added model ApiResponse, moved ApiResponse parameter

This commit is contained in:
Guo Huang 2016-04-23 16:41:14 -07:00
parent e7df5f9551
commit 7df5c8ffbf
8 changed files with 100 additions and 99 deletions

View File

@ -51,7 +51,7 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
"case", "defer", "go", "map", "struct",
"chan", "else", "goto", "package", "switch",
"const", "fallthrough", "if", "range", "type",
"continue", "for", "import", "return", "var", "error")
"continue", "for", "import", "return", "var", "error", "ApiResponse")
// Added "error" as it's used so frequently that it may as well be a keyword
);
@ -145,6 +145,7 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.go"));
supportingFiles.add(new SupportingFile("api_client.mustache", "", "api_client.go"));
supportingFiles.add(new SupportingFile("api_response.mustache", "", "api_response.go"));
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
}
@ -324,7 +325,7 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
return swaggerType;
}
return camelize(swaggerType, false);
return toModelName(swaggerType);
}
@Override

View File

@ -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}}error, ApiResponse) {
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}}errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return {{#returnType}}*new({{{returnType}}}), {{/returnType}}*a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
}
{{/required}}
{{/allParams}}
@ -138,14 +138,14 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{
if err != nil {
return {{#returnType}}*successPayload, {{/returnType}}err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return {{#returnType}}*successPayload, {{/returnType}}*a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
{{#returnType}}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
{{/returnType}}
return {{#returnType}}*successPayload, {{/returnType}}err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return {{#returnType}}*successPayload, {{/returnType}}*a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
{{/operation}}
{{/operations}}

View File

@ -7,7 +7,7 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-04-17T23:42:10.705-07:00
- Build date: 2016-04-23T15:46:19.755-07:00
- Build package: class io.swagger.codegen.languages.GoClientCodegen
## Installation
@ -46,8 +46,8 @@ Class | Method | HTTP request | Description
## Documentation For Models
- [ApiResponse](docs/ApiResponse.md)
- [Category](docs/Category.md)
- [ModelApiResponse](docs/ModelApiResponse.md)
- [Order](docs/Order.md)
- [Pet](docs/Pet.md)
- [Tag](docs/Tag.md)

View File

@ -221,7 +221,7 @@ void (empty response body)
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **UploadFile**
> ApiResponse UploadFile($petId, $additionalMetadata, $file)
> ModelApiResponse UploadFile($petId, $additionalMetadata, $file)
uploads an image
@ -238,7 +238,7 @@ Name | Type | Description | Notes
### Return type
[**ApiResponse**](ApiResponse.md)
[**ModelApiResponse**](ApiResponse.md)
### Authorization

View File

@ -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) (error, ApiResponse) {
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) (error, ApiResponse) {
// verify the required parameter 'body' is set
if &body == nil {
return errors.New("Missing required parameter 'body' when calling PetApi->AddPet"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->AddPet")
}
headerParams := make(map[string]string)
@ -95,10 +95,10 @@ func (a PetApi) AddPet (body Pet) (error, ApiResponse) {
if err != nil {
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Deletes a pet
@ -107,7 +107,7 @@ func (a PetApi) AddPet (body Pet) (error, ApiResponse) {
* @param apiKey
* @return void
*/
func (a PetApi) DeletePet (petId int64, apiKey string) (error, ApiResponse) {
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) (error, ApiResponse) {
// verify the required parameter 'petId' is set
if &petId == nil {
return errors.New("Missing required parameter 'petId' when calling PetApi->DeletePet"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->DeletePet")
}
headerParams := make(map[string]string)
@ -166,10 +166,10 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (error, ApiResponse) {
if err != nil {
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Finds Pets by status
@ -177,7 +177,7 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (error, ApiResponse) {
* @param status Status values that need to be considered for filter
* @return []Pet
*/
func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error, ApiResponse) {
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, error, ApiResponse) {
// verify the required parameter 'status' is set
if &status == nil {
return *new([]Pet), errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *new([]Pet), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus")
}
headerParams := make(map[string]string)
@ -234,12 +234,12 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error, ApiResponse) {
if err != nil {
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Finds Pets by tags
@ -247,7 +247,7 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error, ApiResponse) {
* @param tags Tags to filter by
* @return []Pet
*/
func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error, ApiResponse) {
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, error, ApiResponse) {
// verify the required parameter 'tags' is set
if &tags == nil {
return *new([]Pet), errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *new([]Pet), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags")
}
headerParams := make(map[string]string)
@ -304,12 +304,12 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error, ApiResponse) {
if err != nil {
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Find pet by ID
@ -317,7 +317,7 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error, ApiResponse) {
* @param petId ID of pet to return
* @return Pet
*/
func (a PetApi) GetPetById (petId int64) (Pet, error, ApiResponse) {
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, error, ApiResponse) {
// verify the required parameter 'petId' is set
if &petId == nil {
return *new(Pet), errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *new(Pet), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById")
}
headerParams := make(map[string]string)
@ -373,12 +373,12 @@ func (a PetApi) GetPetById (petId int64) (Pet, error, ApiResponse) {
if err != nil {
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Update an existing pet
@ -386,7 +386,7 @@ func (a PetApi) GetPetById (petId int64) (Pet, error, ApiResponse) {
* @param body Pet object that needs to be added to the store
* @return void
*/
func (a PetApi) UpdatePet (body Pet) (error, ApiResponse) {
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) (error, ApiResponse) {
// verify the required parameter 'body' is set
if &body == nil {
return errors.New("Missing required parameter 'body' when calling PetApi->UpdatePet"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->UpdatePet")
}
headerParams := make(map[string]string)
@ -446,10 +446,10 @@ func (a PetApi) UpdatePet (body Pet) (error, ApiResponse) {
if err != nil {
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Updates a pet in the store with form data
@ -459,7 +459,7 @@ func (a PetApi) UpdatePet (body Pet) (error, ApiResponse) {
* @param status Updated status of the pet
* @return void
*/
func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (error, ApiResponse) {
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) (err
// verify the required parameter 'petId' is set
if &petId == nil {
return errors.New("Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm")
}
headerParams := make(map[string]string)
@ -519,10 +519,10 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (err
if err != nil {
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* uploads an image
@ -530,9 +530,9 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (err
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
* @return ApiResponse
* @return ModelApiResponse
*/
func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.File) (ApiResponse, error, ApiResponse) {
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(ApiResponse), errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *new(ModelApiResponse), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile")
}
headerParams := make(map[string]string)
@ -588,15 +588,15 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil
fileBytes = fbs
fileName = file.Name()
var successPayload = new(ApiResponse)
var successPayload = new(ModelApiResponse)
httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
if err != nil {
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}

View File

@ -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) (error, ApiResponse) {
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) (error, ApiResponse) {
// verify the required parameter 'orderId' is set
if &orderId == nil {
return errors.New("Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->DeleteOrder")
}
headerParams := make(map[string]string)
@ -84,17 +84,17 @@ func (a StoreApi) DeleteOrder (orderId string) (error, ApiResponse) {
if err != nil {
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), 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, error, ApiResponse) {
func (a StoreApi) GetInventory () (map[string]int32, ApiResponse, error) {
var httpMethod = "Get"
// create path and map variables
@ -144,12 +144,12 @@ func (a StoreApi) GetInventory () (map[string]int32, error, ApiResponse) {
if err != nil {
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Find purchase order by ID
@ -157,7 +157,7 @@ func (a StoreApi) GetInventory () (map[string]int32, error, ApiResponse) {
* @param orderId ID of pet that needs to be fetched
* @return Order
*/
func (a StoreApi) GetOrderById (orderId int64) (Order, error, ApiResponse) {
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, error, ApiResponse) {
// verify the required parameter 'orderId' is set
if &orderId == nil {
return *new(Order), errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *new(Order), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById")
}
headerParams := make(map[string]string)
@ -208,12 +208,12 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, error, ApiResponse) {
if err != nil {
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Place an order for a pet
@ -221,7 +221,7 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, error, ApiResponse) {
* @param body order placed for purchasing the pet
* @return Order
*/
func (a StoreApi) PlaceOrder (body Order) (Order, error, ApiResponse) {
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, error, ApiResponse) {
// verify the required parameter 'body' is set
if &body == nil {
return *new(Order), errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *new(Order), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder")
}
headerParams := make(map[string]string)
@ -273,10 +273,10 @@ func (a StoreApi) PlaceOrder (body Order) (Order, error, ApiResponse) {
if err != nil {
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}

View File

@ -33,7 +33,7 @@ func NewUserApiWithBasePath(basePath string) *UserApi{
* @param body Created user object
* @return void
*/
func (a UserApi) CreateUser (body User) (error, ApiResponse) {
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) (error, ApiResponse) {
// verify the required parameter 'body' is set
if &body == nil {
return errors.New("Missing required parameter 'body' when calling UserApi->CreateUser"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUser")
}
headerParams := make(map[string]string)
@ -85,10 +85,10 @@ func (a UserApi) CreateUser (body User) (error, ApiResponse) {
if err != nil {
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Creates list of users with given input array
@ -96,7 +96,7 @@ func (a UserApi) CreateUser (body User) (error, ApiResponse) {
* @param body List of user object
* @return void
*/
func (a UserApi) CreateUsersWithArrayInput (body []User) (error, ApiResponse) {
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) (error, ApiResponse) {
// verify the required parameter 'body' is set
if &body == nil {
return errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput")
}
headerParams := make(map[string]string)
@ -148,10 +148,10 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (error, ApiResponse) {
if err != nil {
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Creates list of users with given input array
@ -159,7 +159,7 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (error, ApiResponse) {
* @param body List of user object
* @return void
*/
func (a UserApi) CreateUsersWithListInput (body []User) (error, ApiResponse) {
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) (error, ApiResponse) {
// verify the required parameter 'body' is set
if &body == nil {
return errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput")
}
headerParams := make(map[string]string)
@ -211,10 +211,10 @@ func (a UserApi) CreateUsersWithListInput (body []User) (error, ApiResponse) {
if err != nil {
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Delete user
@ -222,7 +222,7 @@ func (a UserApi) CreateUsersWithListInput (body []User) (error, ApiResponse) {
* @param username The name that needs to be deleted
* @return void
*/
func (a UserApi) DeleteUser (username string) (error, ApiResponse) {
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) (error, ApiResponse) {
// verify the required parameter 'username' is set
if &username == nil {
return errors.New("Missing required parameter 'username' when calling UserApi->DeleteUser"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->DeleteUser")
}
headerParams := make(map[string]string)
@ -273,10 +273,10 @@ func (a UserApi) DeleteUser (username string) (error, ApiResponse) {
if err != nil {
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Get user by user name
@ -284,7 +284,7 @@ func (a UserApi) DeleteUser (username string) (error, ApiResponse) {
* @param username The name that needs to be fetched. Use user1 for testing.
* @return User
*/
func (a UserApi) GetUserByName (username string) (User, error, ApiResponse) {
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, error, ApiResponse) {
// verify the required parameter 'username' is set
if &username == nil {
return *new(User), errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *new(User), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName")
}
headerParams := make(map[string]string)
@ -335,12 +335,12 @@ func (a UserApi) GetUserByName (username string) (User, error, ApiResponse) {
if err != nil {
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Logs user into the system
@ -349,7 +349,7 @@ func (a UserApi) GetUserByName (username string) (User, error, ApiResponse) {
* @param password The password for login in clear text
* @return string
*/
func (a UserApi) LoginUser (username string, password string) (string, error, ApiResponse) {
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, error, Ap
// verify the required parameter 'username' is set
if &username == nil {
return *new(string), errors.New("Missing required parameter 'username' when calling UserApi->LoginUser"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *new(string), *a.Configuration.ApiClient.SetErrorApiResponse("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), errors.New("Missing required parameter 'password' when calling UserApi->LoginUser"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *new(string), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'password' when calling UserApi->LoginUser")
}
headerParams := make(map[string]string)
@ -405,19 +405,19 @@ func (a UserApi) LoginUser (username string, password string) (string, error, Ap
if err != nil {
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return *successPayload, err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *successPayload, *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Logs out current logged in user session
*
* @return void
*/
func (a UserApi) LogoutUser () (error, ApiResponse) {
func (a UserApi) LogoutUser () (ApiResponse, error) {
var httpMethod = "Get"
// create path and map variables
@ -463,10 +463,10 @@ func (a UserApi) LogoutUser () (error, ApiResponse) {
if err != nil {
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
/**
* Updated user
@ -475,7 +475,7 @@ func (a UserApi) LogoutUser () (error, ApiResponse) {
* @param body Updated user object
* @return void
*/
func (a UserApi) UpdateUser (username string, body User) (error, ApiResponse) {
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) (error, ApiResponse) {
// verify the required parameter 'username' is set
if &username == nil {
return errors.New("Missing required parameter 'username' when calling UserApi->UpdateUser"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'username' when calling UserApi->UpdateUser")
}
// verify the required parameter 'body' is set
if &body == nil {
return errors.New("Missing required parameter 'body' when calling UserApi->UpdateUser"), *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request")
return *a.Configuration.ApiClient.SetErrorApiResponse("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling UserApi->UpdateUser")
}
headerParams := make(map[string]string)
@ -532,8 +532,8 @@ func (a UserApi) UpdateUser (username string, body User) (error, ApiResponse) {
if err != nil {
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}
return err, *a.Configuration.ApiClient.GetApiResponse(httpResponse)
return *a.Configuration.ApiClient.GetApiResponse(httpResponse), err
}

View File

@ -12,7 +12,7 @@ func TestAddPet(t *testing.T) {
newPet := (sw.Pet{Id: 12830, Name: "gopher",
PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending"})
err, apiResponse := s.AddPet(newPet)
apiResponse, err := s.AddPet(newPet)
if err != nil {
t.Errorf("Error while adding pet")
@ -27,7 +27,7 @@ func TestGetPetById(t *testing.T) {
assert := assert.New(t)
s := sw.NewPetApi()
resp, err, apiResponse := s.GetPetById(12830)
resp, apiResponse, err := s.GetPetById(12830)
if err != nil {
t.Errorf("Error while getting pet by id")
t.Log(err)
@ -45,7 +45,7 @@ func TestGetPetById(t *testing.T) {
func TestGetPetByIdWithInvalidID(t *testing.T) {
s := sw.NewPetApi()
resp, err, apiResponse := s.GetPetById(999999999)
resp, apiResponse, err := s.GetPetById(999999999)
if err != nil {
t.Errorf("Error while getting pet by invalid id")
t.Log(err)
@ -61,7 +61,7 @@ func TestGetPetByIdWithInvalidID(t *testing.T) {
func TestUpdatePetWithForm(t *testing.T) {
s := sw.NewPetApi()
err, apiResponse := s.UpdatePetWithForm(12830, "golang", "available")
apiResponse, err := s.UpdatePetWithForm(12830, "golang", "available")
if err != nil {
t.Errorf("Error while updating pet by id")
@ -75,7 +75,7 @@ func TestUpdatePetWithForm(t *testing.T) {
func TestFindPetsByStatus(t *testing.T) {
s := sw.NewPetApi()
resp, err, apiResponse := s.FindPetsByStatus([]string {"pending"})
resp, apiResponse, err := s.FindPetsByStatus([]string {"pending"})
if err != nil {
t.Errorf("Error while getting pet by id")
t.Log(err)
@ -96,7 +96,7 @@ func TestUploadFile(t *testing.T) {
s := sw.NewPetApi()
file, _ := os.Open("../python/testfiles/foo.png")
_, err, apiResponse := s.UploadFile(12830, "golang", file)
_, apiResponse, err := s.UploadFile(12830, "golang", file)
if err != nil {
t.Errorf("Error while uploading file")
@ -109,7 +109,7 @@ func TestUploadFile(t *testing.T) {
func TestDeletePet(t *testing.T) {
s := sw.NewPetApi()
err, apiResponse := s.DeletePet(12830, "")
apiResponse, err := s.DeletePet(12830, "")
if err != nil {
t.Errorf("Error while deleting pet by id")