mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 11:23:58 +00:00
issue#2543: added api_client to set content-type and accept for http request
This commit is contained in:
parent
4f84c7d3bc
commit
11f90de808
@ -134,6 +134,7 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||||
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
||||||
supportingFiles.add(new SupportingFile("configuration.mustache", packageName, "configuration.go"));
|
supportingFiles.add(new SupportingFile("configuration.mustache", packageName, "configuration.go"));
|
||||||
|
supportingFiles.add(new SupportingFile("api_client.mustache", packageName, "api_client.go"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -86,11 +86,29 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{
|
|||||||
}
|
}
|
||||||
_sling = _sling.QueryStruct(&QueryParams{ {{#queryParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/queryParams}} })
|
_sling = _sling.QueryStruct(&QueryParams{ {{#queryParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/queryParams}} })
|
||||||
{{/hasQueryParams}}
|
{{/hasQueryParams}}
|
||||||
// accept header
|
|
||||||
accepts := []string { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
{{#consumes}}
|
||||||
break // only use the first Accept
|
"{{mediaType}}",
|
||||||
|
{{/consumes}}
|
||||||
|
}
|
||||||
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
{{#produces}}
|
||||||
|
"{{mediaType}}",
|
||||||
|
{{/produces}}
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
{{#hasHeaderParams}}{{#headerParams}} // header params "{{baseName}}"
|
{{#hasHeaderParams}}{{#headerParams}} // header params "{{baseName}}"
|
||||||
_sling = _sling.Set("{{baseName}}", {{paramName}})
|
_sling = _sling.Set("{{baseName}}", {{paramName}})
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
package {{packageName}}
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ApiClient struct {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ApiClient) SelectHeaderContentType(contentTypes []string) string {
|
||||||
|
if (len(contentTypes) == 0){
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if contains(contentTypes,"application/json") {
|
||||||
|
return "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
return contentTypes[0] // use the first content type specified in 'consumes'
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ApiClient) SelectHeaderAccept(accepts []string) string {
|
||||||
|
if (len(accepts) == 0){
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if contains(accepts,"application/json"){
|
||||||
|
return "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.Join(accepts,",")
|
||||||
|
}
|
||||||
|
|
||||||
|
func contains(source []string, containvalue string) bool {
|
||||||
|
for _, a := range source {
|
||||||
|
if strings.ToLower(a) == strings.ToLower(containvalue) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
@ -19,6 +19,7 @@ type Configuration struct {
|
|||||||
AccessToken string `json:"accessToken,omitempty"`
|
AccessToken string `json:"accessToken,omitempty"`
|
||||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||||
UserAgent string `json:"userAgent,omitempty"`
|
UserAgent string `json:"userAgent,omitempty"`
|
||||||
|
ApiClient ApiClient `json:"apiClient,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConfiguration() *Configuration {
|
func NewConfiguration() *Configuration {
|
||||||
|
41
samples/client/petstore/go/swagger/api_client.go
Normal file
41
samples/client/petstore/go/swagger/api_client.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package swagger
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ApiClient struct {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ApiClient) SelectHeaderContentType(contentTypes []string) string {
|
||||||
|
if (len(contentTypes) == 0){
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if contains(contentTypes,"application/json") {
|
||||||
|
return "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
return contentTypes[0] // use the first content type specified in 'consumes'
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ApiClient) SelectHeaderAccept(accepts []string) string {
|
||||||
|
if (len(accepts) == 0){
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if contains(accepts,"application/json"){
|
||||||
|
return "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.Join(accepts,",")
|
||||||
|
}
|
||||||
|
|
||||||
|
func contains(source []string, containvalue string) bool {
|
||||||
|
for _, a := range source {
|
||||||
|
if strings.ToLower(a) == strings.ToLower(containvalue) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
@ -19,6 +19,7 @@ type Configuration struct {
|
|||||||
AccessToken string `json:"accessToken,omitempty"`
|
AccessToken string `json:"accessToken,omitempty"`
|
||||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||||
UserAgent string `json:"userAgent,omitempty"`
|
UserAgent string `json:"userAgent,omitempty"`
|
||||||
|
ApiClient ApiClient `json:"apiClient,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConfiguration() *Configuration {
|
func NewConfiguration() *Configuration {
|
||||||
|
@ -56,11 +56,27 @@ func (a PetApi) AddPet (body Pet) (error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
"application/json",
|
||||||
break // only use the first Accept
|
"application/xml",
|
||||||
|
}
|
||||||
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
// body params
|
// body params
|
||||||
@ -129,11 +145,25 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
// header params "api_key"
|
// header params "api_key"
|
||||||
_sling = _sling.Set("api_key", apiKey)
|
_sling = _sling.Set("api_key", apiKey)
|
||||||
@ -204,11 +234,25 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error) {
|
|||||||
Status []string `url:"status,omitempty"`
|
Status []string `url:"status,omitempty"`
|
||||||
}
|
}
|
||||||
_sling = _sling.QueryStruct(&QueryParams{ Status: status })
|
_sling = _sling.QueryStruct(&QueryParams{ Status: status })
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -277,11 +321,25 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error) {
|
|||||||
Tags []string `url:"tags,omitempty"`
|
Tags []string `url:"tags,omitempty"`
|
||||||
}
|
}
|
||||||
_sling = _sling.QueryStruct(&QueryParams{ Tags: tags })
|
_sling = _sling.QueryStruct(&QueryParams{ Tags: tags })
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -346,11 +404,25 @@ func (a PetApi) GetPetById (petId int64) (Pet, error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -415,11 +487,27 @@ func (a PetApi) UpdatePet (body Pet) (error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
"application/json",
|
||||||
break // only use the first Accept
|
"application/xml",
|
||||||
|
}
|
||||||
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
// body params
|
// body params
|
||||||
@ -489,11 +577,26 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (err
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
"application/x-www-form-urlencoded",
|
||||||
break // only use the first Accept
|
}
|
||||||
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
type FormParams struct {
|
type FormParams struct {
|
||||||
@ -566,11 +669,25 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
"multipart/form-data",
|
||||||
break // only use the first Accept
|
}
|
||||||
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
type FormParams struct {
|
type FormParams struct {
|
||||||
|
@ -50,11 +50,25 @@ func (a StoreApi) DeleteOrder (orderId string) (error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -117,11 +131,24 @@ func (a StoreApi) GetInventory () (map[string]int32, error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -181,11 +208,25 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -244,11 +285,25 @@ func (a StoreApi) PlaceOrder (body Order) (Order, error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
// body params
|
// body params
|
||||||
|
@ -49,11 +49,25 @@ func (a UserApi) CreateUser (body User) (error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
// body params
|
// body params
|
||||||
@ -114,11 +128,25 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
// body params
|
// body params
|
||||||
@ -179,11 +207,25 @@ func (a UserApi) CreateUsersWithListInput (body []User) (error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
// body params
|
// body params
|
||||||
@ -245,11 +287,25 @@ func (a UserApi) DeleteUser (username string) (error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -309,11 +365,25 @@ func (a UserApi) GetUserByName (username string) (User, error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -378,11 +448,25 @@ func (a UserApi) LoginUser (username string, password string) (string, error) {
|
|||||||
Password string `url:"password,omitempty"`
|
Password string `url:"password,omitempty"`
|
||||||
}
|
}
|
||||||
_sling = _sling.QueryStruct(&QueryParams{ Username: username,Password: password })
|
_sling = _sling.QueryStruct(&QueryParams{ Username: username,Password: password })
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -440,11 +524,25 @@ func (a UserApi) LogoutUser () (error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -505,11 +603,25 @@ func (a UserApi) UpdateUser (username string, body User) (error) {
|
|||||||
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
_sling = _sling.Set(key, a.Configuration.DefaultHeader[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept header
|
|
||||||
accepts := []string { "application/xml", "application/json" }
|
// to determine the Content-Type header
|
||||||
for key := range accepts {
|
localVarHttpContentTypes := []string {
|
||||||
_sling = _sling.Set("Accept", accepts[key])
|
}
|
||||||
break // only use the first Accept
|
//set Content-Type header
|
||||||
|
localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
_sling = _sling.Set("Content-Type", localVarHttpContentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string {
|
||||||
|
"application/xml",
|
||||||
|
"application/json",
|
||||||
|
}
|
||||||
|
//set Accept header
|
||||||
|
localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
_sling = _sling.Set("Accept", localVarHttpHeaderAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
// body params
|
// body params
|
||||||
|
Loading…
Reference in New Issue
Block a user