diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache index bd727a02910b..5b6b9d30ab67 100644 --- a/modules/swagger-codegen/src/main/resources/go/api.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api.mustache @@ -49,9 +49,9 @@ func New{{classname}}WithBasePath(basePath string) *{{classname}}{ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}error, ApiResponse) { var httpMethod = "{{httpMethod}}" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "{{path}}" -{{#pathParams}} path = strings.Replace(path, "{" + "{{baseName}}" + "}", fmt.Sprintf("%v", {{paramName}}), -1) +{{#pathParams}} path = strings.Replace(path, "{" + "{{baseName}}" + "}", fmt.Sprintf("%v", {{paramName}}), -1) {{/pathParams}} {{#allParams}} @@ -67,6 +67,7 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{ queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte {{#authMethods}}// authentication ({{name}}) required @@ -133,6 +134,7 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{ {{#formParams}} {{#isFile}}fbs, _ := ioutil.ReadAll(file) fileBytes = fbs + fileName = file.Name() {{/isFile}} {{^isFile}}formParams["{{paramName}}"] = {{paramName}} {{/isFile}} @@ -141,7 +143,7 @@ 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, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { 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 04f082a466c7..ce6de7017e08 100644 --- a/modules/swagger-codegen/src/main/resources/go/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api_client.mustache @@ -6,6 +6,7 @@ import ( "errors" "reflect" "bytes" + "path/filepath" ) type ApiClient struct { @@ -50,13 +51,14 @@ func (c *ApiClient) CallApi(path string, method string, headerParams map[string]string, queryParams map[string]string, formParams map[string]string, - file []byte) (*resty.Response, error) { + fileName string, + fileBytes []byte) (*resty.Response, error) { //set debug flag configuration := NewConfiguration() resty.SetDebug(configuration.Debug) - request := prepareRequest(postBody, headerParams, queryParams, formParams,file) + request := prepareRequest(postBody, headerParams, queryParams, formParams,fileName,fileBytes) switch strings.ToUpper(method) { case "GET": @@ -108,8 +110,9 @@ func (c *ApiClient) SetErrorApiResponse(errorMessage string) *ApiResponse{ func prepareRequest(postBody interface{}, headerParams map[string]string, queryParams map[string]string, - formParams map[string]string, - file []byte) *resty.Request { + formParams map[string]string, + fileName string, + fileBytes []byte) *resty.Request { request := resty.R() @@ -130,8 +133,9 @@ func prepareRequest(postBody interface{}, request.SetFormData(formParams) } - if len(file) > 0 { - request.SetFileReader("file", "test-img.png", bytes.NewReader(file)) + if len(fileBytes) > 0 && fileName != "" { + _, fileNm := filepath.Split(fileName) + request.SetFileReader("file", fileNm, bytes.NewReader(fileBytes)) } return request } diff --git a/samples/client/petstore/go/go-petstore/api_client.go b/samples/client/petstore/go/go-petstore/api_client.go index 3bec2e26bf8d..77ec4ef39949 100644 --- a/samples/client/petstore/go/go-petstore/api_client.go +++ b/samples/client/petstore/go/go-petstore/api_client.go @@ -6,6 +6,7 @@ import ( "errors" "reflect" "bytes" + "path/filepath" ) type ApiClient struct { @@ -50,13 +51,14 @@ func (c *ApiClient) CallApi(path string, method string, headerParams map[string]string, queryParams map[string]string, formParams map[string]string, - file []byte) (*resty.Response, error) { + fileName string, + fileBytes []byte) (*resty.Response, error) { //set debug flag configuration := NewConfiguration() resty.SetDebug(configuration.Debug) - request := prepareRequest(postBody, headerParams, queryParams, formParams,file) + request := prepareRequest(postBody, headerParams, queryParams, formParams,fileName,fileBytes) switch strings.ToUpper(method) { case "GET": @@ -108,8 +110,9 @@ func (c *ApiClient) SetErrorApiResponse(errorMessage string) *ApiResponse{ func prepareRequest(postBody interface{}, headerParams map[string]string, queryParams map[string]string, - formParams map[string]string, - file []byte) *resty.Request { + formParams map[string]string, + fileName string, + fileBytes []byte) *resty.Request { request := resty.R() @@ -130,8 +133,9 @@ func prepareRequest(postBody interface{}, request.SetFormData(formParams) } - if len(file) > 0 { - request.SetFileReader("file", "test-img.png", bytes.NewReader(file)) + if len(fileBytes) > 0 && fileName != "" { + _, fileNm := filepath.Split(fileName) + request.SetFileReader("file", fileNm, bytes.NewReader(fileBytes)) } return request } diff --git a/samples/client/petstore/go/go-petstore/pet_api.go b/samples/client/petstore/go/go-petstore/pet_api.go index f089d87c677f..22df273324c3 100644 --- a/samples/client/petstore/go/go-petstore/pet_api.go +++ b/samples/client/petstore/go/go-petstore/pet_api.go @@ -38,7 +38,7 @@ func NewPetApiWithBasePath(basePath string) *PetApi{ func (a PetApi) AddPet (body Pet) (error, ApiResponse) { var httpMethod = "Post" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/pet" // verify the required parameter 'body' is set @@ -50,6 +50,7 @@ func (a PetApi) AddPet (body Pet) (error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte // authentication (petstore_auth) required @@ -90,7 +91,7 @@ func (a PetApi) AddPet (body Pet) (error, ApiResponse) { postBody = &body - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -109,9 +110,9 @@ func (a PetApi) AddPet (body Pet) (error, ApiResponse) { func (a PetApi) DeletePet (petId int64, apiKey string) (error, ApiResponse) { var httpMethod = "Delete" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/pet/{petId}" - path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1) + path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1) // verify the required parameter 'petId' is set if &petId == nil { @@ -122,6 +123,7 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte // authentication (petstore_auth) required @@ -160,7 +162,7 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (error, ApiResponse) { - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -178,7 +180,7 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (error, ApiResponse) { func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error, ApiResponse) { var httpMethod = "Get" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/pet/findByStatus" // verify the required parameter 'status' is set @@ -190,6 +192,7 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte // authentication (petstore_auth) required @@ -227,7 +230,7 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error, ApiResponse) { var successPayload = new([]Pet) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -247,7 +250,7 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error, ApiResponse) { func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error, ApiResponse) { var httpMethod = "Get" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/pet/findByTags" // verify the required parameter 'tags' is set @@ -259,6 +262,7 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte // authentication (petstore_auth) required @@ -296,7 +300,7 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error, ApiResponse) { var successPayload = new([]Pet) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -316,9 +320,9 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error, ApiResponse) { func (a PetApi) GetPetById (petId int64) (Pet, error, ApiResponse) { var httpMethod = "Get" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/pet/{petId}" - path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1) + path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1) // verify the required parameter 'petId' is set if &petId == nil { @@ -329,6 +333,7 @@ func (a PetApi) GetPetById (petId int64) (Pet, error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte // authentication (api_key) required @@ -364,7 +369,7 @@ func (a PetApi) GetPetById (petId int64) (Pet, error, ApiResponse) { var successPayload = new(Pet) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -384,7 +389,7 @@ func (a PetApi) GetPetById (petId int64) (Pet, error, ApiResponse) { func (a PetApi) UpdatePet (body Pet) (error, ApiResponse) { var httpMethod = "Put" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/pet" // verify the required parameter 'body' is set @@ -396,6 +401,7 @@ func (a PetApi) UpdatePet (body Pet) (error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte // authentication (petstore_auth) required @@ -436,7 +442,7 @@ func (a PetApi) UpdatePet (body Pet) (error, ApiResponse) { postBody = &body - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -456,9 +462,9 @@ func (a PetApi) UpdatePet (body Pet) (error, ApiResponse) { func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (error, ApiResponse) { var httpMethod = "Post" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/pet/{petId}" - path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1) + path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1) // verify the required parameter 'petId' is set if &petId == nil { @@ -469,6 +475,7 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (err queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte // authentication (petstore_auth) required @@ -508,7 +515,7 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (err formParams["status"] = status - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -528,9 +535,9 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (err func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.File) (ApiResponse, error, ApiResponse) { var httpMethod = "Post" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/pet/{petId}/uploadImage" - path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1) + path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1) // verify the required parameter 'petId' is set if &petId == nil { @@ -541,6 +548,7 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte // authentication (petstore_auth) required @@ -578,9 +586,10 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil formParams["additionalMetadata"] = additionalMetadata fbs, _ := ioutil.ReadAll(file) fileBytes = fbs + fileName = file.Name() var successPayload = new(ApiResponse) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { diff --git a/samples/client/petstore/go/go-petstore/store_api.go b/samples/client/petstore/go/go-petstore/store_api.go index 59f9d2bd083f..c1904d3dc6be 100644 --- a/samples/client/petstore/go/go-petstore/store_api.go +++ b/samples/client/petstore/go/go-petstore/store_api.go @@ -36,9 +36,9 @@ func NewStoreApiWithBasePath(basePath string) *StoreApi{ func (a StoreApi) DeleteOrder (orderId string) (error, ApiResponse) { var httpMethod = "Delete" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/store/order/{orderId}" - path = strings.Replace(path, "{" + "orderId" + "}", fmt.Sprintf("%v", orderId), -1) + path = strings.Replace(path, "{" + "orderId" + "}", fmt.Sprintf("%v", orderId), -1) // verify the required parameter 'orderId' is set if &orderId == nil { @@ -49,6 +49,7 @@ func (a StoreApi) DeleteOrder (orderId string) (error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte @@ -79,7 +80,7 @@ func (a StoreApi) DeleteOrder (orderId string) (error, ApiResponse) { - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -96,7 +97,7 @@ func (a StoreApi) DeleteOrder (orderId string) (error, ApiResponse) { func (a StoreApi) GetInventory () (map[string]int32, error, ApiResponse) { var httpMethod = "Get" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/store/inventory" @@ -104,6 +105,7 @@ func (a StoreApi) GetInventory () (map[string]int32, error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte // authentication (api_key) required @@ -138,7 +140,7 @@ func (a StoreApi) GetInventory () (map[string]int32, error, ApiResponse) { var successPayload = new(map[string]int32) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -158,9 +160,9 @@ func (a StoreApi) GetInventory () (map[string]int32, error, ApiResponse) { func (a StoreApi) GetOrderById (orderId int64) (Order, error, ApiResponse) { var httpMethod = "Get" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/store/order/{orderId}" - path = strings.Replace(path, "{" + "orderId" + "}", fmt.Sprintf("%v", orderId), -1) + path = strings.Replace(path, "{" + "orderId" + "}", fmt.Sprintf("%v", orderId), -1) // verify the required parameter 'orderId' is set if &orderId == nil { @@ -171,6 +173,7 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte @@ -201,7 +204,7 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, error, ApiResponse) { var successPayload = new(Order) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -221,7 +224,7 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, error, ApiResponse) { func (a StoreApi) PlaceOrder (body Order) (Order, error, ApiResponse) { var httpMethod = "Post" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/store/order" // verify the required parameter 'body' is set @@ -233,6 +236,7 @@ func (a StoreApi) PlaceOrder (body Order) (Order, error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte @@ -265,7 +269,7 @@ func (a StoreApi) PlaceOrder (body Order) (Order, error, ApiResponse) { postBody = &body var successPayload = new(Order) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { diff --git a/samples/client/petstore/go/go-petstore/user_api.go b/samples/client/petstore/go/go-petstore/user_api.go index 3a845817216e..4e3cf387bc01 100644 --- a/samples/client/petstore/go/go-petstore/user_api.go +++ b/samples/client/petstore/go/go-petstore/user_api.go @@ -36,7 +36,7 @@ func NewUserApiWithBasePath(basePath string) *UserApi{ func (a UserApi) CreateUser (body User) (error, ApiResponse) { var httpMethod = "Post" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/user" // verify the required parameter 'body' is set @@ -48,6 +48,7 @@ func (a UserApi) CreateUser (body User) (error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte @@ -80,7 +81,7 @@ func (a UserApi) CreateUser (body User) (error, ApiResponse) { postBody = &body - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -98,7 +99,7 @@ func (a UserApi) CreateUser (body User) (error, ApiResponse) { func (a UserApi) CreateUsersWithArrayInput (body []User) (error, ApiResponse) { var httpMethod = "Post" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/user/createWithArray" // verify the required parameter 'body' is set @@ -110,6 +111,7 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte @@ -142,7 +144,7 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (error, ApiResponse) { postBody = &body - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -160,7 +162,7 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (error, ApiResponse) { func (a UserApi) CreateUsersWithListInput (body []User) (error, ApiResponse) { var httpMethod = "Post" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/user/createWithList" // verify the required parameter 'body' is set @@ -172,6 +174,7 @@ func (a UserApi) CreateUsersWithListInput (body []User) (error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte @@ -204,7 +207,7 @@ func (a UserApi) CreateUsersWithListInput (body []User) (error, ApiResponse) { postBody = &body - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -222,9 +225,9 @@ func (a UserApi) CreateUsersWithListInput (body []User) (error, ApiResponse) { func (a UserApi) DeleteUser (username string) (error, ApiResponse) { var httpMethod = "Delete" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/user/{username}" - path = strings.Replace(path, "{" + "username" + "}", fmt.Sprintf("%v", username), -1) + path = strings.Replace(path, "{" + "username" + "}", fmt.Sprintf("%v", username), -1) // verify the required parameter 'username' is set if &username == nil { @@ -235,6 +238,7 @@ func (a UserApi) DeleteUser (username string) (error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte @@ -265,7 +269,7 @@ func (a UserApi) DeleteUser (username string) (error, ApiResponse) { - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -283,9 +287,9 @@ func (a UserApi) DeleteUser (username string) (error, ApiResponse) { func (a UserApi) GetUserByName (username string) (User, error, ApiResponse) { var httpMethod = "Get" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/user/{username}" - path = strings.Replace(path, "{" + "username" + "}", fmt.Sprintf("%v", username), -1) + path = strings.Replace(path, "{" + "username" + "}", fmt.Sprintf("%v", username), -1) // verify the required parameter 'username' is set if &username == nil { @@ -296,6 +300,7 @@ func (a UserApi) GetUserByName (username string) (User, error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte @@ -326,7 +331,7 @@ func (a UserApi) GetUserByName (username string) (User, error, ApiResponse) { var successPayload = new(User) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -347,7 +352,7 @@ func (a UserApi) GetUserByName (username string) (User, error, ApiResponse) { func (a UserApi) LoginUser (username string, password string) (string, error, ApiResponse) { var httpMethod = "Get" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/user/login" // verify the required parameter 'username' is set @@ -363,6 +368,7 @@ func (a UserApi) LoginUser (username string, password string) (string, error, Ap queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte @@ -395,7 +401,7 @@ func (a UserApi) LoginUser (username string, password string) (string, error, Ap var successPayload = new(string) - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -414,7 +420,7 @@ func (a UserApi) LoginUser (username string, password string) (string, error, Ap func (a UserApi) LogoutUser () (error, ApiResponse) { var httpMethod = "Get" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/user/logout" @@ -422,6 +428,7 @@ func (a UserApi) LogoutUser () (error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte @@ -452,7 +459,7 @@ func (a UserApi) LogoutUser () (error, ApiResponse) { - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil { @@ -471,9 +478,9 @@ func (a UserApi) LogoutUser () (error, ApiResponse) { func (a UserApi) UpdateUser (username string, body User) (error, ApiResponse) { var httpMethod = "Put" - // create path and map variables + // create path and map variables path := a.Configuration.BasePath + "/user/{username}" - path = strings.Replace(path, "{" + "username" + "}", fmt.Sprintf("%v", username), -1) + path = strings.Replace(path, "{" + "username" + "}", fmt.Sprintf("%v", username), -1) // verify the required parameter 'username' is set if &username == nil { @@ -488,6 +495,7 @@ func (a UserApi) UpdateUser (username string, body User) (error, ApiResponse) { queryParams := make(map[string]string) formParams := make(map[string]string) var postBody interface{} + var fileName string var fileBytes []byte @@ -520,7 +528,7 @@ func (a UserApi) UpdateUser (username string, body User) (error, ApiResponse) { postBody = &body - httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileBytes) + httpResponse, err := a.Configuration.ApiClient.CallApi(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) if err != nil {