forked from loafle/openapi-generator-original
Merge pull request #2750 from neilotoole/issue-2748-formatting
Issue #2748 - generated code now conforms more closely to conventions
This commit is contained in:
commit
766c73497d
@ -28,11 +28,12 @@ func New{{classname}}WithBasePath(basePath string) *{{classname}}{
|
||||
Configuration: *configuration,
|
||||
}
|
||||
}
|
||||
|
||||
{{#operation}}
|
||||
|
||||
/**
|
||||
* {{summary}}
|
||||
* {{notes}}
|
||||
* {{summary}}{{#notes}}
|
||||
* {{notes}}{{/notes}}
|
||||
*
|
||||
{{#allParams}} * @param {{paramName}} {{description}}
|
||||
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
||||
*/
|
||||
@ -40,18 +41,13 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{
|
||||
|
||||
var httpMethod = "{{httpMethod}}"
|
||||
// create path and map variables
|
||||
path := a.Configuration.BasePath + "{{path}}"
|
||||
{{#pathParams}} path = strings.Replace(path, "{" + "{{baseName}}" + "}", fmt.Sprintf("%v", {{paramName}}), -1)
|
||||
{{/pathParams}}
|
||||
|
||||
{{#allParams}}
|
||||
{{#required}}
|
||||
path := a.Configuration.BasePath + "{{path}}"{{#pathParams}}
|
||||
path = strings.Replace(path, "{"+"{{baseName}}"+"}", fmt.Sprintf("%v", {{paramName}}), -1){{/pathParams}}
|
||||
{{#allParams}}{{#required}}
|
||||
// verify the required parameter '{{paramName}}' is set
|
||||
if &{{paramName}} == nil {
|
||||
return {{#returnType}}*new({{{returnType}}}), {{/returnType}}*NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
|
||||
}
|
||||
{{/required}}
|
||||
{{/allParams}}
|
||||
}{{/required}}{{/allParams}}
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := make(map[string]string)
|
||||
@ -59,48 +55,34 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{
|
||||
var postBody interface{}
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
{{#authMethods}}// authentication ({{name}}) required
|
||||
{{#authMethods}}
|
||||
// authentication ({{name}}) required
|
||||
{{#isApiKey}}{{#isKeyInHeader}}
|
||||
// set key with prefix in header
|
||||
headerParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}")
|
||||
{{/isKeyInHeader}}{{#isKeyInQuery}}
|
||||
// set key with prefix in querystring
|
||||
{{#hasKeyParamName}}
|
||||
// set key with prefix in querystring{{#hasKeyParamName}}
|
||||
queryParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}")
|
||||
{{/hasKeyParamName}}
|
||||
{{/isKeyInQuery}}{{/isApiKey}}
|
||||
{{#isBasic}}
|
||||
{{/hasKeyParamName}}{{/isKeyInQuery}}{{/isApiKey}}{{#isBasic}}
|
||||
// http basic authentication required
|
||||
if a.Configuration.Username != "" || a.Configuration.Password != ""{
|
||||
headerParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString()
|
||||
}
|
||||
{{/isBasic}}
|
||||
{{#isOAuth}}
|
||||
}{{/isBasic}}{{#isOAuth}}
|
||||
// oauth required
|
||||
if a.Configuration.AccessToken != ""{
|
||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||
}
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
|
||||
}{{/isOAuth}}{{/authMethods}}
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
}{{#hasQueryParams}}{{#queryParams}}
|
||||
|
||||
{{#hasQueryParams}}
|
||||
{{#queryParams}}
|
||||
queryParams["{{paramName}}"] = a.Configuration.APIClient.ParameterToString({{paramName}})
|
||||
{{/queryParams}}
|
||||
{{/hasQueryParams}}
|
||||
{{/queryParams}}{{/hasQueryParams}}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
{{#consumes}}
|
||||
"{{mediaType}}",
|
||||
{{/consumes}}
|
||||
}
|
||||
localVarHttpContentTypes := []string{ {{#consumes}}"{{mediaType}}", {{/consumes}} }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -108,43 +90,33 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{
|
||||
}
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
{{#produces}}
|
||||
"{{mediaType}}",
|
||||
{{/produces}}
|
||||
}
|
||||
{{#produces}}"{{mediaType}}",
|
||||
{{/produces}} }
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
{{#hasHeaderParams}}{{#headerParams}} // header params "{{baseName}}"
|
||||
}{{#hasHeaderParams}}
|
||||
|
||||
{{#headerParams}} // header params "{{baseName}}"
|
||||
headerParams["{{baseName}}"] = {{paramName}}
|
||||
{{/headerParams}}{{/hasHeaderParams}}
|
||||
{{#hasFormParams}}
|
||||
{{#formParams}}
|
||||
{{#isFile}}fbs, _ := ioutil.ReadAll(file)
|
||||
{{/headerParams}}{{/hasHeaderParams}}{{#hasFormParams}}
|
||||
{{#formParams}}{{#isFile}}
|
||||
fbs, _ := ioutil.ReadAll(file)
|
||||
fileBytes = fbs
|
||||
fileName = file.Name()
|
||||
{{/isFile}}
|
||||
{{^isFile}}formParams["{{paramName}}"] = {{paramName}}
|
||||
{{/isFile}}
|
||||
{{/formParams}}
|
||||
{{/hasFormParams}}{{#hasBodyParam}}{{#bodyParams}} // body params
|
||||
fileName = file.Name(){{/isFile}}
|
||||
{{^isFile}} formParams["{{paramName}}"] = {{paramName}}{{/isFile}}{{/formParams}}{{/hasFormParams}}{{#hasBodyParam}}
|
||||
{{#bodyParams}} // body params
|
||||
postBody = &{{paramName}}
|
||||
{{/bodyParams}}{{/hasBodyParam}}
|
||||
{{#returnType}} var successPayload = new({{returnType}}){{/returnType}}
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return {{#returnType}}*successPayload, {{/returnType}}*NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
{{#returnType}}
|
||||
|
||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||
{{/returnType}}
|
||||
|
||||
err = json.Unmarshal(httpResponse.Body(), &successPayload){{/returnType}}
|
||||
return {{#returnType}}*successPayload, {{/returnType}}*NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
{{/operation}}{{/operations}}
|
||||
|
@ -1,38 +1,37 @@
|
||||
package {{packageName}}
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"github.com/go-resty/resty"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/go-resty/resty"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
}
|
||||
|
||||
func (c *APIClient) SelectHeaderContentType(contentTypes []string) string {
|
||||
if (len(contentTypes) == 0){
|
||||
|
||||
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){
|
||||
|
||||
if len(accepts) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if contains(accepts, "application/json") {
|
||||
return "application/json"
|
||||
}
|
||||
|
||||
return strings.Join(accepts, ",")
|
||||
}
|
||||
|
||||
@ -45,7 +44,6 @@ func contains(source []string, containvalue string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
func (c *APIClient) CallAPI(path string, method string,
|
||||
postBody interface{},
|
||||
headerParams map[string]string,
|
||||
@ -97,7 +95,6 @@ func prepareRequest(postBody interface{},
|
||||
fileBytes []byte) *resty.Request {
|
||||
|
||||
request := resty.R()
|
||||
|
||||
request.SetBody(postBody)
|
||||
|
||||
// add header parameter, if any
|
||||
|
@ -4,21 +4,19 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
||||
type APIResponse struct {
|
||||
*http.Response
|
||||
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func NewAPIResponse(r *http.Response) *APIResponse {
|
||||
response := &APIResponse{Response: r}
|
||||
|
||||
response := &APIResponse{Response: r}
|
||||
return response
|
||||
}
|
||||
|
||||
func NewAPIResponseWithError(errorMessage string) *APIResponse {
|
||||
response := &APIResponse{Message: errorMessage}
|
||||
|
||||
response := &APIResponse{Message: errorMessage}
|
||||
return response
|
||||
}
|
@ -1,18 +1,14 @@
|
||||
package {{packageName}}
|
||||
|
||||
{{#models}}
|
||||
import (
|
||||
{{#imports}} "{{import}}"
|
||||
{{/imports}}
|
||||
{{#models}}{{#imports}}
|
||||
import ({{/imports}}{{#imports}}
|
||||
"{{import}}"{{/imports}}{{#imports}}
|
||||
)
|
||||
|
||||
{{#model}}
|
||||
{{#description}}// {{{description}}}{{/description}}
|
||||
{{/imports}}{{#model}}{{#description}}
|
||||
// {{{description}}}{{/description}}
|
||||
type {{classname}} struct {
|
||||
{{#vars}}
|
||||
{{#description}}// {{{description}}}{{/description}}
|
||||
{{#vars}}{{#description}}
|
||||
// {{{description}}}{{/description}}
|
||||
{{name}} {{{datatype}}} `json:"{{baseName}},omitempty"`
|
||||
{{/vars}}
|
||||
}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
{{/model}}{{/models}}
|
@ -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-04-27T21:14:49.805-07:00
|
||||
- Build date: 2016-05-02T15:51:26.331+01:00
|
||||
- Build package: class io.swagger.codegen.languages.GoClientCodegen
|
||||
|
||||
## Installation
|
||||
|
@ -1,38 +1,37 @@
|
||||
package petstore
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"github.com/go-resty/resty"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/go-resty/resty"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
}
|
||||
|
||||
func (c *APIClient) SelectHeaderContentType(contentTypes []string) string {
|
||||
if (len(contentTypes) == 0){
|
||||
|
||||
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){
|
||||
|
||||
if len(accepts) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if contains(accepts, "application/json") {
|
||||
return "application/json"
|
||||
}
|
||||
|
||||
return strings.Join(accepts, ",")
|
||||
}
|
||||
|
||||
@ -45,7 +44,6 @@ func contains(source []string, containvalue string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
func (c *APIClient) CallAPI(path string, method string,
|
||||
postBody interface{},
|
||||
headerParams map[string]string,
|
||||
@ -97,7 +95,6 @@ func prepareRequest(postBody interface{},
|
||||
fileBytes []byte) *resty.Request {
|
||||
|
||||
request := resty.R()
|
||||
|
||||
request.SetBody(postBody)
|
||||
|
||||
// add header parameter, if any
|
||||
|
@ -4,21 +4,19 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
||||
type APIResponse struct {
|
||||
*http.Response
|
||||
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func NewAPIResponse(r *http.Response) *APIResponse {
|
||||
response := &APIResponse{Response: r}
|
||||
|
||||
response := &APIResponse{Response: r}
|
||||
return response
|
||||
}
|
||||
|
||||
func NewAPIResponseWithError(errorMessage string) *APIResponse {
|
||||
response := &APIResponse{Message: errorMessage}
|
||||
|
||||
response := &APIResponse{Message: errorMessage}
|
||||
return response
|
||||
}
|
@ -1,9 +1,5 @@
|
||||
package petstore
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
|
||||
type Category struct {
|
||||
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
@ -8,12 +8,12 @@ git_repo_id=$2
|
||||
release_note=$3
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="YOUR_GIT_USR_ID"
|
||||
git_user_id="GIT_USER_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="YOUR_GIT_REPO_ID"
|
||||
git_repo_id="GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
|
@ -1,9 +1,5 @@
|
||||
package petstore
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
|
||||
type ModelApiResponse struct {
|
||||
|
||||
Code int32 `json:"code,omitempty"`
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
|
||||
type Order struct {
|
||||
|
||||
Id int64 `json:"id,omitempty"`
|
||||
@ -14,6 +13,7 @@ type Order struct {
|
||||
Quantity int32 `json:"quantity,omitempty"`
|
||||
|
||||
ShipDate time.Time `json:"shipDate,omitempty"`
|
||||
|
||||
// Order Status
|
||||
Status string `json:"status,omitempty"`
|
||||
|
||||
|
@ -1,9 +1,5 @@
|
||||
package petstore
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
|
||||
type Pet struct {
|
||||
|
||||
Id int64 `json:"id,omitempty"`
|
||||
@ -15,6 +11,7 @@ type Pet struct {
|
||||
PhotoUrls []string `json:"photoUrls,omitempty"`
|
||||
|
||||
Tags []Tag `json:"tags,omitempty"`
|
||||
|
||||
// pet status in the store
|
||||
Status string `json:"status,omitempty"`
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ func NewPetApiWithBasePath(basePath string) *PetApi{
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @return void
|
||||
*/
|
||||
@ -52,25 +53,20 @@ func (a PetApi) AddPet (body Pet) (APIResponse, error) {
|
||||
var postBody interface{}
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if a.Configuration.AccessToken != ""{
|
||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||
}
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
"application/json",
|
||||
"application/xml",
|
||||
}
|
||||
localVarHttpContentTypes := []string{ "application/json", "application/xml", }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -81,28 +77,28 @@ func (a PetApi) AddPet (body Pet) (APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
// body params
|
||||
postBody = &body
|
||||
|
||||
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
*
|
||||
* @param petId Pet id to delete
|
||||
* @param apiKey
|
||||
* @return void
|
||||
@ -125,23 +121,20 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (APIResponse, error) {
|
||||
var postBody interface{}
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if a.Configuration.AccessToken != ""{
|
||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||
}
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -152,28 +145,29 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
// header params "api_key"
|
||||
headerParams["api_key"] = apiKey
|
||||
|
||||
|
||||
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
*
|
||||
* @param status Status values that need to be considered for filter
|
||||
* @return []Pet
|
||||
*/
|
||||
@ -194,14 +188,12 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, APIResponse, error) {
|
||||
var postBody interface{}
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if a.Configuration.AccessToken != ""{
|
||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||
}
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
@ -209,9 +201,10 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, APIResponse, error) {
|
||||
|
||||
queryParams["status"] = a.Configuration.APIClient.ParameterToString(status)
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -222,28 +215,25 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new([]Pet)
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
*
|
||||
* @param tags Tags to filter by
|
||||
* @return []Pet
|
||||
*/
|
||||
@ -264,14 +254,12 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, APIResponse, error) {
|
||||
var postBody interface{}
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if a.Configuration.AccessToken != ""{
|
||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||
}
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
@ -279,9 +267,10 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, APIResponse, error) {
|
||||
|
||||
queryParams["tags"] = a.Configuration.APIClient.ParameterToString(tags)
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -292,28 +281,25 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new([]Pet)
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
* Returns a single pet
|
||||
*
|
||||
* @param petId ID of pet to return
|
||||
* @return Pet
|
||||
*/
|
||||
@ -335,22 +321,19 @@ func (a PetApi) GetPetById (petId int64) (Pet, APIResponse, error) {
|
||||
var postBody interface{}
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
// authentication (api_key) required
|
||||
|
||||
// set key with prefix in header
|
||||
headerParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key")
|
||||
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -361,28 +344,25 @@ func (a PetApi) GetPetById (petId int64) (Pet, APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new(Pet)
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @return void
|
||||
*/
|
||||
@ -403,25 +383,20 @@ func (a PetApi) UpdatePet (body Pet) (APIResponse, error) {
|
||||
var postBody interface{}
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if a.Configuration.AccessToken != ""{
|
||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||
}
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
"application/json",
|
||||
"application/xml",
|
||||
}
|
||||
localVarHttpContentTypes := []string{ "application/json", "application/xml", }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -432,28 +407,28 @@ func (a PetApi) UpdatePet (body Pet) (APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
// body params
|
||||
postBody = &body
|
||||
|
||||
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
*
|
||||
* @param petId ID of pet that needs to be updated
|
||||
* @param name Updated name of the pet
|
||||
* @param status Updated status of the pet
|
||||
@ -477,24 +452,20 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (API
|
||||
var postBody interface{}
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if a.Configuration.AccessToken != ""{
|
||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||
}
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
"application/x-www-form-urlencoded",
|
||||
}
|
||||
localVarHttpContentTypes := []string{ "application/x-www-form-urlencoded", }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -505,6 +476,7 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (API
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
@ -514,19 +486,18 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (API
|
||||
formParams["name"] = name
|
||||
formParams["status"] = status
|
||||
|
||||
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
*
|
||||
* @param petId ID of pet to update
|
||||
* @param additionalMetadata Additional data to pass to server
|
||||
* @param file file to upload
|
||||
@ -550,24 +521,20 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil
|
||||
var postBody interface{}
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if a.Configuration.AccessToken != ""{
|
||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||
}
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
"multipart/form-data",
|
||||
}
|
||||
localVarHttpContentTypes := []string{ "multipart/form-data", }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -577,6 +544,7 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
@ -590,13 +558,10 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil
|
||||
|
||||
var successPayload = new(ModelApiResponse)
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ func NewStoreApiWithBasePath(basePath string) *StoreApi{
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
*
|
||||
* @param orderId ID of the order that needs to be deleted
|
||||
* @return void
|
||||
*/
|
||||
@ -52,16 +53,14 @@ func (a StoreApi) DeleteOrder (orderId string) (APIResponse, error) {
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -72,26 +71,25 @@ func (a StoreApi) DeleteOrder (orderId string) (APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
|
||||
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
* Returns a map of status codes to quantities
|
||||
*
|
||||
* @return map[string]int32
|
||||
*/
|
||||
func (a StoreApi) GetInventory() (map[string]int32, APIResponse, error) {
|
||||
@ -107,22 +105,19 @@ func (a StoreApi) GetInventory () (map[string]int32, APIResponse, error) {
|
||||
var postBody interface{}
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
// authentication (api_key) required
|
||||
|
||||
// set key with prefix in header
|
||||
headerParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key")
|
||||
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -132,28 +127,25 @@ func (a StoreApi) GetInventory () (map[string]int32, APIResponse, error) {
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new(map[string]int32)
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
*
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
* @return Order
|
||||
*/
|
||||
@ -176,16 +168,14 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, APIResponse, error) {
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -196,28 +186,25 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new(Order)
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
*
|
||||
* @param body order placed for purchasing the pet
|
||||
* @return Order
|
||||
*/
|
||||
@ -239,16 +226,14 @@ func (a StoreApi) PlaceOrder (body Order) (Order, APIResponse, error) {
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -259,24 +244,21 @@ func (a StoreApi) PlaceOrder (body Order) (Order, APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
// body params
|
||||
postBody = &body
|
||||
|
||||
var successPayload = new(Order)
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,5 @@
|
||||
package petstore
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
|
||||
type Tag struct {
|
||||
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
@ -1,9 +1,5 @@
|
||||
package petstore
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
|
||||
type User struct {
|
||||
|
||||
Id int64 `json:"id,omitempty"`
|
||||
@ -19,6 +15,7 @@ type User struct {
|
||||
Password string `json:"password,omitempty"`
|
||||
|
||||
Phone string `json:"phone,omitempty"`
|
||||
|
||||
// User Status
|
||||
UserStatus int32 `json:"userStatus,omitempty"`
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ func NewUserApiWithBasePath(basePath string) *UserApi{
|
||||
/**
|
||||
* Create user
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @param body Created user object
|
||||
* @return void
|
||||
*/
|
||||
@ -51,16 +52,14 @@ func (a UserApi) CreateUser (body User) (APIResponse, error) {
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -71,28 +70,28 @@ func (a UserApi) CreateUser (body User) (APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
// body params
|
||||
postBody = &body
|
||||
|
||||
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
*
|
||||
* @param body List of user object
|
||||
* @return void
|
||||
*/
|
||||
@ -114,16 +113,14 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (APIResponse, error) {
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -134,28 +131,28 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
// body params
|
||||
postBody = &body
|
||||
|
||||
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
*
|
||||
* @param body List of user object
|
||||
* @return void
|
||||
*/
|
||||
@ -177,16 +174,14 @@ func (a UserApi) CreateUsersWithListInput (body []User) (APIResponse, error) {
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -197,28 +192,28 @@ func (a UserApi) CreateUsersWithListInput (body []User) (APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
// body params
|
||||
postBody = &body
|
||||
|
||||
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @param username The name that needs to be deleted
|
||||
* @return void
|
||||
*/
|
||||
@ -241,16 +236,14 @@ func (a UserApi) DeleteUser (username string) (APIResponse, error) {
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -261,26 +254,25 @@ func (a UserApi) DeleteUser (username string) (APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
|
||||
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
*
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
* @return User
|
||||
*/
|
||||
@ -303,16 +295,14 @@ func (a UserApi) GetUserByName (username string) (User, APIResponse, error) {
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -323,28 +313,25 @@ func (a UserApi) GetUserByName (username string) (User, APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new(User)
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
*
|
||||
*
|
||||
* @param username The user name for login
|
||||
* @param password The password for login in clear text
|
||||
* @return string
|
||||
@ -371,18 +358,20 @@ func (a UserApi) LoginUser (username string, password string) (string, APIRespon
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
queryParams["username"] = a.Configuration.APIClient.ParameterToString(username)
|
||||
|
||||
|
||||
queryParams["password"] = a.Configuration.APIClient.ParameterToString(password)
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -393,28 +382,25 @@ func (a UserApi) LoginUser (username string, password string) (string, APIRespon
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new(string)
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||
|
||||
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
func (a UserApi) LogoutUser() (APIResponse, error) {
|
||||
@ -431,16 +417,14 @@ func (a UserApi) LogoutUser () (APIResponse, error) {
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -451,26 +435,25 @@ func (a UserApi) LogoutUser () (APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
|
||||
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @param username name that need to be deleted
|
||||
* @param body Updated user object
|
||||
* @return void
|
||||
@ -498,16 +481,14 @@ func (a UserApi) UpdateUser (username string, body User) (APIResponse, error) {
|
||||
var fileName string
|
||||
var fileBytes []byte
|
||||
|
||||
|
||||
// add default headers if any
|
||||
for key := range a.Configuration.DefaultHeader {
|
||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||
}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string {
|
||||
}
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
@ -518,22 +499,21 @@ func (a UserApi) UpdateUser (username string, body User) (APIResponse, error) {
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
|
||||
// body params
|
||||
postBody = &body
|
||||
|
||||
|
||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user