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