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}}
|
{{#operations}}
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
{{#imports}} "{{import}}"
|
{{#imports}} "{{import}}"
|
||||||
@ -18,15 +18,14 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type {{classname}}Service service
|
type {{classname}}Service service
|
||||||
|
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
|
|
||||||
/* {{{classname}}}Service {{summary}}{{#notes}}
|
/* {{{classname}}}Service{{#summary}} {{.}}{{/summary}}{{#notes}}
|
||||||
{{notes}}{{/notes}}
|
{{notes}}{{/notes}}
|
||||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||||
{{#allParams}}{{#required}} @param {{paramName}} {{description}}
|
{{#allParams}}{{#required}}@param {{paramName}}{{#description}} {{.}}{{/description}}
|
||||||
{{/required}}{{/allParams}}{{#hasOptionalParams}}@param optional (nil or map[string]interface{}) with one or more of:
|
{{/required}}{{/allParams}}{{#hasOptionalParams}}@param optional (nil or map[string]interface{}) with one or more of:
|
||||||
{{#allParams}}{{^required}} @param "{{paramName}}" ({{dataType}}) {{description}}
|
{{#allParams}}{{^required}} @param "{{paramName}}" ({{dataType}}){{#description}} {{.}}{{/description}}
|
||||||
{{/required}}{{/allParams}}{{/hasOptionalParams}}@return {{#returnType}}{{{returnType}}}{{/returnType}}*/
|
{{/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) {
|
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 (
|
var (
|
||||||
@ -46,7 +45,6 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
|||||||
localVarHeaderParams := make(map[string]string)
|
localVarHeaderParams := make(map[string]string)
|
||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
{{#allParams}}
|
{{#allParams}}
|
||||||
{{^required}}
|
{{^required}}
|
||||||
{{#isPrimitiveType}}
|
{{#isPrimitiveType}}
|
||||||
@ -114,7 +112,9 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
|||||||
{{/queryParams}}
|
{{/queryParams}}
|
||||||
{{/hasQueryParams}}
|
{{/hasQueryParams}}
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{ {{#consumes}}"{{{mediaType}}}", {{/consumes}} }
|
{{=<% %>=}}
|
||||||
|
localVarHttpContentTypes := []string{<%#consumes%>"<%&mediaType%>"<%^-last%>, <%/-last%><%/consumes%>}
|
||||||
|
<%={{ }}=%>
|
||||||
|
|
||||||
// set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
@ -123,11 +123,9 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
{{=<% %>=}}
|
||||||
{{#produces}}
|
localVarHttpHeaderAccepts := []string{<%#produces%>"<%&mediaType%>"<%^-last%>, <%/-last%><%/produces%>}
|
||||||
"{{{mediaType}}}",
|
<%={{ }}=%>
|
||||||
{{/produces}}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -223,7 +221,6 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{/returnType}}
|
{{/returnType}}
|
||||||
|
|
||||||
return {{#returnType}}successPayload, {{/returnType}}localVarHttpResponse, err
|
return {{#returnType}}successPayload, {{/returnType}}localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
{{/operation}}{{/operations}}
|
{{/operation}}{{/operations}}
|
@ -5,22 +5,23 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"golang.org/x/oauth2"
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
|
||||||
"unicode/utf8"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
"golang.org/x/oauth2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -38,6 +39,7 @@ type APIClient struct {
|
|||||||
{{#apiInfo}}
|
{{#apiInfo}}
|
||||||
{{#apis}}
|
{{#apis}}
|
||||||
{{#operations}}
|
{{#operations}}
|
||||||
|
|
||||||
{{classname}} *{{classname}}Service
|
{{classname}} *{{classname}}Service
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
{{/apis}}
|
{{/apis}}
|
||||||
@ -75,7 +77,6 @@ func atoi(in string) (int, error) {
|
|||||||
return strconv.Atoi(in)
|
return strconv.Atoi(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// selectHeaderContentType select a content type from the available list.
|
// selectHeaderContentType select a content type from the available list.
|
||||||
func selectHeaderContentType(contentTypes []string) string {
|
func selectHeaderContentType(contentTypes []string) string {
|
||||||
if len(contentTypes) == 0 {
|
if len(contentTypes) == 0 {
|
||||||
@ -267,7 +268,6 @@ func (c *APIClient) prepareRequest (
|
|||||||
// Add the user agent to the request.
|
// Add the user agent to the request.
|
||||||
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
||||||
|
|
||||||
|
|
||||||
if ctx != nil {
|
if ctx != nil {
|
||||||
// add context to the request
|
// add context to the request
|
||||||
localVarRequest = localVarRequest.WithContext(ctx)
|
localVarRequest = localVarRequest.WithContext(ctx)
|
||||||
@ -303,7 +303,6 @@ func (c *APIClient) prepareRequest (
|
|||||||
return localVarRequest, nil
|
return localVarRequest, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add a file to the multipart request
|
// Add a file to the multipart request
|
||||||
func addFile(w *multipart.Writer, fieldName, path string) error {
|
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||||
file, err := os.Open(path)
|
file, err := os.Open(path)
|
||||||
@ -322,7 +321,7 @@ func addFile(w *multipart.Writer, fieldName, path string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prevent trying to import "fmt"
|
// Prevent trying to import "fmt"
|
||||||
func reportError(format string, a ...interface{}) (error) {
|
func reportError(format string, a ...interface{}) error {
|
||||||
return fmt.Errorf(format, a...)
|
return fmt.Errorf(format, a...)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +375,6 @@ func detectContentType(body interface{}) string {
|
|||||||
return contentType
|
return contentType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
||||||
type cacheControl map[string]string
|
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.
|
// 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.
|
// Figure out when the cache expires.
|
||||||
var expires time.Time
|
var expires time.Time
|
||||||
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
||||||
@ -426,7 +424,6 @@ func CacheExpires(r *http.Response) (time.Time) {
|
|||||||
return expires
|
return expires
|
||||||
}
|
}
|
||||||
|
|
||||||
func strlen(s string) (int) {
|
func strlen(s string) int {
|
||||||
return utf8.RuneCountInString(s)
|
return utf8.RuneCountInString(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,14 +11,22 @@ type {{{name}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/form
|
|||||||
const (
|
const (
|
||||||
{{#allowableValues}}
|
{{#allowableValues}}
|
||||||
{{#enumVars}}
|
{{#enumVars}}
|
||||||
|
{{^-first}}
|
||||||
|
|
||||||
|
{{/-first}}
|
||||||
{{name}} {{{classname}}} = "{{{value}}}"
|
{{name}} {{{classname}}} = "{{{value}}}"
|
||||||
{{/enumVars}}
|
{{/enumVars}}
|
||||||
{{/allowableValues}}
|
{{/allowableValues}}
|
||||||
){{/isEnum}}{{^isEnum}}{{#description}}
|
){{/isEnum}}{{^isEnum}}{{#description}}
|
||||||
// {{{description}}}{{/description}}
|
// {{{description}}}{{/description}}
|
||||||
type {{classname}} struct {
|
type {{classname}} struct {
|
||||||
{{#vars}}{{#description}}
|
{{#vars}}
|
||||||
// {{{description}}}{{/description}}
|
{{^-first}}
|
||||||
|
|
||||||
|
{{/-first}}
|
||||||
|
{{#description}}
|
||||||
|
// {{{description}}}
|
||||||
|
{{/description}}
|
||||||
{{name}} {{^isEnum}}{{^isPrimitiveType}}{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{/isPrimitiveType}}{{/isEnum}}{{{datatype}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"`
|
{{name}} {{^isEnum}}{{^isPrimitiveType}}{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{/isPrimitiveType}}{{/isEnum}}{{{datatype}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"`
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
}{{/isEnum}}{{/model}}{{/models}}
|
}{{/isEnum}}{{/model}}{{/models}}
|
||||||
|
@ -56,7 +56,7 @@ Example
|
|||||||
r, err := client.Service.Operation(auth, args)
|
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"
|
import "golang.org/x/oauth2"
|
||||||
|
|
||||||
|
@ -14,22 +14,23 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"golang.org/x/oauth2"
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
|
||||||
"unicode/utf8"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
"golang.org/x/oauth2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -44,6 +45,7 @@ type APIClient struct {
|
|||||||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||||
|
|
||||||
// API Services
|
// API Services
|
||||||
|
|
||||||
FakeApi *FakeApiService
|
FakeApi *FakeApiService
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +74,6 @@ func atoi(in string) (int, error) {
|
|||||||
return strconv.Atoi(in)
|
return strconv.Atoi(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// selectHeaderContentType select a content type from the available list.
|
// selectHeaderContentType select a content type from the available list.
|
||||||
func selectHeaderContentType(contentTypes []string) string {
|
func selectHeaderContentType(contentTypes []string) string {
|
||||||
if len(contentTypes) == 0 {
|
if len(contentTypes) == 0 {
|
||||||
@ -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 len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
|
||||||
if body != nil {
|
if body != nil {
|
||||||
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
||||||
@ -220,7 +221,7 @@ func (c *APIClient) prepareRequest (
|
|||||||
w.Close()
|
w.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup path and query paramters
|
// Setup path and query parameters
|
||||||
url, err := url.Parse(path)
|
url, err := url.Parse(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -264,7 +265,6 @@ func (c *APIClient) prepareRequest (
|
|||||||
// Add the user agent to the request.
|
// Add the user agent to the request.
|
||||||
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
||||||
|
|
||||||
|
|
||||||
if ctx != nil {
|
if ctx != nil {
|
||||||
// add context to the request
|
// add context to the request
|
||||||
localVarRequest = localVarRequest.WithContext(ctx)
|
localVarRequest = localVarRequest.WithContext(ctx)
|
||||||
@ -300,7 +300,6 @@ func (c *APIClient) prepareRequest (
|
|||||||
return localVarRequest, nil
|
return localVarRequest, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add a file to the multipart request
|
// Add a file to the multipart request
|
||||||
func addFile(w *multipart.Writer, fieldName, path string) error {
|
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||||
file, err := os.Open(path)
|
file, err := os.Open(path)
|
||||||
@ -319,7 +318,7 @@ func addFile(w *multipart.Writer, fieldName, path string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prevent trying to import "fmt"
|
// Prevent trying to import "fmt"
|
||||||
func reportError(format string, a ...interface{}) (error) {
|
func reportError(format string, a ...interface{}) error {
|
||||||
return fmt.Errorf(format, a...)
|
return fmt.Errorf(format, a...)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,7 +372,6 @@ func detectContentType(body interface{}) string {
|
|||||||
return contentType
|
return contentType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
||||||
type cacheControl map[string]string
|
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.
|
// 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.
|
// Figure out when the cache expires.
|
||||||
var expires time.Time
|
var expires time.Time
|
||||||
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
||||||
@ -423,7 +421,6 @@ func CacheExpires(r *http.Response) (time.Time) {
|
|||||||
return expires
|
return expires
|
||||||
}
|
}
|
||||||
|
|
||||||
func strlen(s string) (int) {
|
func strlen(s string) int {
|
||||||
return utf8.RuneCountInString(s)
|
return utf8.RuneCountInString(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,9 @@
|
|||||||
package swagger
|
package swagger
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/url"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
@ -24,7 +25,6 @@ var (
|
|||||||
|
|
||||||
type FakeApiService service
|
type FakeApiService service
|
||||||
|
|
||||||
|
|
||||||
/* FakeApiService To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
/* FakeApiService To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||||
@param optional (nil or map[string]interface{}) with one or more of:
|
@param optional (nil or map[string]interface{}) with one or more of:
|
||||||
@ -44,13 +44,12 @@ func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOpti
|
|||||||
localVarHeaderParams := make(map[string]string)
|
localVarHeaderParams := make(map[string]string)
|
||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
if err := typeCheckParameter(localVarOptionals["testCodeInjectEndRnNR"], "string", "testCodeInjectEndRnNR"); err != nil {
|
if err := typeCheckParameter(localVarOptionals["testCodeInjectEndRnNR"], "string", "testCodeInjectEndRnNR"); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{ "application/json", "*_/ ' =end -- ", }
|
localVarHttpContentTypes := []string{"application/json", "*_/ ' =end -- "}
|
||||||
|
|
||||||
// set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
@ -59,10 +58,7 @@ func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOpti
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/json", "*_/ ' =end -- "}
|
||||||
"application/json",
|
|
||||||
"*_/ ' =end -- ",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -83,9 +79,8 @@ func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOpti
|
|||||||
}
|
}
|
||||||
defer localVarHttpResponse.Body.Close()
|
defer localVarHttpResponse.Body.Close()
|
||||||
if localVarHttpResponse.StatusCode >= 300 {
|
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
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ package swagger
|
|||||||
|
|
||||||
// Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
|
// Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
type ModelReturn struct {
|
type ModelReturn struct {
|
||||||
|
|
||||||
// property description *_/ ' \" =end -- \\r\\n \\n \\r
|
// property description *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
Return_ int32 `json:"return,omitempty"`
|
Return_ int32 `json:"return,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type AdditionalPropertiesClass struct {
|
type AdditionalPropertiesClass struct {
|
||||||
|
|
||||||
MapProperty map[string]string `json:"map_property,omitempty"`
|
MapProperty map[string]string `json:"map_property,omitempty"`
|
||||||
|
|
||||||
MapOfMapProperty map[string]map[string]string `json:"map_of_map_property,omitempty"`
|
MapOfMapProperty map[string]map[string]string `json:"map_of_map_property,omitempty"`
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type Animal struct {
|
type Animal struct {
|
||||||
|
|
||||||
ClassName string `json:"className"`
|
ClassName string `json:"className"`
|
||||||
|
|
||||||
Color string `json:"color,omitempty"`
|
Color string `json:"color,omitempty"`
|
||||||
|
@ -12,8 +12,8 @@ package petstore
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -26,7 +26,6 @@ var (
|
|||||||
|
|
||||||
type AnotherFakeApiService service
|
type AnotherFakeApiService service
|
||||||
|
|
||||||
|
|
||||||
/* AnotherFakeApiService To test special tags
|
/* AnotherFakeApiService To test special tags
|
||||||
To test special tags
|
To test special tags
|
||||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||||
@ -48,9 +47,8 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{ "application/json", }
|
localVarHttpContentTypes := []string{"application/json"}
|
||||||
|
|
||||||
// set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
@ -59,9 +57,7 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -89,7 +85,5 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client
|
|||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,22 +14,23 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"golang.org/x/oauth2"
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
|
||||||
"unicode/utf8"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
"golang.org/x/oauth2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -44,11 +45,17 @@ type APIClient struct {
|
|||||||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||||
|
|
||||||
// API Services
|
// API Services
|
||||||
|
|
||||||
AnotherFakeApi *AnotherFakeApiService
|
AnotherFakeApi *AnotherFakeApiService
|
||||||
|
|
||||||
FakeApi *FakeApiService
|
FakeApi *FakeApiService
|
||||||
|
|
||||||
FakeClassnameTags123Api *FakeClassnameTags123ApiService
|
FakeClassnameTags123Api *FakeClassnameTags123ApiService
|
||||||
|
|
||||||
PetApi *PetApiService
|
PetApi *PetApiService
|
||||||
|
|
||||||
StoreApi *StoreApiService
|
StoreApi *StoreApiService
|
||||||
|
|
||||||
UserApi *UserApiService
|
UserApi *UserApiService
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +89,6 @@ func atoi(in string) (int, error) {
|
|||||||
return strconv.Atoi(in)
|
return strconv.Atoi(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// selectHeaderContentType select a content type from the available list.
|
// selectHeaderContentType select a content type from the available list.
|
||||||
func selectHeaderContentType(contentTypes []string) string {
|
func selectHeaderContentType(contentTypes []string) string {
|
||||||
if len(contentTypes) == 0 {
|
if len(contentTypes) == 0 {
|
||||||
@ -274,7 +280,6 @@ func (c *APIClient) prepareRequest (
|
|||||||
// Add the user agent to the request.
|
// Add the user agent to the request.
|
||||||
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
||||||
|
|
||||||
|
|
||||||
if ctx != nil {
|
if ctx != nil {
|
||||||
// add context to the request
|
// add context to the request
|
||||||
localVarRequest = localVarRequest.WithContext(ctx)
|
localVarRequest = localVarRequest.WithContext(ctx)
|
||||||
@ -310,7 +315,6 @@ func (c *APIClient) prepareRequest (
|
|||||||
return localVarRequest, nil
|
return localVarRequest, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add a file to the multipart request
|
// Add a file to the multipart request
|
||||||
func addFile(w *multipart.Writer, fieldName, path string) error {
|
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||||
file, err := os.Open(path)
|
file, err := os.Open(path)
|
||||||
@ -329,7 +333,7 @@ func addFile(w *multipart.Writer, fieldName, path string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prevent trying to import "fmt"
|
// Prevent trying to import "fmt"
|
||||||
func reportError(format string, a ...interface{}) (error) {
|
func reportError(format string, a ...interface{}) error {
|
||||||
return fmt.Errorf(format, a...)
|
return fmt.Errorf(format, a...)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,7 +387,6 @@ func detectContentType(body interface{}) string {
|
|||||||
return contentType
|
return contentType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
||||||
type cacheControl map[string]string
|
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.
|
// 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.
|
// Figure out when the cache expires.
|
||||||
var expires time.Time
|
var expires time.Time
|
||||||
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
||||||
@ -433,7 +436,6 @@ func CacheExpires(r *http.Response) (time.Time) {
|
|||||||
return expires
|
return expires
|
||||||
}
|
}
|
||||||
|
|
||||||
func strlen(s string) (int) {
|
func strlen(s string) int {
|
||||||
return utf8.RuneCountInString(s)
|
return utf8.RuneCountInString(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,5 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type ArrayOfArrayOfNumberOnly struct {
|
type ArrayOfArrayOfNumberOnly struct {
|
||||||
|
|
||||||
ArrayArrayNumber [][]float32 `json:"ArrayArrayNumber,omitempty"`
|
ArrayArrayNumber [][]float32 `json:"ArrayArrayNumber,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,5 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type ArrayOfNumberOnly struct {
|
type ArrayOfNumberOnly struct {
|
||||||
|
|
||||||
ArrayNumber []float32 `json:"ArrayNumber,omitempty"`
|
ArrayNumber []float32 `json:"ArrayNumber,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type ArrayTest struct {
|
type ArrayTest struct {
|
||||||
|
|
||||||
ArrayOfString []string `json:"array_of_string,omitempty"`
|
ArrayOfString []string `json:"array_of_string,omitempty"`
|
||||||
|
|
||||||
ArrayArrayOfInteger [][]int64 `json:"array_array_of_integer,omitempty"`
|
ArrayArrayOfInteger [][]int64 `json:"array_array_of_integer,omitempty"`
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type Capitalization struct {
|
type Capitalization struct {
|
||||||
|
|
||||||
SmallCamel string `json:"smallCamel,omitempty"`
|
SmallCamel string `json:"smallCamel,omitempty"`
|
||||||
|
|
||||||
CapitalCamel string `json:"CapitalCamel,omitempty"`
|
CapitalCamel string `json:"CapitalCamel,omitempty"`
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type Cat struct {
|
type Cat struct {
|
||||||
|
|
||||||
ClassName string `json:"className"`
|
ClassName string `json:"className"`
|
||||||
|
|
||||||
Color string `json:"color,omitempty"`
|
Color string `json:"color,omitempty"`
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type Category struct {
|
type Category struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
|
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
|
@ -12,6 +12,5 @@ package petstore
|
|||||||
|
|
||||||
// Model for testing model with \"_class\" property
|
// Model for testing model with \"_class\" property
|
||||||
type ClassModel struct {
|
type ClassModel struct {
|
||||||
|
|
||||||
Class string `json:"_class,omitempty"`
|
Class string `json:"_class,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,5 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
|
|
||||||
Client string `json:"client,omitempty"`
|
Client string `json:"client,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type Dog struct {
|
type Dog struct {
|
||||||
|
|
||||||
ClassName string `json:"className"`
|
ClassName string `json:"className"`
|
||||||
|
|
||||||
Color string `json:"color,omitempty"`
|
Color string `json:"color,omitempty"`
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type EnumArrays struct {
|
type EnumArrays struct {
|
||||||
|
|
||||||
JustSymbol string `json:"just_symbol,omitempty"`
|
JustSymbol string `json:"just_symbol,omitempty"`
|
||||||
|
|
||||||
ArrayEnum []string `json:"array_enum,omitempty"`
|
ArrayEnum []string `json:"array_enum,omitempty"`
|
||||||
|
@ -15,6 +15,8 @@ type EnumClass string
|
|||||||
// List of EnumClass
|
// List of EnumClass
|
||||||
const (
|
const (
|
||||||
ABC EnumClass = "_abc"
|
ABC EnumClass = "_abc"
|
||||||
|
|
||||||
EFG EnumClass = "-efg"
|
EFG EnumClass = "-efg"
|
||||||
|
|
||||||
XYZ EnumClass = "(xyz)"
|
XYZ EnumClass = "(xyz)"
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type EnumTest struct {
|
type EnumTest struct {
|
||||||
|
|
||||||
EnumString string `json:"enum_string,omitempty"`
|
EnumString string `json:"enum_string,omitempty"`
|
||||||
|
|
||||||
EnumInteger int32 `json:"enum_integer,omitempty"`
|
EnumInteger int32 `json:"enum_integer,omitempty"`
|
||||||
|
@ -12,8 +12,8 @@ package petstore
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"time"
|
"time"
|
||||||
@ -27,7 +27,6 @@ var (
|
|||||||
|
|
||||||
type FakeApiService service
|
type FakeApiService service
|
||||||
|
|
||||||
|
|
||||||
/* FakeApiService
|
/* FakeApiService
|
||||||
Test serialization of outer boolean types
|
Test serialization of outer boolean types
|
||||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||||
@ -50,7 +49,6 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -61,8 +59,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{}
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -92,7 +89,6 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar
|
|||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +114,6 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -129,8 +124,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{}
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -160,7 +154,6 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV
|
|||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +179,6 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -197,8 +189,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{}
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -228,7 +219,6 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO
|
|||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +244,6 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -265,8 +254,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{}
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -296,7 +284,6 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
|
|||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,9 +308,8 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Clie
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{ "application/json", }
|
localVarHttpContentTypes := []string{"application/json"}
|
||||||
|
|
||||||
// set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
@ -332,9 +318,7 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Clie
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -362,7 +346,6 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Clie
|
|||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +382,6 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
|
|||||||
localVarHeaderParams := make(map[string]string)
|
localVarHeaderParams := make(map[string]string)
|
||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
if number < 32.1 {
|
if number < 32.1 {
|
||||||
return nil, reportError("number must be greater than 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
|
// 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
|
// set Content-Type header
|
||||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
@ -453,10 +435,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml; charset=utf-8", "application/json; charset=utf-8"}
|
||||||
"application/xml; charset=utf-8",
|
|
||||||
"application/json; charset=utf-8",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -511,7 +490,6 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,7 +520,6 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
|
|||||||
localVarHeaderParams := make(map[string]string)
|
localVarHeaderParams := make(map[string]string)
|
||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
if err := typeCheckParameter(localVarOptionals["enumFormString"], "string", "enumFormString"); err != nil {
|
if err := typeCheckParameter(localVarOptionals["enumFormString"], "string", "enumFormString"); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -569,7 +546,7 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
|
|||||||
localVarQueryParams.Add("enum_query_integer", parameterToString(localVarTempParam, ""))
|
localVarQueryParams.Add("enum_query_integer", parameterToString(localVarTempParam, ""))
|
||||||
}
|
}
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{ "*/*", }
|
localVarHttpContentTypes := []string{"*/*"}
|
||||||
|
|
||||||
// set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
@ -578,9 +555,7 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"*/*"}
|
||||||
"*/*",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -616,7 +591,6 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -640,9 +614,8 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, par
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{ "application/json", }
|
localVarHttpContentTypes := []string{"application/json"}
|
||||||
|
|
||||||
// set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
@ -651,8 +624,7 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, par
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{}
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -675,7 +647,6 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, par
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,9 +671,8 @@ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, par
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{ "application/json", }
|
localVarHttpContentTypes := []string{"application/json"}
|
||||||
|
|
||||||
// set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
@ -711,8 +681,7 @@ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, par
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{}
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -735,7 +704,5 @@ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, par
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ package petstore
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -26,7 +26,6 @@ var (
|
|||||||
|
|
||||||
type FakeClassnameTags123ApiService service
|
type FakeClassnameTags123ApiService service
|
||||||
|
|
||||||
|
|
||||||
/* FakeClassnameTags123ApiService To test class name in snake case
|
/* FakeClassnameTags123ApiService To test class name in snake case
|
||||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||||
@param body client model
|
@param body client model
|
||||||
@ -47,9 +46,8 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{ "application/json", }
|
localVarHttpContentTypes := []string{"application/json"}
|
||||||
|
|
||||||
// set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
@ -58,9 +56,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -100,7 +96,5 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body
|
|||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type FormatTest struct {
|
type FormatTest struct {
|
||||||
|
|
||||||
Integer int32 `json:"integer,omitempty"`
|
Integer int32 `json:"integer,omitempty"`
|
||||||
|
|
||||||
Int32_ int32 `json:"int32,omitempty"`
|
Int32_ int32 `json:"int32,omitempty"`
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type HasOnlyReadOnly struct {
|
type HasOnlyReadOnly struct {
|
||||||
|
|
||||||
Bar string `json:"bar,omitempty"`
|
Bar string `json:"bar,omitempty"`
|
||||||
|
|
||||||
Foo string `json:"foo,omitempty"`
|
Foo string `json:"foo,omitempty"`
|
||||||
|
@ -11,6 +11,5 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type List struct {
|
type List struct {
|
||||||
|
|
||||||
Var123List string `json:"123-list,omitempty"`
|
Var123List string `json:"123-list,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type MapTest struct {
|
type MapTest struct {
|
||||||
|
|
||||||
MapMapOfString map[string]map[string]string `json:"map_map_of_string,omitempty"`
|
MapMapOfString map[string]map[string]string `json:"map_map_of_string,omitempty"`
|
||||||
|
|
||||||
MapOfEnumString map[string]string `json:"map_of_enum_string,omitempty"`
|
MapOfEnumString map[string]string `json:"map_of_enum_string,omitempty"`
|
||||||
|
@ -15,7 +15,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type MixedPropertiesAndAdditionalPropertiesClass struct {
|
type MixedPropertiesAndAdditionalPropertiesClass struct {
|
||||||
|
|
||||||
Uuid string `json:"uuid,omitempty"`
|
Uuid string `json:"uuid,omitempty"`
|
||||||
|
|
||||||
DateTime time.Time `json:"dateTime,omitempty"`
|
DateTime time.Time `json:"dateTime,omitempty"`
|
||||||
|
@ -12,7 +12,6 @@ package petstore
|
|||||||
|
|
||||||
// Model for testing model name starting with number
|
// Model for testing model name starting with number
|
||||||
type Model200Response struct {
|
type Model200Response struct {
|
||||||
|
|
||||||
Name int32 `json:"name,omitempty"`
|
Name int32 `json:"name,omitempty"`
|
||||||
|
|
||||||
Class string `json:"class,omitempty"`
|
Class string `json:"class,omitempty"`
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type ModelApiResponse struct {
|
type ModelApiResponse struct {
|
||||||
|
|
||||||
Code int32 `json:"code,omitempty"`
|
Code int32 `json:"code,omitempty"`
|
||||||
|
|
||||||
Type_ string `json:"type,omitempty"`
|
Type_ string `json:"type,omitempty"`
|
||||||
|
@ -12,6 +12,5 @@ package petstore
|
|||||||
|
|
||||||
// Model for testing reserved words
|
// Model for testing reserved words
|
||||||
type ModelReturn struct {
|
type ModelReturn struct {
|
||||||
|
|
||||||
Return_ int32 `json:"return,omitempty"`
|
Return_ int32 `json:"return,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ package petstore
|
|||||||
|
|
||||||
// Model for testing model name same as property name
|
// Model for testing model name same as property name
|
||||||
type Name struct {
|
type Name struct {
|
||||||
|
|
||||||
Name int32 `json:"name"`
|
Name int32 `json:"name"`
|
||||||
|
|
||||||
SnakeCase int32 `json:"snake_case,omitempty"`
|
SnakeCase int32 `json:"snake_case,omitempty"`
|
||||||
|
@ -11,6 +11,5 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type NumberOnly struct {
|
type NumberOnly struct {
|
||||||
|
|
||||||
JustNumber float32 `json:"JustNumber,omitempty"`
|
JustNumber float32 `json:"JustNumber,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Order struct {
|
type Order struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
|
|
||||||
PetId int64 `json:"petId,omitempty"`
|
PetId int64 `json:"petId,omitempty"`
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type OuterComposite struct {
|
type OuterComposite struct {
|
||||||
|
|
||||||
MyNumber *OuterNumber `json:"my_number,omitempty"`
|
MyNumber *OuterNumber `json:"my_number,omitempty"`
|
||||||
|
|
||||||
MyString *OuterString `json:"my_string,omitempty"`
|
MyString *OuterString `json:"my_string,omitempty"`
|
||||||
|
@ -15,6 +15,8 @@ type OuterEnum string
|
|||||||
// List of OuterEnum
|
// List of OuterEnum
|
||||||
const (
|
const (
|
||||||
PLACED OuterEnum = "placed"
|
PLACED OuterEnum = "placed"
|
||||||
|
|
||||||
APPROVED OuterEnum = "approved"
|
APPROVED OuterEnum = "approved"
|
||||||
|
|
||||||
DELIVERED OuterEnum = "delivered"
|
DELIVERED OuterEnum = "delivered"
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type Pet struct {
|
type Pet struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
|
|
||||||
Category *Category `json:"category,omitempty"`
|
Category *Category `json:"category,omitempty"`
|
||||||
|
@ -12,8 +12,8 @@ package petstore
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"os"
|
"os"
|
||||||
@ -28,7 +28,6 @@ var (
|
|||||||
|
|
||||||
type PetApiService service
|
type PetApiService service
|
||||||
|
|
||||||
|
|
||||||
/* PetApiService Add a new pet to the store
|
/* PetApiService Add a new pet to the store
|
||||||
|
|
||||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||||
@ -49,9 +48,8 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) ( *http.Response,
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{ "application/json", "application/xml", }
|
localVarHttpContentTypes := []string{"application/json", "application/xml"}
|
||||||
|
|
||||||
// set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
@ -60,10 +58,7 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) ( *http.Response,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -86,7 +81,6 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) ( *http.Response,
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +106,6 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
|||||||
localVarHeaderParams := make(map[string]string)
|
localVarHeaderParams := make(map[string]string)
|
||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
if err := typeCheckParameter(localVarOptionals["apiKey"], "string", "apiKey"); err != nil {
|
if err := typeCheckParameter(localVarOptionals["apiKey"], "string", "apiKey"); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -127,10 +120,7 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -154,7 +144,6 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +168,6 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
localVarQueryParams.Add("status", parameterToString(status, "csv"))
|
localVarQueryParams.Add("status", parameterToString(status, "csv"))
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
@ -191,10 +179,7 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -220,7 +205,6 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
|
|||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +229,6 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
localVarQueryParams.Add("tags", parameterToString(tags, "csv"))
|
localVarQueryParams.Add("tags", parameterToString(tags, "csv"))
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
@ -257,10 +240,7 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -286,7 +266,6 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
|
|||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,7 +291,6 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *htt
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -323,10 +301,7 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *htt
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -364,7 +339,6 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *htt
|
|||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,9 +362,8 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) ( *http.Respons
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{ "application/json", "application/xml", }
|
localVarHttpContentTypes := []string{"application/json", "application/xml"}
|
||||||
|
|
||||||
// set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
@ -399,10 +372,7 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) ( *http.Respons
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -425,7 +395,6 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) ( *http.Respons
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,7 +421,6 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
|||||||
localVarHeaderParams := make(map[string]string)
|
localVarHeaderParams := make(map[string]string)
|
||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
if err := typeCheckParameter(localVarOptionals["name"], "string", "name"); err != nil {
|
if err := typeCheckParameter(localVarOptionals["name"], "string", "name"); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -461,7 +429,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{ "application/x-www-form-urlencoded", }
|
localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"}
|
||||||
|
|
||||||
// set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
@ -470,10 +438,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -500,7 +465,6 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,13 +492,12 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
|||||||
localVarHeaderParams := make(map[string]string)
|
localVarHeaderParams := make(map[string]string)
|
||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
if err := typeCheckParameter(localVarOptionals["additionalMetadata"], "string", "additionalMetadata"); err != nil {
|
if err := typeCheckParameter(localVarOptionals["additionalMetadata"], "string", "additionalMetadata"); err != nil {
|
||||||
return successPayload, nil, err
|
return successPayload, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{ "multipart/form-data", }
|
localVarHttpContentTypes := []string{"multipart/form-data"}
|
||||||
|
|
||||||
// set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
@ -543,9 +506,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type ReadOnlyFirst struct {
|
type ReadOnlyFirst struct {
|
||||||
|
|
||||||
Bar string `json:"bar,omitempty"`
|
Bar string `json:"bar,omitempty"`
|
||||||
|
|
||||||
Baz string `json:"baz,omitempty"`
|
Baz string `json:"baz,omitempty"`
|
||||||
|
@ -11,6 +11,5 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type SpecialModelName struct {
|
type SpecialModelName struct {
|
||||||
|
|
||||||
SpecialPropertyName int64 `json:"$special[property.name],omitempty"`
|
SpecialPropertyName int64 `json:"$special[property.name],omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ package petstore
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -27,7 +27,6 @@ var (
|
|||||||
|
|
||||||
type StoreApiService service
|
type StoreApiService service
|
||||||
|
|
||||||
|
|
||||||
/* StoreApiService Delete purchase order by ID
|
/* 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 ctx context.Context for authentication, logging, tracing, etc.
|
||||||
@ -49,7 +48,6 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) ( *ht
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -60,10 +58,7 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) ( *ht
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -84,7 +79,6 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) ( *ht
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +102,6 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32,
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -119,9 +112,7 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -159,7 +150,6 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32,
|
|||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +174,6 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
|
|||||||
localVarHeaderParams := make(map[string]string)
|
localVarHeaderParams := make(map[string]string)
|
||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
if orderId < 1 {
|
if orderId < 1 {
|
||||||
return successPayload, nil, reportError("orderId must be greater than 1")
|
return successPayload, nil, reportError("orderId must be greater than 1")
|
||||||
}
|
}
|
||||||
@ -202,10 +191,7 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -231,7 +217,6 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
|
|||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +241,6 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -267,10 +251,7 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type Tag struct {
|
type Tag struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
|
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
|
|
||||||
Username string `json:"username,omitempty"`
|
Username string `json:"username,omitempty"`
|
||||||
|
@ -12,8 +12,8 @@ package petstore
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -27,7 +27,6 @@ var (
|
|||||||
|
|
||||||
type UserApiService service
|
type UserApiService service
|
||||||
|
|
||||||
|
|
||||||
/* UserApiService Create user
|
/* 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 ctx context.Context for authentication, logging, tracing, etc.
|
||||||
@ -48,7 +47,6 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) ( *http.Resp
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -59,10 +57,7 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) ( *http.Resp
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -85,7 +80,6 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) ( *http.Resp
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +103,6 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -120,10 +113,7 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -146,7 +136,6 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +159,6 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -181,10 +169,7 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -207,7 +192,6 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +216,6 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) ( *htt
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -243,10 +226,7 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) ( *htt
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -267,7 +247,6 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) ( *htt
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +272,6 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -304,10 +282,7 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -333,7 +308,6 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
|
|||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,7 +333,6 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
localVarQueryParams.Add("username", parameterToString(username, ""))
|
localVarQueryParams.Add("username", parameterToString(username, ""))
|
||||||
localVarQueryParams.Add("password", parameterToString(password, ""))
|
localVarQueryParams.Add("password", parameterToString(password, ""))
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -372,10 +345,7 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -401,7 +371,6 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
|
|||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return successPayload, localVarHttpResponse, err
|
return successPayload, localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,7 +393,6 @@ func (a *UserApiService) LogoutUser(ctx context.Context) ( *http.Response, error
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -435,10 +403,7 @@ func (a *UserApiService) LogoutUser(ctx context.Context) ( *http.Response, error
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -459,7 +424,6 @@ func (a *UserApiService) LogoutUser(ctx context.Context) ( *http.Response, error
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,7 +449,6 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body U
|
|||||||
localVarQueryParams := url.Values{}
|
localVarQueryParams := url.Values{}
|
||||||
localVarFormParams := url.Values{}
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{}
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
@ -496,10 +459,7 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body U
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
"application/xml",
|
|
||||||
"application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
@ -522,7 +482,5 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body U
|
|||||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return localVarHttpResponse, err
|
return localVarHttpResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user