[Go] prefix go local var with localVar (#3570)

* prefix go local var with localVar

* remove pom from go, minor fix to headerParams
This commit is contained in:
wing328 2016-08-10 16:14:33 +08:00 committed by GitHub
parent 7827298e56
commit d2d5553a45
7 changed files with 355 additions and 452 deletions

View File

@ -147,7 +147,6 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
supportingFiles.add(new SupportingFile("api_client.mustache", "", "api_client.go"));
supportingFiles.add(new SupportingFile("api_response.mustache", "", "api_response.go"));
supportingFiles.add(new SupportingFile(".travis.yml", "", ".travis.yml"));
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
}

View File

@ -38,46 +38,45 @@ func New{{classname}}WithBasePath(basePath string) *{{classname}} {
*/
func (a {{{classname}}}) {{{nickname}}}({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{^isListContainer}}*{{/isListContainer}}{{{returnType}}}, {{/returnType}}*APIResponse, error) {
var httpMethod = "{{httpMethod}}"
var localVarHttpMethod = "{{httpMethod}}"
// create path and map variables
path := a.Configuration.BasePath + "{{path}}"{{#pathParams}}
path = strings.Replace(path, "{"+"{{baseName}}"+"}", fmt.Sprintf("%v", {{paramName}}), -1){{/pathParams}}
localVarPath := a.Configuration.BasePath + "{{path}}"{{#pathParams}}
localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", fmt.Sprintf("%v", {{paramName}}), -1){{/pathParams}}
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
{{#authMethods}}
// authentication '({{name}})' required
{{#isApiKey}}
{{#isKeyInHeader}}
// set key with prefix in header
headerParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}")
localVarHeaderParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}")
{{/isKeyInHeader}}
{{#isKeyInQuery}}
// set key with prefix in query string
queryParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}")
localVarQueryParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}")
{{/isKeyInQuery}}
{{/isApiKey}}
{{#isBasic}}
// http basic authentication required
if a.Configuration.Username != "" || a.Configuration.Password != ""{
headerParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString()
localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString()
}
{{/isBasic}}
{{#isOAuth}}
// oauth required
if a.Configuration.AccessToken != ""{
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
}
{{/isOAuth}}
{{/authMethods}}
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
{{#hasQueryParams}}
{{#queryParams}}
@ -85,14 +84,14 @@ func (a {{{classname}}}) {{{nickname}}}({{#allParams}}{{paramName}} {{{dataType}
var collectionFormat = "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"
if collectionFormat == "multi" {
for _, value := range {{paramName}} {
queryParams.Add("{{baseName}}", value)
localVarQueryParams.Add("{{baseName}}", value)
}
} else {
queryParams.Add("{{baseName}}", a.Configuration.APIClient.ParameterToString({{paramName}}, collectionFormat))
localVarQueryParams.Add("{{baseName}}", a.Configuration.APIClient.ParameterToString({{paramName}}, collectionFormat))
}
{{/isListContainer}}
{{^isListContainer}}
queryParams.Add("{{baseName}}", a.Configuration.APIClient.ParameterToString({{paramName}}, ""))
localVarQueryParams.Add("{{baseName}}", a.Configuration.APIClient.ParameterToString({{paramName}}, ""))
{{/isListContainer}}
{{/queryParams}}{{/hasQueryParams}}
@ -102,7 +101,7 @@ func (a {{{classname}}}) {{{nickname}}}({{#allParams}}{{paramName}} {{{dataType}
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -112,27 +111,27 @@ func (a {{{classname}}}) {{{nickname}}}({{#allParams}}{{paramName}} {{{dataType}
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}{{#hasHeaderParams}}
{{#headerParams}} // header params "{{baseName}}"
headerParams["{{baseName}}"] = {{paramName}}
localVarHeaderParams["{{baseName}}"] = {{paramName}}
{{/headerParams}}{{/hasHeaderParams}}{{#hasFormParams}}
{{#formParams}}{{#isFile}}
fbs, _ := ioutil.ReadAll(file)
fileBytes = fbs
fileName = file.Name(){{/isFile}}
{{^isFile}} formParams["{{paramName}}"] = {{paramName}}{{/isFile}}{{/formParams}}{{/hasFormParams}}{{#hasBodyParam}}
localVarFileBytes = fbs
localVarFileName = file.Name(){{/isFile}}
{{^isFile}} localVarFormParams["{{paramName}}"] = {{paramName}}{{/isFile}}{{/formParams}}{{/hasFormParams}}{{#hasBodyParam}}
{{#bodyParams}} // body params
postBody = &{{paramName}}
localVarPostBody = &{{paramName}}
{{/bodyParams}}{{/hasBodyParam}}
{{#returnType}} var successPayload = new({{returnType}}){{/returnType}}
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err
return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}successPayload, {{/returnType}}NewAPIResponse(localVarHttpResponse.RawResponse), err
}
{{#returnType}}
err = json.Unmarshal(httpResponse.Body(), &successPayload){{/returnType}}
return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload){{/returnType}}
return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}successPayload, {{/returnType}}NewAPIResponse(localVarHttpResponse.RawResponse), err
}
{{/operation}}{{/operations}}

View File

@ -1,75 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.wordnik</groupId>
<artifactId>Go{{packageName}}</artifactId>
<packaging>pom</packaging>
<version>{{packageVersion}}</version>
<name>Go{{packageName}}</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>go-get-testify</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>go</executable>
<arguments>
<argument>get</argument>
<argument>github.com/stretchr/testify/assert</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>go-get-sling</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>go</executable>
<arguments>
<argument>get</argument>
<argument>github.com/dghubble/sling</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>go-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>go</executable>
<arguments>
<argument>test</argument>
<argument>-v</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -7,7 +7,7 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-07-28T00:24:08.914+08:00
- Build date: 2016-08-10T15:46:53.636+08:00
- Build package: class io.swagger.codegen.languages.GoClientCodegen
## Installation

View File

@ -60,25 +60,24 @@ func NewPetApiWithBasePath(basePath string) *PetApi {
*/
func (a PetApi) AddPet(body Pet) (*APIResponse, error) {
var httpMethod = "Post"
var localVarHttpMethod = "Post"
// create path and map variables
path := a.Configuration.BasePath + "/pet"
localVarPath := a.Configuration.BasePath + "/pet"
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// authentication '(petstore_auth)' required
// oauth required
if a.Configuration.AccessToken != ""{
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
}
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -88,7 +87,7 @@ func (a PetApi) AddPet(body Pet) (*APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -99,18 +98,18 @@ func (a PetApi) AddPet(body Pet) (*APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
// body params
postBody = &body
localVarPostBody = &body
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -123,26 +122,25 @@ func (a PetApi) AddPet(body Pet) (*APIResponse, error) {
*/
func (a PetApi) DeletePet(petId int64, apiKey string) (*APIResponse, error) {
var httpMethod = "Delete"
var localVarHttpMethod = "Delete"
// create path and map variables
path := a.Configuration.BasePath + "/pet/{petId}"
path = strings.Replace(path, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath := a.Configuration.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// authentication '(petstore_auth)' required
// oauth required
if a.Configuration.AccessToken != ""{
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
}
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -152,7 +150,7 @@ func (a PetApi) DeletePet(petId int64, apiKey string) (*APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -163,19 +161,19 @@ func (a PetApi) DeletePet(petId int64, apiKey string) (*APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
// header params "api_key"
headerParams["api_key"] = apiKey
localVarHeaderParams["api_key"] = apiKey
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -187,33 +185,32 @@ func (a PetApi) DeletePet(petId int64, apiKey string) (*APIResponse, error) {
*/
func (a PetApi) FindPetsByStatus(status []string) ([]Pet, *APIResponse, error) {
var httpMethod = "Get"
var localVarHttpMethod = "Get"
// create path and map variables
path := a.Configuration.BasePath + "/pet/findByStatus"
localVarPath := a.Configuration.BasePath + "/pet/findByStatus"
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// authentication '(petstore_auth)' required
// oauth required
if a.Configuration.AccessToken != ""{
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
}
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
var collectionFormat = "csv"
if collectionFormat == "multi" {
for _, value := range status {
queryParams.Add("status", value)
localVarQueryParams.Add("status", value)
}
} else {
queryParams.Add("status", a.Configuration.APIClient.ParameterToString(status, collectionFormat))
localVarQueryParams.Add("status", a.Configuration.APIClient.ParameterToString(status, collectionFormat))
}
@ -223,7 +220,7 @@ func (a PetApi) FindPetsByStatus(status []string) ([]Pet, *APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -234,15 +231,15 @@ func (a PetApi) FindPetsByStatus(status []string) ([]Pet, *APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
var successPayload = new([]Pet)
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return *successPayload, NewAPIResponse(httpResponse.RawResponse), err
return *successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return *successPayload, NewAPIResponse(httpResponse.RawResponse), err
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return *successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -254,33 +251,32 @@ func (a PetApi) FindPetsByStatus(status []string) ([]Pet, *APIResponse, error) {
*/
func (a PetApi) FindPetsByTags(tags []string) ([]Pet, *APIResponse, error) {
var httpMethod = "Get"
var localVarHttpMethod = "Get"
// create path and map variables
path := a.Configuration.BasePath + "/pet/findByTags"
localVarPath := a.Configuration.BasePath + "/pet/findByTags"
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// authentication '(petstore_auth)' required
// oauth required
if a.Configuration.AccessToken != ""{
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
}
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
var collectionFormat = "csv"
if collectionFormat == "multi" {
for _, value := range tags {
queryParams.Add("tags", value)
localVarQueryParams.Add("tags", value)
}
} else {
queryParams.Add("tags", a.Configuration.APIClient.ParameterToString(tags, collectionFormat))
localVarQueryParams.Add("tags", a.Configuration.APIClient.ParameterToString(tags, collectionFormat))
}
@ -290,7 +286,7 @@ func (a PetApi) FindPetsByTags(tags []string) ([]Pet, *APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -301,15 +297,15 @@ func (a PetApi) FindPetsByTags(tags []string) ([]Pet, *APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
var successPayload = new([]Pet)
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return *successPayload, NewAPIResponse(httpResponse.RawResponse), err
return *successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return *successPayload, NewAPIResponse(httpResponse.RawResponse), err
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return *successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -321,24 +317,23 @@ func (a PetApi) FindPetsByTags(tags []string) ([]Pet, *APIResponse, error) {
*/
func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) {
var httpMethod = "Get"
var localVarHttpMethod = "Get"
// create path and map variables
path := a.Configuration.BasePath + "/pet/{petId}"
path = strings.Replace(path, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath := a.Configuration.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// authentication '(api_key)' required
// set key with prefix in header
headerParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key")
localVarHeaderParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key")
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -348,7 +343,7 @@ func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -359,15 +354,15 @@ func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
var successPayload = new(Pet)
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -379,25 +374,24 @@ func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) {
*/
func (a PetApi) UpdatePet(body Pet) (*APIResponse, error) {
var httpMethod = "Put"
var localVarHttpMethod = "Put"
// create path and map variables
path := a.Configuration.BasePath + "/pet"
localVarPath := a.Configuration.BasePath + "/pet"
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// authentication '(petstore_auth)' required
// oauth required
if a.Configuration.AccessToken != ""{
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
}
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -407,7 +401,7 @@ func (a PetApi) UpdatePet(body Pet) (*APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -418,18 +412,18 @@ func (a PetApi) UpdatePet(body Pet) (*APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
// body params
postBody = &body
localVarPostBody = &body
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -443,26 +437,25 @@ func (a PetApi) UpdatePet(body Pet) (*APIResponse, error) {
*/
func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (*APIResponse, error) {
var httpMethod = "Post"
var localVarHttpMethod = "Post"
// create path and map variables
path := a.Configuration.BasePath + "/pet/{petId}"
path = strings.Replace(path, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath := a.Configuration.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// authentication '(petstore_auth)' required
// oauth required
if a.Configuration.AccessToken != ""{
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
}
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -472,7 +465,7 @@ func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (*API
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -483,18 +476,18 @@ func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (*API
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
formParams["name"] = name
formParams["status"] = status
localVarFormParams["name"] = name
localVarFormParams["status"] = status
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -508,26 +501,25 @@ func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (*API
*/
func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File) (*ModelApiResponse, *APIResponse, error) {
var httpMethod = "Post"
var localVarHttpMethod = "Post"
// create path and map variables
path := a.Configuration.BasePath + "/pet/{petId}/uploadImage"
path = strings.Replace(path, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
localVarPath := a.Configuration.BasePath + "/pet/{petId}/uploadImage"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// authentication '(petstore_auth)' required
// oauth required
if a.Configuration.AccessToken != ""{
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
localVarHeaderParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
}
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -537,7 +529,7 @@ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -547,20 +539,20 @@ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
formParams["additionalMetadata"] = additionalMetadata
localVarFormParams["additionalMetadata"] = additionalMetadata
fbs, _ := ioutil.ReadAll(file)
fileBytes = fbs
fileName = file.Name()
localVarFileBytes = fbs
localVarFileName = file.Name()
var successPayload = new(ModelApiResponse)
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}

View File

@ -58,21 +58,20 @@ func NewStoreApiWithBasePath(basePath string) *StoreApi {
*/
func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error) {
var httpMethod = "Delete"
var localVarHttpMethod = "Delete"
// create path and map variables
path := a.Configuration.BasePath + "/store/order/{orderId}"
path = strings.Replace(path, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1)
localVarPath := a.Configuration.BasePath + "/store/order/{orderId}"
localVarPath = strings.Replace(localVarPath, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1)
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -82,7 +81,7 @@ func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -93,15 +92,15 @@ func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -112,23 +111,22 @@ func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error) {
*/
func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) {
var httpMethod = "Get"
var localVarHttpMethod = "Get"
// create path and map variables
path := a.Configuration.BasePath + "/store/inventory"
localVarPath := a.Configuration.BasePath + "/store/inventory"
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// authentication '(api_key)' required
// set key with prefix in header
headerParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key")
localVarHeaderParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key")
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -138,7 +136,7 @@ func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -148,15 +146,15 @@ func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
var successPayload = new(map[string]int32)
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -168,21 +166,20 @@ func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) {
*/
func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) {
var httpMethod = "Get"
var localVarHttpMethod = "Get"
// create path and map variables
path := a.Configuration.BasePath + "/store/order/{orderId}"
path = strings.Replace(path, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1)
localVarPath := a.Configuration.BasePath + "/store/order/{orderId}"
localVarPath = strings.Replace(localVarPath, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1)
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -192,7 +189,7 @@ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -203,15 +200,15 @@ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
var successPayload = new(Order)
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -223,20 +220,19 @@ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) {
*/
func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error) {
var httpMethod = "Post"
var localVarHttpMethod = "Post"
// create path and map variables
path := a.Configuration.BasePath + "/store/order"
localVarPath := a.Configuration.BasePath + "/store/order"
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -246,7 +242,7 @@ func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -257,17 +253,17 @@ func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
// body params
postBody = &body
localVarPostBody = &body
var successPayload = new(Order)
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}

View File

@ -58,20 +58,19 @@ func NewUserApiWithBasePath(basePath string) *UserApi {
*/
func (a UserApi) CreateUser(body User) (*APIResponse, error) {
var httpMethod = "Post"
var localVarHttpMethod = "Post"
// create path and map variables
path := a.Configuration.BasePath + "/user"
localVarPath := a.Configuration.BasePath + "/user"
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -81,7 +80,7 @@ func (a UserApi) CreateUser(body User) (*APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -92,18 +91,18 @@ func (a UserApi) CreateUser(body User) (*APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
// body params
postBody = &body
localVarPostBody = &body
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -115,20 +114,19 @@ func (a UserApi) CreateUser(body User) (*APIResponse, error) {
*/
func (a UserApi) CreateUsersWithArrayInput(body []User) (*APIResponse, error) {
var httpMethod = "Post"
var localVarHttpMethod = "Post"
// create path and map variables
path := a.Configuration.BasePath + "/user/createWithArray"
localVarPath := a.Configuration.BasePath + "/user/createWithArray"
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -138,7 +136,7 @@ func (a UserApi) CreateUsersWithArrayInput(body []User) (*APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -149,18 +147,18 @@ func (a UserApi) CreateUsersWithArrayInput(body []User) (*APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
// body params
postBody = &body
localVarPostBody = &body
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -172,20 +170,19 @@ func (a UserApi) CreateUsersWithArrayInput(body []User) (*APIResponse, error) {
*/
func (a UserApi) CreateUsersWithListInput(body []User) (*APIResponse, error) {
var httpMethod = "Post"
var localVarHttpMethod = "Post"
// create path and map variables
path := a.Configuration.BasePath + "/user/createWithList"
localVarPath := a.Configuration.BasePath + "/user/createWithList"
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -195,7 +192,7 @@ func (a UserApi) CreateUsersWithListInput(body []User) (*APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -206,18 +203,18 @@ func (a UserApi) CreateUsersWithListInput(body []User) (*APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
// body params
postBody = &body
localVarPostBody = &body
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -229,21 +226,20 @@ func (a UserApi) CreateUsersWithListInput(body []User) (*APIResponse, error) {
*/
func (a UserApi) DeleteUser(username string) (*APIResponse, error) {
var httpMethod = "Delete"
var localVarHttpMethod = "Delete"
// create path and map variables
path := a.Configuration.BasePath + "/user/{username}"
path = strings.Replace(path, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarPath := a.Configuration.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -253,7 +249,7 @@ func (a UserApi) DeleteUser(username string) (*APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -264,15 +260,15 @@ func (a UserApi) DeleteUser(username string) (*APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -284,21 +280,20 @@ func (a UserApi) DeleteUser(username string) (*APIResponse, error) {
*/
func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) {
var httpMethod = "Get"
var localVarHttpMethod = "Get"
// create path and map variables
path := a.Configuration.BasePath + "/user/{username}"
path = strings.Replace(path, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarPath := a.Configuration.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -308,7 +303,7 @@ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -319,15 +314,15 @@ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
var successPayload = new(User)
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -340,23 +335,22 @@ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) {
*/
func (a UserApi) LoginUser(username string, password string) (*string, *APIResponse, error) {
var httpMethod = "Get"
var localVarHttpMethod = "Get"
// create path and map variables
path := a.Configuration.BasePath + "/user/login"
localVarPath := a.Configuration.BasePath + "/user/login"
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
queryParams.Add("username", a.Configuration.APIClient.ParameterToString(username, ""))
queryParams.Add("password", a.Configuration.APIClient.ParameterToString(password, ""))
localVarQueryParams.Add("username", a.Configuration.APIClient.ParameterToString(username, ""))
localVarQueryParams.Add("password", a.Configuration.APIClient.ParameterToString(password, ""))
// to determine the Content-Type header
@ -365,7 +359,7 @@ func (a UserApi) LoginUser(username string, password string) (*string, *APIRespo
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -376,15 +370,15 @@ func (a UserApi) LoginUser(username string, password string) (*string, *APIRespo
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
var successPayload = new(string)
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
err = json.Unmarshal(httpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -395,20 +389,19 @@ func (a UserApi) LoginUser(username string, password string) (*string, *APIRespo
*/
func (a UserApi) LogoutUser() (*APIResponse, error) {
var httpMethod = "Get"
var localVarHttpMethod = "Get"
// create path and map variables
path := a.Configuration.BasePath + "/user/logout"
localVarPath := a.Configuration.BasePath + "/user/logout"
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -418,7 +411,7 @@ func (a UserApi) LogoutUser() (*APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -429,15 +422,15 @@ func (a UserApi) LogoutUser() (*APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
/**
@ -450,21 +443,20 @@ func (a UserApi) LogoutUser() (*APIResponse, error) {
*/
func (a UserApi) UpdateUser(username string, body User) (*APIResponse, error) {
var httpMethod = "Put"
var localVarHttpMethod = "Put"
// create path and map variables
path := a.Configuration.BasePath + "/user/{username}"
path = strings.Replace(path, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarPath := a.Configuration.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any
for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key]
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
@ -474,7 +466,7 @@ func (a UserApi) UpdateUser(username string, body User) (*APIResponse, error) {
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
@ -485,17 +477,17 @@ func (a UserApi) UpdateUser(username string, body User) (*APIResponse, error) {
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
// body params
postBody = &body
localVarPostBody = &body
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}
return NewAPIResponse(httpResponse.RawResponse), err
return NewAPIResponse(localVarHttpResponse.RawResponse), err
}