mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
changed go client to return object pointer
This commit is contained in:
parent
8f258b9a48
commit
e6fb2507a4
@ -36,7 +36,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
|
||||
@ -48,7 +48,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}}nil, errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
|
||||
}
|
||||
{{/required}}
|
||||
{{/allParams}}
|
||||
@ -137,14 +137,14 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{
|
||||
|
||||
|
||||
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}}
|
||||
|
@ -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 nil, 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) (APIResponse, error) {
|
||||
|
||||
|
||||
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 nil, 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) (APIResponse, error) {
|
||||
|
||||
|
||||
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), nil, 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, APIResponse, error) {
|
||||
|
||||
|
||||
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), nil, 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, APIResponse, error) {
|
||||
|
||||
|
||||
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), nil, 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, APIResponse, error) {
|
||||
|
||||
|
||||
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 nil, 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) (APIResponse, error) {
|
||||
|
||||
|
||||
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 nil, 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) (API
|
||||
|
||||
|
||||
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), nil, errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile")
|
||||
}
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
@ -593,10 +593,10 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -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 nil, 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) (APIResponse, error) {
|
||||
|
||||
|
||||
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
|
||||
@ -144,12 +144,12 @@ func (a StoreApi) GetInventory () (map[string]int32, APIResponse, error) {
|
||||
|
||||
|
||||
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), nil, 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, APIResponse, error) {
|
||||
|
||||
|
||||
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), nil, 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, APIResponse, error) {
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -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 nil, 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) (APIResponse, error) {
|
||||
|
||||
|
||||
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 nil, 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) (APIResponse, error) {
|
||||
|
||||
|
||||
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 nil, 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) (APIResponse, error) {
|
||||
|
||||
|
||||
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 nil, 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) (APIResponse, error) {
|
||||
|
||||
|
||||
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), nil, 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, APIResponse, error) {
|
||||
|
||||
|
||||
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), nil, 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), nil, 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, APIRespon
|
||||
|
||||
|
||||
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
|
||||
@ -463,10 +463,10 @@ func (a UserApi) LogoutUser () (APIResponse, error) {
|
||||
|
||||
|
||||
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 nil, 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 nil, 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) (APIResponse, error) {
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
return NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
return NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ func TestFindPetsByStatus(t *testing.T) {
|
||||
t.Log(apiResponse)
|
||||
} else {
|
||||
t.Log(apiResponse)
|
||||
if len(resp) == 0 {
|
||||
if len(*resp) == 0 {
|
||||
t.Errorf("Error no pets returned")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user