forked from loafle/openapi-generator-original
[go] Fix go client formatting (#7283)
* Fix some go client formatting issues * Fix go client go imports * Run `goimports -w .` on examples directory * Sort imports in api * Add new line between each property Before secret feature was used to add new line using two property declaration in the same line. There should be no new line before first property. The easiest way is to use `-first` special property https://github.com/samskivert/jmustache#-first-and--last New line are required so `goimports` won't reformat whitespaces between property name and type. * Change whitespaces to tabs * Fix whitespaces in api_client There is a new line between each service to prevent `goimports` from adding whitespaces between types and names * Fix more whitespaces There was a need to set special delimeter for formatting in the commit. Go slices use curly braces and `jmustache` got confused when found triple curly braces. * Fix whitespaces in configuration.mustache * Fix whitespaces for api response * Support for optional description Do not add whitespace if description is missing * Add new lines between enum values to prevent formatting * Generate go code from current code - imports are not sorted :( - there are extra whitespaces for different languages. I don't know why * Run generate for security tests
This commit is contained in:
parent
6afc0e9344
commit
919f867eba
@ -4,8 +4,8 @@ package {{packageName}}
|
||||
{{#operations}}
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
{{#imports}} "{{import}}"
|
||||
@ -18,24 +18,23 @@ var (
|
||||
)
|
||||
|
||||
type {{classname}}Service service
|
||||
|
||||
{{#operation}}
|
||||
|
||||
/* {{{classname}}}Service {{summary}}{{#notes}}
|
||||
{{notes}}{{/notes}}
|
||||
/* {{{classname}}}Service{{#summary}} {{.}}{{/summary}}{{#notes}}
|
||||
{{notes}}{{/notes}}
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
{{#allParams}}{{#required}} @param {{paramName}} {{description}}
|
||||
{{/required}}{{/allParams}}{{#hasOptionalParams}} @param optional (nil or map[string]interface{}) with one or more of:
|
||||
{{#allParams}}{{^required}} @param "{{paramName}}" ({{dataType}}) {{description}}
|
||||
{{/required}}{{/allParams}}{{/hasOptionalParams}} @return {{#returnType}}{{{returnType}}}{{/returnType}}*/
|
||||
func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals map[string]interface{}{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}} *http.Response, error) {
|
||||
{{#allParams}}{{#required}}@param {{paramName}}{{#description}} {{.}}{{/description}}
|
||||
{{/required}}{{/allParams}}{{#hasOptionalParams}}@param optional (nil or map[string]interface{}) with one or more of:
|
||||
{{#allParams}}{{^required}} @param "{{paramName}}" ({{dataType}}){{#description}} {{.}}{{/description}}
|
||||
{{/required}}{{/allParams}}{{/hasOptionalParams}}@return {{#returnType}}{{{returnType}}}{{/returnType}}*/
|
||||
func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals map[string]interface{}{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("{{httpMethod}}")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
{{#returnType}}
|
||||
successPayload {{returnType}}
|
||||
successPayload {{returnType}}
|
||||
{{/returnType}}
|
||||
)
|
||||
|
||||
@ -46,7 +45,6 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
{{#allParams}}
|
||||
{{^required}}
|
||||
{{#isPrimitiveType}}
|
||||
@ -114,7 +112,9 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
||||
{{/queryParams}}
|
||||
{{/hasQueryParams}}
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ {{#consumes}}"{{{mediaType}}}", {{/consumes}} }
|
||||
{{=<% %>=}}
|
||||
localVarHttpContentTypes := []string{<%#consumes%>"<%&mediaType%>"<%^-last%>, <%/-last%><%/consumes%>}
|
||||
<%={{ }}=%>
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -123,11 +123,9 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
{{#produces}}
|
||||
"{{{mediaType}}}",
|
||||
{{/produces}}
|
||||
}
|
||||
{{=<% %>=}}
|
||||
localVarHttpHeaderAccepts := []string{<%#produces%>"<%&mediaType%>"<%^-last%>, <%/-last%><%/produces%>}
|
||||
<%={{ }}=%>
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -223,7 +221,6 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
||||
}
|
||||
|
||||
{{/returnType}}
|
||||
|
||||
return {{#returnType}}successPayload, {{/returnType}}localVarHttpResponse, err
|
||||
}
|
||||
{{/operation}}{{/operations}}
|
@ -5,40 +5,42 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"golang.org/x/oauth2"
|
||||
"golang.org/x/net/context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
var (
|
||||
jsonCheck = regexp.MustCompile("(?i:[application|text]/json)")
|
||||
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
|
||||
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
|
||||
)
|
||||
|
||||
// APIClient manages communication with the {{appName}} API v{{version}}
|
||||
// In most cases there should be only one, shared, APIClient.
|
||||
type APIClient struct {
|
||||
cfg *Configuration
|
||||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||
cfg *Configuration
|
||||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||
|
||||
// API Services
|
||||
// API Services
|
||||
{{#apiInfo}}
|
||||
{{#apis}}
|
||||
{{#operations}}
|
||||
{{classname}} *{{classname}}Service
|
||||
|
||||
{{classname}} *{{classname}}Service
|
||||
{{/operations}}
|
||||
{{/apis}}
|
||||
{{/apiInfo}}
|
||||
@ -75,7 +77,6 @@ func atoi(in string) (int, error) {
|
||||
return strconv.Atoi(in)
|
||||
}
|
||||
|
||||
|
||||
// selectHeaderContentType select a content type from the available list.
|
||||
func selectHeaderContentType(contentTypes []string) string {
|
||||
if len(contentTypes) == 0 {
|
||||
@ -148,16 +149,16 @@ func parameterToString(obj interface{}, collectionFormat string) string {
|
||||
|
||||
// callAPI do the request.
|
||||
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
|
||||
return c.cfg.HTTPClient.Do(request)
|
||||
return c.cfg.HTTPClient.Do(request)
|
||||
}
|
||||
|
||||
// Change base path to allow switching to mocks
|
||||
func (c *APIClient) ChangeBasePath (path string) {
|
||||
func (c *APIClient) ChangeBasePath(path string) {
|
||||
c.cfg.BasePath = path
|
||||
}
|
||||
|
||||
// prepareRequest build the request
|
||||
func (c *APIClient) prepareRequest (
|
||||
func (c *APIClient) prepareRequest(
|
||||
ctx context.Context,
|
||||
path string, method string,
|
||||
postBody interface{},
|
||||
@ -267,7 +268,6 @@ func (c *APIClient) prepareRequest (
|
||||
// Add the user agent to the request.
|
||||
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
||||
|
||||
|
||||
if ctx != nil {
|
||||
// add context to the request
|
||||
localVarRequest = localVarRequest.WithContext(ctx)
|
||||
@ -292,7 +292,7 @@ func (c *APIClient) prepareRequest (
|
||||
|
||||
// AccessToken Authentication
|
||||
if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
|
||||
localVarRequest.Header.Add("Authorization", "Bearer " + auth)
|
||||
localVarRequest.Header.Add("Authorization", "Bearer "+auth)
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,7 +303,6 @@ func (c *APIClient) prepareRequest (
|
||||
return localVarRequest, nil
|
||||
}
|
||||
|
||||
|
||||
// Add a file to the multipart request
|
||||
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||
file, err := os.Open(path)
|
||||
@ -322,7 +321,7 @@ func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||
}
|
||||
|
||||
// Prevent trying to import "fmt"
|
||||
func reportError(format string, a ...interface{}) (error) {
|
||||
func reportError(format string, a ...interface{}) error {
|
||||
return fmt.Errorf(format, a...)
|
||||
}
|
||||
|
||||
@ -376,7 +375,6 @@ func detectContentType(body interface{}) string {
|
||||
return contentType
|
||||
}
|
||||
|
||||
|
||||
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
||||
type cacheControl map[string]string
|
||||
|
||||
@ -399,7 +397,7 @@ func parseCacheControl(headers http.Header) cacheControl {
|
||||
}
|
||||
|
||||
// CacheExpires helper function to determine remaining time before repeating a request.
|
||||
func CacheExpires(r *http.Response) (time.Time) {
|
||||
func CacheExpires(r *http.Response) time.Time {
|
||||
// Figure out when the cache expires.
|
||||
var expires time.Time
|
||||
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
||||
@ -426,7 +424,6 @@ func CacheExpires(r *http.Response) (time.Time) {
|
||||
return expires
|
||||
}
|
||||
|
||||
func strlen(s string) (int) {
|
||||
func strlen(s string) int {
|
||||
return utf8.RuneCountInString(s)
|
||||
}
|
||||
|
||||
|
@ -7,15 +7,15 @@ import (
|
||||
|
||||
type APIResponse struct {
|
||||
*http.Response `json:"-"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
// Operation is the name of the swagger operation.
|
||||
Operation string `json:"operation,omitempty"`
|
||||
Operation string `json:"operation,omitempty"`
|
||||
// RequestURL is the request URL. This value is always available, even if the
|
||||
// embedded *http.Response is nil.
|
||||
RequestURL string `json:"url,omitempty"`
|
||||
RequestURL string `json:"url,omitempty"`
|
||||
// Method is the HTTP method used for the request. This value is always
|
||||
// available, even if the embedded *http.Response is nil.
|
||||
Method string `json:"method,omitempty"`
|
||||
Method string `json:"method,omitempty"`
|
||||
// Payload holds the contents of the response body (which may be nil or empty).
|
||||
// This is provided here as the raw response.Body() reader will have already
|
||||
// been drained.
|
||||
|
@ -17,37 +17,37 @@ func (c contextKey) String() string {
|
||||
|
||||
var (
|
||||
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
|
||||
ContextOAuth2 = contextKey("token")
|
||||
ContextOAuth2 = contextKey("token")
|
||||
|
||||
// ContextBasicAuth takes BasicAuth as authentication for the request.
|
||||
ContextBasicAuth = contextKey("basic")
|
||||
ContextBasicAuth = contextKey("basic")
|
||||
|
||||
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
|
||||
ContextAccessToken = contextKey("accesstoken")
|
||||
ContextAccessToken = contextKey("accesstoken")
|
||||
|
||||
// ContextAPIKey takes an APIKey as authentication for the request
|
||||
ContextAPIKey = contextKey("apikey")
|
||||
ContextAPIKey = contextKey("apikey")
|
||||
)
|
||||
|
||||
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
|
||||
type BasicAuth struct {
|
||||
UserName string `json:"userName,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
UserName string `json:"userName,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
}
|
||||
|
||||
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
|
||||
type APIKey struct {
|
||||
Key string
|
||||
Prefix string
|
||||
Key string
|
||||
Prefix string
|
||||
}
|
||||
|
||||
type Configuration struct {
|
||||
BasePath string `json:"basePath,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Scheme string `json:"scheme,omitempty"`
|
||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||
UserAgent string `json:"userAgent,omitempty"`
|
||||
HTTPClient *http.Client
|
||||
BasePath string `json:"basePath,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Scheme string `json:"scheme,omitempty"`
|
||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||
UserAgent string `json:"userAgent,omitempty"`
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
func NewConfiguration() *Configuration {
|
||||
|
@ -11,14 +11,22 @@ type {{{name}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/form
|
||||
const (
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{^-first}}
|
||||
|
||||
{{/-first}}
|
||||
{{name}} {{{classname}}} = "{{{value}}}"
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
){{/isEnum}}{{^isEnum}}{{#description}}
|
||||
// {{{description}}}{{/description}}
|
||||
type {{classname}} struct {
|
||||
{{#vars}}{{#description}}
|
||||
// {{{description}}}{{/description}}
|
||||
{{#vars}}
|
||||
{{^-first}}
|
||||
|
||||
{{/-first}}
|
||||
{{#description}}
|
||||
// {{{description}}}
|
||||
{{/description}}
|
||||
{{name}} {{^isEnum}}{{^isPrimitiveType}}{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{/isPrimitiveType}}{{/isEnum}}{{{datatype}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"`
|
||||
{{/vars}}
|
||||
}{{/isEnum}}{{/model}}{{/models}}
|
||||
|
@ -56,7 +56,7 @@ Example
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
```
|
||||
|
||||
Or via OAuth2 module to automaticly refresh tokens and perform user authentication.
|
||||
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
|
||||
```
|
||||
import "golang.org/x/oauth2"
|
||||
|
||||
|
@ -14,37 +14,39 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"golang.org/x/oauth2"
|
||||
"golang.org/x/net/context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
var (
|
||||
jsonCheck = regexp.MustCompile("(?i:[application|text]/json)")
|
||||
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
|
||||
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
|
||||
)
|
||||
|
||||
// APIClient manages communication with the Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r API v1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
// In most cases there should be only one, shared, APIClient.
|
||||
type APIClient struct {
|
||||
cfg *Configuration
|
||||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||
cfg *Configuration
|
||||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||
|
||||
// API Services
|
||||
FakeApi *FakeApiService
|
||||
// API Services
|
||||
|
||||
FakeApi *FakeApiService
|
||||
}
|
||||
|
||||
type service struct {
|
||||
@ -72,7 +74,6 @@ func atoi(in string) (int, error) {
|
||||
return strconv.Atoi(in)
|
||||
}
|
||||
|
||||
|
||||
// selectHeaderContentType select a content type from the available list.
|
||||
func selectHeaderContentType(contentTypes []string) string {
|
||||
if len(contentTypes) == 0 {
|
||||
@ -145,16 +146,16 @@ func parameterToString(obj interface{}, collectionFormat string) string {
|
||||
|
||||
// callAPI do the request.
|
||||
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
|
||||
return c.cfg.HTTPClient.Do(request)
|
||||
return c.cfg.HTTPClient.Do(request)
|
||||
}
|
||||
|
||||
// Change base path to allow switching to mocks
|
||||
func (c *APIClient) ChangeBasePath (path string) {
|
||||
func (c *APIClient) ChangeBasePath(path string) {
|
||||
c.cfg.BasePath = path
|
||||
}
|
||||
|
||||
// prepareRequest build the request
|
||||
func (c *APIClient) prepareRequest (
|
||||
func (c *APIClient) prepareRequest(
|
||||
ctx context.Context,
|
||||
path string, method string,
|
||||
postBody interface{},
|
||||
@ -180,7 +181,7 @@ func (c *APIClient) prepareRequest (
|
||||
}
|
||||
}
|
||||
|
||||
// add form paramters and file if available.
|
||||
// add form parameters and file if available.
|
||||
if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
|
||||
if body != nil {
|
||||
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
||||
@ -220,7 +221,7 @@ func (c *APIClient) prepareRequest (
|
||||
w.Close()
|
||||
}
|
||||
|
||||
// Setup path and query paramters
|
||||
// Setup path and query parameters
|
||||
url, err := url.Parse(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -264,7 +265,6 @@ func (c *APIClient) prepareRequest (
|
||||
// Add the user agent to the request.
|
||||
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
||||
|
||||
|
||||
if ctx != nil {
|
||||
// add context to the request
|
||||
localVarRequest = localVarRequest.WithContext(ctx)
|
||||
@ -289,7 +289,7 @@ func (c *APIClient) prepareRequest (
|
||||
|
||||
// AccessToken Authentication
|
||||
if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
|
||||
localVarRequest.Header.Add("Authorization", "Bearer " + auth)
|
||||
localVarRequest.Header.Add("Authorization", "Bearer "+auth)
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,7 +300,6 @@ func (c *APIClient) prepareRequest (
|
||||
return localVarRequest, nil
|
||||
}
|
||||
|
||||
|
||||
// Add a file to the multipart request
|
||||
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||
file, err := os.Open(path)
|
||||
@ -319,7 +318,7 @@ func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||
}
|
||||
|
||||
// Prevent trying to import "fmt"
|
||||
func reportError(format string, a ...interface{}) (error) {
|
||||
func reportError(format string, a ...interface{}) error {
|
||||
return fmt.Errorf(format, a...)
|
||||
}
|
||||
|
||||
@ -373,7 +372,6 @@ func detectContentType(body interface{}) string {
|
||||
return contentType
|
||||
}
|
||||
|
||||
|
||||
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
||||
type cacheControl map[string]string
|
||||
|
||||
@ -396,7 +394,7 @@ func parseCacheControl(headers http.Header) cacheControl {
|
||||
}
|
||||
|
||||
// CacheExpires helper function to determine remaining time before repeating a request.
|
||||
func CacheExpires(r *http.Response) (time.Time) {
|
||||
func CacheExpires(r *http.Response) time.Time {
|
||||
// Figure out when the cache expires.
|
||||
var expires time.Time
|
||||
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
||||
@ -423,7 +421,6 @@ func CacheExpires(r *http.Response) (time.Time) {
|
||||
return expires
|
||||
}
|
||||
|
||||
func strlen(s string) (int) {
|
||||
func strlen(s string) int {
|
||||
return utf8.RuneCountInString(s)
|
||||
}
|
||||
|
||||
|
@ -16,15 +16,15 @@ import (
|
||||
|
||||
type APIResponse struct {
|
||||
*http.Response `json:"-"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
// Operation is the name of the swagger operation.
|
||||
Operation string `json:"operation,omitempty"`
|
||||
Operation string `json:"operation,omitempty"`
|
||||
// RequestURL is the request URL. This value is always available, even if the
|
||||
// embedded *http.Response is nil.
|
||||
RequestURL string `json:"url,omitempty"`
|
||||
RequestURL string `json:"url,omitempty"`
|
||||
// Method is the HTTP method used for the request. This value is always
|
||||
// available, even if the embedded *http.Response is nil.
|
||||
Method string `json:"method,omitempty"`
|
||||
Method string `json:"method,omitempty"`
|
||||
// Payload holds the contents of the response body (which may be nil or empty).
|
||||
// This is provided here as the raw response.Body() reader will have already
|
||||
// been drained.
|
||||
|
@ -26,37 +26,37 @@ func (c contextKey) String() string {
|
||||
|
||||
var (
|
||||
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
|
||||
ContextOAuth2 = contextKey("token")
|
||||
ContextOAuth2 = contextKey("token")
|
||||
|
||||
// ContextBasicAuth takes BasicAuth as authentication for the request.
|
||||
ContextBasicAuth = contextKey("basic")
|
||||
ContextBasicAuth = contextKey("basic")
|
||||
|
||||
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
|
||||
ContextAccessToken = contextKey("accesstoken")
|
||||
ContextAccessToken = contextKey("accesstoken")
|
||||
|
||||
// ContextAPIKey takes an APIKey as authentication for the request
|
||||
ContextAPIKey = contextKey("apikey")
|
||||
ContextAPIKey = contextKey("apikey")
|
||||
)
|
||||
|
||||
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
|
||||
type BasicAuth struct {
|
||||
UserName string `json:"userName,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
UserName string `json:"userName,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
}
|
||||
|
||||
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
|
||||
type APIKey struct {
|
||||
Key string
|
||||
Prefix string
|
||||
Key string
|
||||
Prefix string
|
||||
}
|
||||
|
||||
type Configuration struct {
|
||||
BasePath string `json:"basePath,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Scheme string `json:"scheme,omitempty"`
|
||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||
UserAgent string `json:"userAgent,omitempty"`
|
||||
HTTPClient *http.Client
|
||||
BasePath string `json:"basePath,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Scheme string `json:"scheme,omitempty"`
|
||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||
UserAgent string `json:"userAgent,omitempty"`
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
func NewConfiguration() *Configuration {
|
||||
|
@ -11,8 +11,9 @@
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
@ -24,18 +25,17 @@ var (
|
||||
|
||||
type FakeApiService service
|
||||
|
||||
|
||||
/* FakeApiService To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "testCodeInjectEndRnNR" (string) To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
@return */
|
||||
func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOptionals map[string]interface{}) ( *http.Response, error) {
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "testCodeInjectEndRnNR" (string) To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
@return */
|
||||
func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOptionals map[string]interface{}) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Put")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -44,13 +44,12 @@ func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOpti
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if err := typeCheckParameter(localVarOptionals["testCodeInjectEndRnNR"], "string", "testCodeInjectEndRnNR"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ "application/json", "*_/ ' =end -- ", }
|
||||
localVarHttpContentTypes := []string{"application/json", "*_/ ' =end -- "}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -59,10 +58,7 @@ func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOpti
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/json",
|
||||
"*_/ ' =end -- ",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/json", "*_/ ' =end -- "}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -83,9 +79,8 @@ func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOpti
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
return localVarHttpResponse, reportError(localVarHttpResponse.Status)
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@ package swagger
|
||||
|
||||
// Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
type ModelReturn struct {
|
||||
|
||||
// property description *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
Return_ int32 `json:"return,omitempty"`
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type AdditionalPropertiesClass struct {
|
||||
|
||||
MapProperty map[string]string `json:"map_property,omitempty"`
|
||||
|
||||
MapOfMapProperty map[string]map[string]string `json:"map_of_map_property,omitempty"`
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type Animal struct {
|
||||
|
||||
ClassName string `json:"className"`
|
||||
|
||||
Color string `json:"color,omitempty"`
|
||||
|
@ -12,8 +12,8 @@ package petstore
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"encoding/json"
|
||||
@ -26,19 +26,18 @@ var (
|
||||
|
||||
type AnotherFakeApiService service
|
||||
|
||||
|
||||
/* AnotherFakeApiService To test special tags
|
||||
To test special tags
|
||||
To test special tags
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body client model
|
||||
@return Client*/
|
||||
func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client) (Client, *http.Response, error) {
|
||||
@param body client model
|
||||
@return Client*/
|
||||
func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client) (Client, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Patch")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Client
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Client
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -48,9 +47,8 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ "application/json", }
|
||||
localVarHttpContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -59,9 +57,7 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -89,7 +85,5 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
@ -14,42 +14,49 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"golang.org/x/oauth2"
|
||||
"golang.org/x/net/context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
var (
|
||||
jsonCheck = regexp.MustCompile("(?i:[application|text]/json)")
|
||||
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
|
||||
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
|
||||
)
|
||||
|
||||
// APIClient manages communication with the Swagger Petstore API v1.0.0
|
||||
// In most cases there should be only one, shared, APIClient.
|
||||
type APIClient struct {
|
||||
cfg *Configuration
|
||||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||
cfg *Configuration
|
||||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||
|
||||
// API Services
|
||||
AnotherFakeApi *AnotherFakeApiService
|
||||
FakeApi *FakeApiService
|
||||
FakeClassnameTags123Api *FakeClassnameTags123ApiService
|
||||
PetApi *PetApiService
|
||||
StoreApi *StoreApiService
|
||||
UserApi *UserApiService
|
||||
// API Services
|
||||
|
||||
AnotherFakeApi *AnotherFakeApiService
|
||||
|
||||
FakeApi *FakeApiService
|
||||
|
||||
FakeClassnameTags123Api *FakeClassnameTags123ApiService
|
||||
|
||||
PetApi *PetApiService
|
||||
|
||||
StoreApi *StoreApiService
|
||||
|
||||
UserApi *UserApiService
|
||||
}
|
||||
|
||||
type service struct {
|
||||
@ -82,7 +89,6 @@ func atoi(in string) (int, error) {
|
||||
return strconv.Atoi(in)
|
||||
}
|
||||
|
||||
|
||||
// selectHeaderContentType select a content type from the available list.
|
||||
func selectHeaderContentType(contentTypes []string) string {
|
||||
if len(contentTypes) == 0 {
|
||||
@ -155,16 +161,16 @@ func parameterToString(obj interface{}, collectionFormat string) string {
|
||||
|
||||
// callAPI do the request.
|
||||
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
|
||||
return c.cfg.HTTPClient.Do(request)
|
||||
return c.cfg.HTTPClient.Do(request)
|
||||
}
|
||||
|
||||
// Change base path to allow switching to mocks
|
||||
func (c *APIClient) ChangeBasePath (path string) {
|
||||
func (c *APIClient) ChangeBasePath(path string) {
|
||||
c.cfg.BasePath = path
|
||||
}
|
||||
|
||||
// prepareRequest build the request
|
||||
func (c *APIClient) prepareRequest (
|
||||
func (c *APIClient) prepareRequest(
|
||||
ctx context.Context,
|
||||
path string, method string,
|
||||
postBody interface{},
|
||||
@ -274,7 +280,6 @@ func (c *APIClient) prepareRequest (
|
||||
// Add the user agent to the request.
|
||||
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
||||
|
||||
|
||||
if ctx != nil {
|
||||
// add context to the request
|
||||
localVarRequest = localVarRequest.WithContext(ctx)
|
||||
@ -299,7 +304,7 @@ func (c *APIClient) prepareRequest (
|
||||
|
||||
// AccessToken Authentication
|
||||
if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
|
||||
localVarRequest.Header.Add("Authorization", "Bearer " + auth)
|
||||
localVarRequest.Header.Add("Authorization", "Bearer "+auth)
|
||||
}
|
||||
}
|
||||
|
||||
@ -310,7 +315,6 @@ func (c *APIClient) prepareRequest (
|
||||
return localVarRequest, nil
|
||||
}
|
||||
|
||||
|
||||
// Add a file to the multipart request
|
||||
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||
file, err := os.Open(path)
|
||||
@ -329,7 +333,7 @@ func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||
}
|
||||
|
||||
// Prevent trying to import "fmt"
|
||||
func reportError(format string, a ...interface{}) (error) {
|
||||
func reportError(format string, a ...interface{}) error {
|
||||
return fmt.Errorf(format, a...)
|
||||
}
|
||||
|
||||
@ -383,7 +387,6 @@ func detectContentType(body interface{}) string {
|
||||
return contentType
|
||||
}
|
||||
|
||||
|
||||
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
||||
type cacheControl map[string]string
|
||||
|
||||
@ -406,7 +409,7 @@ func parseCacheControl(headers http.Header) cacheControl {
|
||||
}
|
||||
|
||||
// CacheExpires helper function to determine remaining time before repeating a request.
|
||||
func CacheExpires(r *http.Response) (time.Time) {
|
||||
func CacheExpires(r *http.Response) time.Time {
|
||||
// Figure out when the cache expires.
|
||||
var expires time.Time
|
||||
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
||||
@ -433,7 +436,6 @@ func CacheExpires(r *http.Response) (time.Time) {
|
||||
return expires
|
||||
}
|
||||
|
||||
func strlen(s string) (int) {
|
||||
func strlen(s string) int {
|
||||
return utf8.RuneCountInString(s)
|
||||
}
|
||||
|
||||
|
@ -16,15 +16,15 @@ import (
|
||||
|
||||
type APIResponse struct {
|
||||
*http.Response `json:"-"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
// Operation is the name of the swagger operation.
|
||||
Operation string `json:"operation,omitempty"`
|
||||
Operation string `json:"operation,omitempty"`
|
||||
// RequestURL is the request URL. This value is always available, even if the
|
||||
// embedded *http.Response is nil.
|
||||
RequestURL string `json:"url,omitempty"`
|
||||
RequestURL string `json:"url,omitempty"`
|
||||
// Method is the HTTP method used for the request. This value is always
|
||||
// available, even if the embedded *http.Response is nil.
|
||||
Method string `json:"method,omitempty"`
|
||||
Method string `json:"method,omitempty"`
|
||||
// Payload holds the contents of the response body (which may be nil or empty).
|
||||
// This is provided here as the raw response.Body() reader will have already
|
||||
// been drained.
|
||||
|
@ -11,6 +11,5 @@
|
||||
package petstore
|
||||
|
||||
type ArrayOfArrayOfNumberOnly struct {
|
||||
|
||||
ArrayArrayNumber [][]float32 `json:"ArrayArrayNumber,omitempty"`
|
||||
}
|
||||
|
@ -11,6 +11,5 @@
|
||||
package petstore
|
||||
|
||||
type ArrayOfNumberOnly struct {
|
||||
|
||||
ArrayNumber []float32 `json:"ArrayNumber,omitempty"`
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type ArrayTest struct {
|
||||
|
||||
ArrayOfString []string `json:"array_of_string,omitempty"`
|
||||
|
||||
ArrayArrayOfInteger [][]int64 `json:"array_array_of_integer,omitempty"`
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type Capitalization struct {
|
||||
|
||||
SmallCamel string `json:"smallCamel,omitempty"`
|
||||
|
||||
CapitalCamel string `json:"CapitalCamel,omitempty"`
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type Cat struct {
|
||||
|
||||
ClassName string `json:"className"`
|
||||
|
||||
Color string `json:"color,omitempty"`
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type Category struct {
|
||||
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
Name string `json:"name,omitempty"`
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
// Model for testing model with \"_class\" property
|
||||
type ClassModel struct {
|
||||
|
||||
Class string `json:"_class,omitempty"`
|
||||
}
|
||||
|
@ -11,6 +11,5 @@
|
||||
package petstore
|
||||
|
||||
type Client struct {
|
||||
|
||||
Client string `json:"client,omitempty"`
|
||||
}
|
||||
|
@ -26,37 +26,37 @@ func (c contextKey) String() string {
|
||||
|
||||
var (
|
||||
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
|
||||
ContextOAuth2 = contextKey("token")
|
||||
ContextOAuth2 = contextKey("token")
|
||||
|
||||
// ContextBasicAuth takes BasicAuth as authentication for the request.
|
||||
ContextBasicAuth = contextKey("basic")
|
||||
ContextBasicAuth = contextKey("basic")
|
||||
|
||||
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
|
||||
ContextAccessToken = contextKey("accesstoken")
|
||||
ContextAccessToken = contextKey("accesstoken")
|
||||
|
||||
// ContextAPIKey takes an APIKey as authentication for the request
|
||||
ContextAPIKey = contextKey("apikey")
|
||||
ContextAPIKey = contextKey("apikey")
|
||||
)
|
||||
|
||||
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
|
||||
type BasicAuth struct {
|
||||
UserName string `json:"userName,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
UserName string `json:"userName,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
}
|
||||
|
||||
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
|
||||
type APIKey struct {
|
||||
Key string
|
||||
Prefix string
|
||||
Key string
|
||||
Prefix string
|
||||
}
|
||||
|
||||
type Configuration struct {
|
||||
BasePath string `json:"basePath,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Scheme string `json:"scheme,omitempty"`
|
||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||
UserAgent string `json:"userAgent,omitempty"`
|
||||
HTTPClient *http.Client
|
||||
BasePath string `json:"basePath,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Scheme string `json:"scheme,omitempty"`
|
||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||
UserAgent string `json:"userAgent,omitempty"`
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
func NewConfiguration() *Configuration {
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type Dog struct {
|
||||
|
||||
ClassName string `json:"className"`
|
||||
|
||||
Color string `json:"color,omitempty"`
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type EnumArrays struct {
|
||||
|
||||
JustSymbol string `json:"just_symbol,omitempty"`
|
||||
|
||||
ArrayEnum []string `json:"array_enum,omitempty"`
|
||||
|
@ -15,6 +15,8 @@ type EnumClass string
|
||||
// List of EnumClass
|
||||
const (
|
||||
ABC EnumClass = "_abc"
|
||||
|
||||
EFG EnumClass = "-efg"
|
||||
|
||||
XYZ EnumClass = "(xyz)"
|
||||
)
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type EnumTest struct {
|
||||
|
||||
EnumString string `json:"enum_string,omitempty"`
|
||||
|
||||
EnumInteger int32 `json:"enum_integer,omitempty"`
|
||||
|
@ -12,8 +12,8 @@ package petstore
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"time"
|
||||
@ -27,20 +27,19 @@ var (
|
||||
|
||||
type FakeApiService service
|
||||
|
||||
|
||||
/* FakeApiService
|
||||
Test serialization of outer boolean types
|
||||
Test serialization of outer boolean types
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "body" (OuterBoolean) Input boolean as post body
|
||||
@return OuterBoolean*/
|
||||
func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals map[string]interface{}) (OuterBoolean, *http.Response, error) {
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "body" (OuterBoolean) Input boolean as post body
|
||||
@return OuterBoolean*/
|
||||
func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals map[string]interface{}) (OuterBoolean, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload OuterBoolean
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload OuterBoolean
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -50,9 +49,8 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -61,8 +59,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -92,23 +89,22 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* FakeApiService
|
||||
Test serialization of object with outer number type
|
||||
Test serialization of object with outer number type
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "body" (OuterComposite) Input composite as post body
|
||||
@return OuterComposite*/
|
||||
func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localVarOptionals map[string]interface{}) (OuterComposite, *http.Response, error) {
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "body" (OuterComposite) Input composite as post body
|
||||
@return OuterComposite*/
|
||||
func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localVarOptionals map[string]interface{}) (OuterComposite, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload OuterComposite
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload OuterComposite
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -118,9 +114,8 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -129,8 +124,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -160,23 +154,22 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* FakeApiService
|
||||
Test serialization of outer number types
|
||||
Test serialization of outer number types
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "body" (OuterNumber) Input number as post body
|
||||
@return OuterNumber*/
|
||||
func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarOptionals map[string]interface{}) (OuterNumber, *http.Response, error) {
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "body" (OuterNumber) Input number as post body
|
||||
@return OuterNumber*/
|
||||
func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarOptionals map[string]interface{}) (OuterNumber, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload OuterNumber
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload OuterNumber
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -186,9 +179,8 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -197,8 +189,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -228,23 +219,22 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* FakeApiService
|
||||
Test serialization of outer string types
|
||||
Test serialization of outer string types
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "body" (OuterString) Input string as post body
|
||||
@return OuterString*/
|
||||
func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarOptionals map[string]interface{}) (OuterString, *http.Response, error) {
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "body" (OuterString) Input string as post body
|
||||
@return OuterString*/
|
||||
func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarOptionals map[string]interface{}) (OuterString, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload OuterString
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload OuterString
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -254,9 +244,8 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -265,8 +254,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -296,22 +284,21 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* FakeApiService To test \"client\" model
|
||||
To test \"client\" model
|
||||
To test \"client\" model
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body client model
|
||||
@return Client*/
|
||||
func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Client, *http.Response, error) {
|
||||
@param body client model
|
||||
@return Client*/
|
||||
func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Client, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Patch")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Client
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Client
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -321,9 +308,8 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Clie
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ "application/json", }
|
||||
localVarHttpContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -332,9 +318,7 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Clie
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -362,35 +346,34 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Clie
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* FakeApiService Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param number None
|
||||
@param double None
|
||||
@param patternWithoutDelimiter None
|
||||
@param byte_ None
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "integer" (int32) None
|
||||
@param "int32_" (int32) None
|
||||
@param "int64_" (int64) None
|
||||
@param "float" (float32) None
|
||||
@param "string_" (string) None
|
||||
@param "binary" (string) None
|
||||
@param "date" (string) None
|
||||
@param "dateTime" (time.Time) None
|
||||
@param "password" (string) None
|
||||
@param "callback" (string) None
|
||||
@return */
|
||||
func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals map[string]interface{}) ( *http.Response, error) {
|
||||
@param number None
|
||||
@param double None
|
||||
@param patternWithoutDelimiter None
|
||||
@param byte_ None
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "integer" (int32) None
|
||||
@param "int32_" (int32) None
|
||||
@param "int64_" (int64) None
|
||||
@param "float" (float32) None
|
||||
@param "string_" (string) None
|
||||
@param "binary" (string) None
|
||||
@param "date" (string) None
|
||||
@param "dateTime" (time.Time) None
|
||||
@param "password" (string) None
|
||||
@param "callback" (string) None
|
||||
@return */
|
||||
func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals map[string]interface{}) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -399,7 +382,6 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if number < 32.1 {
|
||||
return nil, reportError("number must be greater than 32.1")
|
||||
}
|
||||
@ -444,7 +426,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ "application/xml; charset=utf-8", "application/json; charset=utf-8", }
|
||||
localVarHttpContentTypes := []string{"application/xml; charset=utf-8", "application/json; charset=utf-8"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -453,10 +435,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml; charset=utf-8",
|
||||
"application/json; charset=utf-8",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml; charset=utf-8", "application/json; charset=utf-8"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -511,29 +490,28 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* FakeApiService To test enum parameters
|
||||
To test enum parameters
|
||||
To test enum parameters
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "enumFormStringArray" ([]string) Form parameter enum test (string array)
|
||||
@param "enumFormString" (string) Form parameter enum test (string)
|
||||
@param "enumHeaderStringArray" ([]string) Header parameter enum test (string array)
|
||||
@param "enumHeaderString" (string) Header parameter enum test (string)
|
||||
@param "enumQueryStringArray" ([]string) Query parameter enum test (string array)
|
||||
@param "enumQueryString" (string) Query parameter enum test (string)
|
||||
@param "enumQueryInteger" (int32) Query parameter enum test (double)
|
||||
@param "enumQueryDouble" (float64) Query parameter enum test (double)
|
||||
@return */
|
||||
func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptionals map[string]interface{}) ( *http.Response, error) {
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "enumFormStringArray" ([]string) Form parameter enum test (string array)
|
||||
@param "enumFormString" (string) Form parameter enum test (string)
|
||||
@param "enumHeaderStringArray" ([]string) Header parameter enum test (string array)
|
||||
@param "enumHeaderString" (string) Header parameter enum test (string)
|
||||
@param "enumQueryStringArray" ([]string) Query parameter enum test (string array)
|
||||
@param "enumQueryString" (string) Query parameter enum test (string)
|
||||
@param "enumQueryInteger" (int32) Query parameter enum test (double)
|
||||
@param "enumQueryDouble" (float64) Query parameter enum test (double)
|
||||
@return */
|
||||
func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptionals map[string]interface{}) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -542,7 +520,6 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if err := typeCheckParameter(localVarOptionals["enumFormString"], "string", "enumFormString"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -569,7 +546,7 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
|
||||
localVarQueryParams.Add("enum_query_integer", parameterToString(localVarTempParam, ""))
|
||||
}
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ "*/*", }
|
||||
localVarHttpContentTypes := []string{"*/*"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -578,9 +555,7 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"*/*",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"*/*"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -616,21 +591,20 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* FakeApiService test inline additionalProperties
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param param request body
|
||||
@return */
|
||||
func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, param interface{}) ( *http.Response, error) {
|
||||
@param param request body
|
||||
@return */
|
||||
func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, param interface{}) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -640,9 +614,8 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, par
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ "application/json", }
|
||||
localVarHttpContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -651,8 +624,7 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, par
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -675,22 +647,21 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, par
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* FakeApiService test json serialization of form data
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param param field1
|
||||
@param param2 field2
|
||||
@return */
|
||||
func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, param2 string) ( *http.Response, error) {
|
||||
@param param field1
|
||||
@param param2 field2
|
||||
@return */
|
||||
func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, param2 string) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -700,9 +671,8 @@ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, par
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ "application/json", }
|
||||
localVarHttpContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -711,8 +681,7 @@ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, par
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -735,7 +704,5 @@ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, par
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,8 @@ package petstore
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"encoding/json"
|
||||
@ -26,18 +26,17 @@ var (
|
||||
|
||||
type FakeClassnameTags123ApiService service
|
||||
|
||||
|
||||
/* FakeClassnameTags123ApiService To test class name in snake case
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body client model
|
||||
@return Client*/
|
||||
func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body Client) (Client, *http.Response, error) {
|
||||
@param body client model
|
||||
@return Client*/
|
||||
func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body Client) (Client, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Patch")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Client
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Client
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -47,9 +46,8 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ "application/json", }
|
||||
localVarHttpContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -58,9 +56,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -100,7 +96,5 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@ import (
|
||||
)
|
||||
|
||||
type FormatTest struct {
|
||||
|
||||
Integer int32 `json:"integer,omitempty"`
|
||||
|
||||
Int32_ int32 `json:"int32,omitempty"`
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type HasOnlyReadOnly struct {
|
||||
|
||||
Bar string `json:"bar,omitempty"`
|
||||
|
||||
Foo string `json:"foo,omitempty"`
|
||||
|
@ -11,6 +11,5 @@
|
||||
package petstore
|
||||
|
||||
type List struct {
|
||||
|
||||
Var123List string `json:"123-list,omitempty"`
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type MapTest struct {
|
||||
|
||||
MapMapOfString map[string]map[string]string `json:"map_map_of_string,omitempty"`
|
||||
|
||||
MapOfEnumString map[string]string `json:"map_of_enum_string,omitempty"`
|
||||
|
@ -15,7 +15,6 @@ import (
|
||||
)
|
||||
|
||||
type MixedPropertiesAndAdditionalPropertiesClass struct {
|
||||
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
|
||||
DateTime time.Time `json:"dateTime,omitempty"`
|
||||
|
@ -12,7 +12,6 @@ package petstore
|
||||
|
||||
// Model for testing model name starting with number
|
||||
type Model200Response struct {
|
||||
|
||||
Name int32 `json:"name,omitempty"`
|
||||
|
||||
Class string `json:"class,omitempty"`
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type ModelApiResponse struct {
|
||||
|
||||
Code int32 `json:"code,omitempty"`
|
||||
|
||||
Type_ string `json:"type,omitempty"`
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
// Model for testing reserved words
|
||||
type ModelReturn struct {
|
||||
|
||||
Return_ int32 `json:"return,omitempty"`
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ package petstore
|
||||
|
||||
// Model for testing model name same as property name
|
||||
type Name struct {
|
||||
|
||||
Name int32 `json:"name"`
|
||||
|
||||
SnakeCase int32 `json:"snake_case,omitempty"`
|
||||
|
@ -11,6 +11,5 @@
|
||||
package petstore
|
||||
|
||||
type NumberOnly struct {
|
||||
|
||||
JustNumber float32 `json:"JustNumber,omitempty"`
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ import (
|
||||
)
|
||||
|
||||
type Order struct {
|
||||
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
PetId int64 `json:"petId,omitempty"`
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type OuterComposite struct {
|
||||
|
||||
MyNumber *OuterNumber `json:"my_number,omitempty"`
|
||||
|
||||
MyString *OuterString `json:"my_string,omitempty"`
|
||||
|
@ -15,6 +15,8 @@ type OuterEnum string
|
||||
// List of OuterEnum
|
||||
const (
|
||||
PLACED OuterEnum = "placed"
|
||||
|
||||
APPROVED OuterEnum = "approved"
|
||||
|
||||
DELIVERED OuterEnum = "delivered"
|
||||
)
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type Pet struct {
|
||||
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
Category *Category `json:"category,omitempty"`
|
||||
|
@ -12,8 +12,8 @@ package petstore
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"os"
|
||||
@ -28,18 +28,17 @@ var (
|
||||
|
||||
type PetApiService service
|
||||
|
||||
|
||||
/* PetApiService Add a new pet to the store
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body Pet object that needs to be added to the store
|
||||
@return */
|
||||
func (a *PetApiService) AddPet(ctx context.Context, body Pet) ( *http.Response, error) {
|
||||
@param body Pet object that needs to be added to the store
|
||||
@return */
|
||||
func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -49,9 +48,8 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) ( *http.Response,
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ "application/json", "application/xml", }
|
||||
localVarHttpContentTypes := []string{"application/json", "application/xml"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -60,10 +58,7 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) ( *http.Response,
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -86,23 +81,22 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) ( *http.Response,
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* PetApiService Deletes a pet
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param petId Pet id to delete
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "apiKey" (string)
|
||||
@return */
|
||||
func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals map[string]interface{}) ( *http.Response, error) {
|
||||
@param petId Pet id to delete
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "apiKey" (string)
|
||||
@return */
|
||||
func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals map[string]interface{}) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Delete")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -112,13 +106,12 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if err := typeCheckParameter(localVarOptionals["apiKey"], "string", "apiKey"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -127,10 +120,7 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -154,22 +144,21 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* PetApiService 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 ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param status Status values that need to be considered for filter
|
||||
@return []Pet*/
|
||||
func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) {
|
||||
@param status Status values that need to be considered for filter
|
||||
@return []Pet*/
|
||||
func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload []Pet
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload []Pet
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -179,10 +168,9 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
localVarQueryParams.Add("status", parameterToString(status, "csv"))
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -191,10 +179,7 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -220,22 +205,21 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* PetApiService 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 ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param tags Tags to filter by
|
||||
@return []Pet*/
|
||||
func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) {
|
||||
@param tags Tags to filter by
|
||||
@return []Pet*/
|
||||
func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload []Pet
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload []Pet
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -245,10 +229,9 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
localVarQueryParams.Add("tags", parameterToString(tags, "csv"))
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -257,10 +240,7 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -286,22 +266,21 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* PetApiService Find pet by ID
|
||||
Returns a single pet
|
||||
Returns a single pet
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param petId ID of pet to return
|
||||
@return Pet*/
|
||||
func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) {
|
||||
@param petId ID of pet to return
|
||||
@return Pet*/
|
||||
func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Pet
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Pet
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -312,9 +291,8 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *htt
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -323,10 +301,7 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *htt
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -364,21 +339,20 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *htt
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* PetApiService Update an existing pet
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body Pet object that needs to be added to the store
|
||||
@return */
|
||||
func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) ( *http.Response, error) {
|
||||
@param body Pet object that needs to be added to the store
|
||||
@return */
|
||||
func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Put")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -388,9 +362,8 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) ( *http.Respons
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ "application/json", "application/xml", }
|
||||
localVarHttpContentTypes := []string{"application/json", "application/xml"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -399,10 +372,7 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) ( *http.Respons
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -425,24 +395,23 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) ( *http.Respons
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* PetApiService Updates a pet in the store with form data
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param petId ID of pet that needs to be updated
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "name" (string) Updated name of the pet
|
||||
@param "status" (string) Updated status of the pet
|
||||
@return */
|
||||
func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals map[string]interface{}) ( *http.Response, error) {
|
||||
@param petId ID of pet that needs to be updated
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "name" (string) Updated name of the pet
|
||||
@param "status" (string) Updated status of the pet
|
||||
@return */
|
||||
func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals map[string]interface{}) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -452,7 +421,6 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if err := typeCheckParameter(localVarOptionals["name"], "string", "name"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -461,7 +429,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
||||
}
|
||||
|
||||
// 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 := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -470,10 +438,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -500,25 +465,24 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* PetApiService uploads an image
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param petId ID of pet to update
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "additionalMetadata" (string) Additional data to pass to server
|
||||
@param "file" (*os.File) file to upload
|
||||
@return ModelApiResponse*/
|
||||
func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals map[string]interface{}) (ModelApiResponse, *http.Response, error) {
|
||||
@param petId ID of pet to update
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "additionalMetadata" (string) Additional data to pass to server
|
||||
@param "file" (*os.File) file to upload
|
||||
@return ModelApiResponse*/
|
||||
func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals map[string]interface{}) (ModelApiResponse, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload ModelApiResponse
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload ModelApiResponse
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -528,13 +492,12 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if err := typeCheckParameter(localVarOptionals["additionalMetadata"], "string", "additionalMetadata"); err != nil {
|
||||
return successPayload, nil, err
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ "multipart/form-data", }
|
||||
localVarHttpContentTypes := []string{"multipart/form-data"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -543,9 +506,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -584,7 +545,5 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type ReadOnlyFirst struct {
|
||||
|
||||
Bar string `json:"bar,omitempty"`
|
||||
|
||||
Baz string `json:"baz,omitempty"`
|
||||
|
@ -11,6 +11,5 @@
|
||||
package petstore
|
||||
|
||||
type SpecialModelName struct {
|
||||
|
||||
SpecialPropertyName int64 `json:"$special[property.name],omitempty"`
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ package petstore
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"encoding/json"
|
||||
@ -27,18 +27,17 @@ var (
|
||||
|
||||
type StoreApiService service
|
||||
|
||||
|
||||
/* StoreApiService 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 ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param orderId ID of the order that needs to be deleted
|
||||
@return */
|
||||
func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) ( *http.Response, error) {
|
||||
@param orderId ID of the order that needs to be deleted
|
||||
@return */
|
||||
func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Delete")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -49,9 +48,8 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) ( *ht
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -60,10 +58,7 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) ( *ht
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -84,21 +79,20 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) ( *ht
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* StoreApiService Returns pet inventories by status
|
||||
Returns a map of status codes to quantities
|
||||
Returns a map of status codes to quantities
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@return map[string]int32*/
|
||||
func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) {
|
||||
@return map[string]int32*/
|
||||
func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload map[string]int32
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload map[string]int32
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -108,9 +102,8 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32,
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -119,9 +112,7 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32,
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -159,22 +150,21 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32,
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* StoreApiService 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 ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param orderId ID of pet that needs to be fetched
|
||||
@return Order*/
|
||||
func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) {
|
||||
@param orderId ID of pet that needs to be fetched
|
||||
@return Order*/
|
||||
func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Order
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Order
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -184,7 +174,6 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if orderId < 1 {
|
||||
return successPayload, nil, reportError("orderId must be greater than 1")
|
||||
}
|
||||
@ -193,7 +182,7 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -202,10 +191,7 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -231,22 +217,21 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* StoreApiService Place an order for a pet
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body order placed for purchasing the pet
|
||||
@return Order*/
|
||||
func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *http.Response, error) {
|
||||
@param body order placed for purchasing the pet
|
||||
@return Order*/
|
||||
func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Order
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Order
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -256,9 +241,8 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -267,10 +251,7 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -298,7 +279,5 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type Tag struct {
|
||||
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
Name string `json:"name,omitempty"`
|
||||
|
@ -11,7 +11,6 @@
|
||||
package petstore
|
||||
|
||||
type User struct {
|
||||
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
Username string `json:"username,omitempty"`
|
||||
|
@ -12,8 +12,8 @@ package petstore
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"encoding/json"
|
||||
@ -27,18 +27,17 @@ var (
|
||||
|
||||
type UserApiService service
|
||||
|
||||
|
||||
/* UserApiService Create user
|
||||
This can only be done by the logged in user.
|
||||
This can only be done by the logged in user.
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body Created user object
|
||||
@return */
|
||||
func (a *UserApiService) CreateUser(ctx context.Context, body User) ( *http.Response, error) {
|
||||
@param body Created user object
|
||||
@return */
|
||||
func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -48,9 +47,8 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) ( *http.Resp
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -59,10 +57,7 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) ( *http.Resp
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -85,21 +80,20 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) ( *http.Resp
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* UserApiService Creates list of users with given input array
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body List of user object
|
||||
@return */
|
||||
func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []User) ( *http.Response, error) {
|
||||
@param body List of user object
|
||||
@return */
|
||||
func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []User) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -109,9 +103,8 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -120,10 +113,7 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -146,21 +136,20 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* UserApiService Creates list of users with given input array
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body List of user object
|
||||
@return */
|
||||
func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []User) ( *http.Response, error) {
|
||||
@param body List of user object
|
||||
@return */
|
||||
func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []User) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -170,9 +159,8 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -181,10 +169,7 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -207,21 +192,20 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* UserApiService Delete user
|
||||
This can only be done by the logged in user.
|
||||
This can only be done by the logged in user.
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param username The name that needs to be deleted
|
||||
@return */
|
||||
func (a *UserApiService) DeleteUser(ctx context.Context, username string) ( *http.Response, error) {
|
||||
@param username The name that needs to be deleted
|
||||
@return */
|
||||
func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Delete")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -232,9 +216,8 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) ( *htt
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -243,10 +226,7 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) ( *htt
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -267,22 +247,21 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) ( *htt
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* UserApiService Get user by user name
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param username The name that needs to be fetched. Use user1 for testing.
|
||||
@return User*/
|
||||
func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) {
|
||||
@param username The name that needs to be fetched. Use user1 for testing.
|
||||
@return User*/
|
||||
func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload User
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload User
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -293,9 +272,8 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -304,10 +282,7 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -333,23 +308,22 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* UserApiService Logs user into the system
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param username The user name for login
|
||||
@param password The password for login in clear text
|
||||
@return string*/
|
||||
func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) {
|
||||
@param username The user name for login
|
||||
@param password The password for login in clear text
|
||||
@return string*/
|
||||
func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload string
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload string
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -359,11 +333,10 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
localVarQueryParams.Add("username", parameterToString(username, ""))
|
||||
localVarQueryParams.Add("password", parameterToString(password, ""))
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -372,10 +345,7 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -401,20 +371,19 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* UserApiService Logs out current logged in user session
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@return */
|
||||
func (a *UserApiService) LogoutUser(ctx context.Context) ( *http.Response, error) {
|
||||
@return */
|
||||
func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -424,9 +393,8 @@ func (a *UserApiService) LogoutUser(ctx context.Context) ( *http.Response, error
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -435,10 +403,7 @@ func (a *UserApiService) LogoutUser(ctx context.Context) ( *http.Response, error
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -459,22 +424,21 @@ func (a *UserApiService) LogoutUser(ctx context.Context) ( *http.Response, error
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
/* UserApiService Updated user
|
||||
This can only be done by the logged in user.
|
||||
This can only be done by the logged in user.
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param username name that need to be deleted
|
||||
@param body Updated user object
|
||||
@return */
|
||||
func (a *UserApiService) UpdateUser(ctx context.Context, username string, body User) ( *http.Response, error) {
|
||||
@param username name that need to be deleted
|
||||
@param body Updated user object
|
||||
@return */
|
||||
func (a *UserApiService) UpdateUser(ctx context.Context, username string, body User) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Put")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -485,9 +449,8 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body U
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
@ -496,10 +459,7 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body U
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{
|
||||
"application/xml",
|
||||
"application/json",
|
||||
}
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -522,7 +482,5 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body U
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
}
|
||||
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user