added support for multi

This commit is contained in:
Guo Huang 2016-05-06 11:48:20 -07:00
parent 34ec63e908
commit 5bb1853018
4 changed files with 51 additions and 12 deletions

View File

@ -75,9 +75,22 @@ func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{
// add default headers if any // add default headers if any
for key := range a.Configuration.DefaultHeader { for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
}{{#hasQueryParams}}{{#queryParams}} }
{{#hasQueryParams}}
{{#queryParams}}
{{#isListContainer}}
var collectionFormat = "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"
if collectionFormat == "multi" {
for _, value := range {{paramName}} {
queryParams["{{paramName}}"] = value
}
} else {
queryParams["{{paramName}}"] = a.Configuration.APIClient.ParameterToString({{paramName}}) queryParams["{{paramName}}"] = a.Configuration.APIClient.ParameterToString({{paramName}})
}
{{/isListContainer}}
{{^isListContainer}}
queryParams["{{paramName}}"] = a.Configuration.APIClient.ParameterToString({{paramName}})
{{/isListContainer}}
{{/queryParams}}{{/hasQueryParams}} {{/queryParams}}{{/hasQueryParams}}
// to determine the Content-Type header // to determine the Content-Type header

View File

@ -64,6 +64,7 @@ func (a PetApi) AddPet(body Pet) (*APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ "application/json", "application/xml", } localVarHttpContentTypes := []string{ "application/json", "application/xml", }
@ -132,6 +133,7 @@ func (a PetApi) DeletePet(petId int64, apiKey string) (*APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ } localVarHttpContentTypes := []string{ }
@ -198,8 +200,14 @@ func (a PetApi) FindPetsByStatus(status []string) ([]Pet, *APIResponse, error) {
for key := range a.Configuration.DefaultHeader { for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
var collectionFormat = "csv"
if collectionFormat == "multi" {
for _, value := range status {
queryParams["status"] = value
}
} else {
queryParams["status"] = a.Configuration.APIClient.ParameterToString(status) queryParams["status"] = a.Configuration.APIClient.ParameterToString(status)
}
// to determine the Content-Type header // to determine the Content-Type header
@ -264,8 +272,14 @@ func (a PetApi) FindPetsByTags(tags []string) ([]Pet, *APIResponse, error) {
for key := range a.Configuration.DefaultHeader { for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
var collectionFormat = "csv"
if collectionFormat == "multi" {
for _, value := range tags {
queryParams["tags"] = value
}
} else {
queryParams["tags"] = a.Configuration.APIClient.ParameterToString(tags) queryParams["tags"] = a.Configuration.APIClient.ParameterToString(tags)
}
// to determine the Content-Type header // to determine the Content-Type header
@ -331,6 +345,7 @@ func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ } localVarHttpContentTypes := []string{ }
@ -394,6 +409,7 @@ func (a PetApi) UpdatePet(body Pet) (*APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ "application/json", "application/xml", } localVarHttpContentTypes := []string{ "application/json", "application/xml", }
@ -463,6 +479,7 @@ func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (*API
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ "application/x-www-form-urlencoded", } localVarHttpContentTypes := []string{ "application/x-www-form-urlencoded", }
@ -532,6 +549,7 @@ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ "multipart/form-data", } localVarHttpContentTypes := []string{ "multipart/form-data", }

View File

@ -58,6 +58,7 @@ func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ } localVarHttpContentTypes := []string{ }
@ -115,6 +116,7 @@ func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ } localVarHttpContentTypes := []string{ }
@ -173,6 +175,7 @@ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ } localVarHttpContentTypes := []string{ }
@ -231,6 +234,7 @@ func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ } localVarHttpContentTypes := []string{ }

View File

@ -57,6 +57,7 @@ func (a UserApi) CreateUser(body User) (*APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ } localVarHttpContentTypes := []string{ }
@ -118,6 +119,7 @@ func (a UserApi) CreateUsersWithArrayInput(body []User) (*APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ } localVarHttpContentTypes := []string{ }
@ -179,6 +181,7 @@ func (a UserApi) CreateUsersWithListInput(body []User) (*APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ } localVarHttpContentTypes := []string{ }
@ -241,6 +244,7 @@ func (a UserApi) DeleteUser(username string) (*APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ } localVarHttpContentTypes := []string{ }
@ -300,6 +304,7 @@ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ } localVarHttpContentTypes := []string{ }
@ -362,10 +367,7 @@ func (a UserApi) LoginUser(username string, password string) (*string, *APIRespo
for key := range a.Configuration.DefaultHeader { for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
queryParams["username"] = a.Configuration.APIClient.ParameterToString(username) queryParams["username"] = a.Configuration.APIClient.ParameterToString(username)
queryParams["password"] = a.Configuration.APIClient.ParameterToString(password) queryParams["password"] = a.Configuration.APIClient.ParameterToString(password)
@ -422,6 +424,7 @@ func (a UserApi) LogoutUser() (*APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ } localVarHttpContentTypes := []string{ }
@ -486,6 +489,7 @@ func (a UserApi) UpdateUser(username string, body User) (*APIResponse, error) {
headerParams[key] = a.Configuration.DefaultHeader[key] headerParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ } localVarHttpContentTypes := []string{ }