mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 12:40:53 +00:00
Update go client, fix double body read (#211)
This commit is contained in:
parent
949ef4453a
commit
5d8362d859
0
bin/go-petstore-withxml.sh
Normal file → Executable file
0
bin/go-petstore-withxml.sh
Normal file → Executable file
@ -244,11 +244,6 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
||||
}
|
||||
{{#responses}}{{#dataType}}
|
||||
if localVarHttpResponse.StatusCode == {{{code}}} {
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
if err != nil {
|
||||
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, err
|
||||
}
|
||||
|
||||
var v {{{dataType}}}
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
|
@ -1 +1 @@
|
||||
2.3.0-SNAPSHOT
|
||||
3.0.0-SNAPSHOT
|
@ -7,17 +7,17 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge
|
||||
|
||||
- API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
- Package version: 1.0.0
|
||||
- Build package: io.swagger.codegen.languages.GoClientCodegen
|
||||
- Build package: org.openapitools.codegen.languages.GoClientCodegen
|
||||
|
||||
## Installation
|
||||
Put the package under your project folder and add the following in import:
|
||||
```
|
||||
"./swagger"
|
||||
```golang
|
||||
import "./swagger"
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
|
||||
All URIs are relative to *petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
@ -35,12 +35,12 @@ Class | Method | HTTP request | Description
|
||||
- **Type**: API key
|
||||
|
||||
Example
|
||||
```
|
||||
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
|
||||
Key: "APIKEY",
|
||||
Prefix: "Bearer", // Omit if not necessary.
|
||||
})
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
```golang
|
||||
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
|
||||
Key: "APIKEY",
|
||||
Prefix: "Bearer", // Omit if not necessary.
|
||||
})
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
```
|
||||
## petstore_auth
|
||||
- **Type**: OAuth
|
||||
@ -51,20 +51,20 @@ Example
|
||||
- **read:pets**: read your pets *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
Example
|
||||
```
|
||||
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
```golang
|
||||
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
```
|
||||
|
||||
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
|
||||
```
|
||||
import "golang.org/x/oauth2"
|
||||
```golang
|
||||
import "golang.org/x/oauth2"
|
||||
|
||||
/ .. Perform OAuth2 round trip request and obtain a token .. //
|
||||
/* Perform OAuth2 round trip request and obtain a token */
|
||||
|
||||
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
|
||||
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
|
||||
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
```
|
||||
|
||||
## Author
|
||||
|
74
samples/client/petstore-security-test/go/api/openapi.yaml
Normal file
74
samples/client/petstore-security-test/go/api/openapi.yaml
Normal file
@ -0,0 +1,74 @@
|
||||
openapi: 3.0.1
|
||||
info:
|
||||
title: Swagger Petstore */ ' " =end -- \r\n \n \r
|
||||
description: "This spec is mainly for testing Petstore server and contains fake\
|
||||
\ endpoints, models. Please do not use this for any other purpose. Special characters:\
|
||||
\ \" \\ */ ' \" =end -- \r\n \n \r"
|
||||
termsOfService: http://swagger.io/terms/ */ ' " =end -- \r\n \n \r
|
||||
contact:
|
||||
email: apiteam@swagger.io */ ' " =end -- \r\n \n \r
|
||||
license:
|
||||
name: Apache-2.0 */ ' " =end -- \r\n \n \r
|
||||
url: http://www.apache.org/licenses/LICENSE-2.0.html */ ' " =end -- \r\n \n \r
|
||||
version: 1.0.0 */ ' " =end -- \r\n \n \r
|
||||
externalDocs:
|
||||
description: Find out more about Swagger */ ' " =end -- \r\n \n \r
|
||||
url: http://swagger.io
|
||||
servers:
|
||||
- url: petstore.swagger.io */ ' " =end -- \r\n \n \r/v2 */ ' " =end -- \r\n \n \r
|
||||
tags:
|
||||
- name: fake
|
||||
description: Everything about your Pets */ ' " =end -- \r\n \n \r
|
||||
externalDocs:
|
||||
description: Find out more */ ' " =end -- \r\n \n \r
|
||||
url: http://swagger.io
|
||||
paths:
|
||||
/fake:
|
||||
put:
|
||||
tags:
|
||||
- fake
|
||||
summary: To test code injection */ ' " =end -- \r\n \n \r
|
||||
operationId: testCodeInject */ ' " =end -- \r\n \n \r
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
test code inject */ ' " =end -- \r\n \n \r:
|
||||
type: string
|
||||
description: To test code injection */ ' " =end -- \r\n \n \r
|
||||
? "*/ ' \" =end -- \r\n \n \r"
|
||||
: schema:
|
||||
properties:
|
||||
test code inject */ ' " =end -- \r\n \n \r:
|
||||
type: string
|
||||
description: To test code injection */ ' " =end -- \r\n \n \r
|
||||
responses:
|
||||
400:
|
||||
description: To test code injection */ ' " =end -- \r\n \n \r
|
||||
content: {}
|
||||
components:
|
||||
schemas:
|
||||
Return:
|
||||
type: object
|
||||
properties:
|
||||
return:
|
||||
type: integer
|
||||
description: property description */ ' " =end -- \r\n \n \r
|
||||
format: int32
|
||||
description: Model for testing reserved words */ ' " =end -- \r\n \n \r
|
||||
xml:
|
||||
name: Return
|
||||
securitySchemes:
|
||||
petstore_auth:
|
||||
type: oauth2
|
||||
flows:
|
||||
implicit:
|
||||
authorizationUrl: http://petstore.swagger.io/api/oauth/dialog
|
||||
scopes:
|
||||
write:pets: modify pets in your account */ ' " =end -- \r\n \n \r
|
||||
read:pets: read your pets */ ' " =end -- \r\n \n \r
|
||||
api_key:
|
||||
type: apiKey
|
||||
name: api_key */ ' " =end -- \r\n \n \r
|
||||
in: header
|
110
samples/client/petstore-security-test/go/api_fake.go
Normal file
110
samples/client/petstore-security-test/go/api_fake.go
Normal file
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
||||
*
|
||||
* API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"context"
|
||||
)
|
||||
|
||||
// Linger please
|
||||
var (
|
||||
_ context.Context
|
||||
)
|
||||
|
||||
type FakeApiService service
|
||||
|
||||
/*
|
||||
FakeApiService To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param optional nil or *TestCodeInjectEndRnNROpts - Optional Parameters:
|
||||
* @param "" (optional.Interface of ErrorUnknown) -
|
||||
|
||||
|
||||
*/
|
||||
|
||||
type TestCodeInjectEndRnNROpts struct {
|
||||
optional.Interface
|
||||
}
|
||||
|
||||
func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOptionals *TestCodeInjectEndRnNROpts) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Put")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/fake"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"application/json", "*_/ ' =end -- "}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
|
||||
localVarOptional, localVarOptionalok := localVarOptionals..Value().(ErrorUnknown)
|
||||
if !localVarOptionalok {
|
||||
return nil, reportError("uNKNOWNBASETYPE should be ErrorUnknown")
|
||||
}
|
||||
localVarPostBody = &localVarOptional
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
465
samples/client/petstore-security-test/go/client.go
Normal file
465
samples/client/petstore-security-test/go/client.go
Normal file
@ -0,0 +1,465 @@
|
||||
/*
|
||||
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
||||
*
|
||||
* API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"context"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
var (
|
||||
jsonCheck = regexp.MustCompile("(?i:[application|text]/json)")
|
||||
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
|
||||
)
|
||||
|
||||
// APIClient manages communication with the Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r API v1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
// In most cases there should be only one, shared, APIClient.
|
||||
type APIClient struct {
|
||||
cfg *Configuration
|
||||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||
|
||||
// API Services
|
||||
|
||||
FakeApi *FakeApiService
|
||||
}
|
||||
|
||||
type service struct {
|
||||
client *APIClient
|
||||
}
|
||||
|
||||
// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
|
||||
// optionally a custom http.Client to allow for advanced features such as caching.
|
||||
func NewAPIClient(cfg *Configuration) *APIClient {
|
||||
if cfg.HTTPClient == nil {
|
||||
cfg.HTTPClient = http.DefaultClient
|
||||
}
|
||||
|
||||
c := &APIClient{}
|
||||
c.cfg = cfg
|
||||
c.common.client = c
|
||||
|
||||
// API Services
|
||||
c.FakeApi = (*FakeApiService)(&c.common)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func atoi(in string) (int, error) {
|
||||
return strconv.Atoi(in)
|
||||
}
|
||||
|
||||
// selectHeaderContentType select a content type from the available list.
|
||||
func selectHeaderContentType(contentTypes []string) string {
|
||||
if len(contentTypes) == 0 {
|
||||
return ""
|
||||
}
|
||||
if contains(contentTypes, "application/json") {
|
||||
return "application/json"
|
||||
}
|
||||
return contentTypes[0] // use the first content type specified in 'consumes'
|
||||
}
|
||||
|
||||
// selectHeaderAccept join all accept types and return
|
||||
func selectHeaderAccept(accepts []string) string {
|
||||
if len(accepts) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if contains(accepts, "application/json") {
|
||||
return "application/json"
|
||||
}
|
||||
|
||||
return strings.Join(accepts, ",")
|
||||
}
|
||||
|
||||
// contains is a case insenstive match, finding needle in a haystack
|
||||
func contains(haystack []string, needle string) bool {
|
||||
for _, a := range haystack {
|
||||
if strings.ToLower(a) == strings.ToLower(needle) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Verify optional parameters are of the correct type.
|
||||
func typeCheckParameter(obj interface{}, expected string, name string) error {
|
||||
// Make sure there is an object.
|
||||
if obj == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check the type is as expected.
|
||||
if reflect.TypeOf(obj).String() != expected {
|
||||
return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
|
||||
func parameterToString(obj interface{}, collectionFormat string) string {
|
||||
var delimiter string
|
||||
|
||||
switch collectionFormat {
|
||||
case "pipes":
|
||||
delimiter = "|"
|
||||
case "ssv":
|
||||
delimiter = " "
|
||||
case "tsv":
|
||||
delimiter = "\t"
|
||||
case "csv":
|
||||
delimiter = ","
|
||||
}
|
||||
|
||||
if reflect.TypeOf(obj).Kind() == reflect.Slice {
|
||||
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%v", obj)
|
||||
}
|
||||
|
||||
// callAPI do the request.
|
||||
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
|
||||
return c.cfg.HTTPClient.Do(request)
|
||||
}
|
||||
|
||||
// Change base path to allow switching to mocks
|
||||
func (c *APIClient) ChangeBasePath(path string) {
|
||||
c.cfg.BasePath = path
|
||||
}
|
||||
|
||||
// prepareRequest build the request
|
||||
func (c *APIClient) prepareRequest(
|
||||
ctx context.Context,
|
||||
path string, method string,
|
||||
postBody interface{},
|
||||
headerParams map[string]string,
|
||||
queryParams url.Values,
|
||||
formParams url.Values,
|
||||
fileName string,
|
||||
fileBytes []byte) (localVarRequest *http.Request, err error) {
|
||||
|
||||
var body *bytes.Buffer
|
||||
|
||||
// Detect postBody type and post.
|
||||
if postBody != nil {
|
||||
contentType := headerParams["Content-Type"]
|
||||
if contentType == "" {
|
||||
contentType = detectContentType(postBody)
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
body, err = setBody(postBody, contentType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// add form parameters and file if available.
|
||||
if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
|
||||
if body != nil {
|
||||
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
||||
}
|
||||
body = &bytes.Buffer{}
|
||||
w := multipart.NewWriter(body)
|
||||
|
||||
for k, v := range formParams {
|
||||
for _, iv := range v {
|
||||
if strings.HasPrefix(k, "@") { // file
|
||||
err = addFile(w, k[1:], iv)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else { // form value
|
||||
w.WriteField(k, iv)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(fileBytes) > 0 && fileName != "" {
|
||||
w.Boundary()
|
||||
//_, fileNm := filepath.Split(fileName)
|
||||
part, err := w.CreateFormFile("file", filepath.Base(fileName))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_, err = part.Write(fileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Set the Boundary in the Content-Type
|
||||
headerParams["Content-Type"] = w.FormDataContentType()
|
||||
}
|
||||
|
||||
// Set Content-Length
|
||||
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
||||
w.Close()
|
||||
}
|
||||
|
||||
// Setup path and query parameters
|
||||
url, err := url.Parse(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Adding Query Param
|
||||
query := url.Query()
|
||||
for k, v := range queryParams {
|
||||
for _, iv := range v {
|
||||
query.Add(k, iv)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode the parameters.
|
||||
url.RawQuery = query.Encode()
|
||||
|
||||
// Generate a new request
|
||||
if body != nil {
|
||||
localVarRequest, err = http.NewRequest(method, url.String(), body)
|
||||
} else {
|
||||
localVarRequest, err = http.NewRequest(method, url.String(), nil)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// add header parameters, if any
|
||||
if len(headerParams) > 0 {
|
||||
headers := http.Header{}
|
||||
for h, v := range headerParams {
|
||||
headers.Set(h, v)
|
||||
}
|
||||
localVarRequest.Header = headers
|
||||
}
|
||||
|
||||
// Override request host, if applicable
|
||||
if c.cfg.Host != "" {
|
||||
localVarRequest.Host = c.cfg.Host
|
||||
}
|
||||
|
||||
// Add the user agent to the request.
|
||||
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
||||
|
||||
if ctx != nil {
|
||||
// add context to the request
|
||||
localVarRequest = localVarRequest.WithContext(ctx)
|
||||
|
||||
// Walk through any authentication.
|
||||
|
||||
// OAuth2 authentication
|
||||
if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {
|
||||
// We were able to grab an oauth2 token from the context
|
||||
var latestToken *oauth2.Token
|
||||
if latestToken, err = tok.Token(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
latestToken.SetAuthHeader(localVarRequest)
|
||||
}
|
||||
|
||||
// Basic HTTP Authentication
|
||||
if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {
|
||||
localVarRequest.SetBasicAuth(auth.UserName, auth.Password)
|
||||
}
|
||||
|
||||
// AccessToken Authentication
|
||||
if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
|
||||
localVarRequest.Header.Add("Authorization", "Bearer "+auth)
|
||||
}
|
||||
}
|
||||
|
||||
for header, value := range c.cfg.DefaultHeader {
|
||||
localVarRequest.Header.Add(header, value)
|
||||
}
|
||||
|
||||
return localVarRequest, nil
|
||||
}
|
||||
|
||||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.Unmarshal(b, v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
} else if strings.Contains(contentType, "application/json") {
|
||||
if err = json.Unmarshal(b, v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return errors.New("undefined response type")
|
||||
}
|
||||
|
||||
// Add a file to the multipart request
|
||||
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
part, err := w.CreateFormFile(fieldName, filepath.Base(path))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = io.Copy(part, file)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// Prevent trying to import "fmt"
|
||||
func reportError(format string, a ...interface{}) error {
|
||||
return fmt.Errorf(format, a...)
|
||||
}
|
||||
|
||||
// Set request body from an interface{}
|
||||
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
|
||||
if bodyBuf == nil {
|
||||
bodyBuf = &bytes.Buffer{}
|
||||
}
|
||||
|
||||
if reader, ok := body.(io.Reader); ok {
|
||||
_, err = bodyBuf.ReadFrom(reader)
|
||||
} else if b, ok := body.([]byte); ok {
|
||||
_, err = bodyBuf.Write(b)
|
||||
} else if s, ok := body.(string); ok {
|
||||
_, err = bodyBuf.WriteString(s)
|
||||
} else if s, ok := body.(*string); ok {
|
||||
_, err = bodyBuf.WriteString(*s)
|
||||
} else if jsonCheck.MatchString(contentType) {
|
||||
err = json.NewEncoder(bodyBuf).Encode(body)
|
||||
} else if xmlCheck.MatchString(contentType) {
|
||||
xml.NewEncoder(bodyBuf).Encode(body)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if bodyBuf.Len() == 0 {
|
||||
err = fmt.Errorf("Invalid body type %s\n", contentType)
|
||||
return nil, err
|
||||
}
|
||||
return bodyBuf, nil
|
||||
}
|
||||
|
||||
// detectContentType method is used to figure out `Request.Body` content type for request header
|
||||
func detectContentType(body interface{}) string {
|
||||
contentType := "text/plain; charset=utf-8"
|
||||
kind := reflect.TypeOf(body).Kind()
|
||||
|
||||
switch kind {
|
||||
case reflect.Struct, reflect.Map, reflect.Ptr:
|
||||
contentType = "application/json; charset=utf-8"
|
||||
case reflect.String:
|
||||
contentType = "text/plain; charset=utf-8"
|
||||
default:
|
||||
if b, ok := body.([]byte); ok {
|
||||
contentType = http.DetectContentType(b)
|
||||
} else if kind == reflect.Slice {
|
||||
contentType = "application/json; charset=utf-8"
|
||||
}
|
||||
}
|
||||
|
||||
return contentType
|
||||
}
|
||||
|
||||
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
||||
type cacheControl map[string]string
|
||||
|
||||
func parseCacheControl(headers http.Header) cacheControl {
|
||||
cc := cacheControl{}
|
||||
ccHeader := headers.Get("Cache-Control")
|
||||
for _, part := range strings.Split(ccHeader, ",") {
|
||||
part = strings.Trim(part, " ")
|
||||
if part == "" {
|
||||
continue
|
||||
}
|
||||
if strings.ContainsRune(part, '=') {
|
||||
keyval := strings.Split(part, "=")
|
||||
cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
|
||||
} else {
|
||||
cc[part] = ""
|
||||
}
|
||||
}
|
||||
return cc
|
||||
}
|
||||
|
||||
// CacheExpires helper function to determine remaining time before repeating a request.
|
||||
func CacheExpires(r *http.Response) time.Time {
|
||||
// Figure out when the cache expires.
|
||||
var expires time.Time
|
||||
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
||||
if err != nil {
|
||||
return time.Now()
|
||||
}
|
||||
respCacheControl := parseCacheControl(r.Header)
|
||||
|
||||
if maxAge, ok := respCacheControl["max-age"]; ok {
|
||||
lifetime, err := time.ParseDuration(maxAge + "s")
|
||||
if err != nil {
|
||||
expires = now
|
||||
}
|
||||
expires = now.Add(lifetime)
|
||||
} else {
|
||||
expiresHeader := r.Header.Get("Expires")
|
||||
if expiresHeader != "" {
|
||||
expires, err = time.Parse(time.RFC1123, expiresHeader)
|
||||
if err != nil {
|
||||
expires = now
|
||||
}
|
||||
}
|
||||
}
|
||||
return expires
|
||||
}
|
||||
|
||||
func strlen(s string) int {
|
||||
return utf8.RuneCountInString(s)
|
||||
}
|
||||
|
||||
// GenericSwaggerError Provides access to the body, error and model on returned errors.
|
||||
type GenericSwaggerError struct {
|
||||
body []byte
|
||||
error string
|
||||
model interface{}
|
||||
}
|
||||
|
||||
// Error returns non-empty string if there was an error.
|
||||
func (e GenericSwaggerError) Error() string {
|
||||
return e.error
|
||||
}
|
||||
|
||||
// Body returns the raw bytes of the response
|
||||
func (e GenericSwaggerError) Body() []byte {
|
||||
return e.body
|
||||
}
|
||||
|
||||
// Model returns the unpacked model of the error
|
||||
func (e GenericSwaggerError) Model() interface{} {
|
||||
return e.model
|
||||
}
|
@ -61,7 +61,7 @@ type Configuration struct {
|
||||
|
||||
func NewConfiguration() *Configuration {
|
||||
cfg := &Configuration{
|
||||
BasePath: "https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r",
|
||||
BasePath: "petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r",
|
||||
DefaultHeader: make(map[string]string),
|
||||
UserAgent: "Swagger-Codegen/1.0.0/go",
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# \FakeApi
|
||||
|
||||
All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
|
||||
All URIs are relative to *petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
@ -15,15 +15,15 @@ To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**optional** | ***TestCodeInjectEndRnNROpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a TestCodeInjectEndRnNROpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**testCodeInjectEndRnNR** | **string**| To test code injection *_/ ' \" =end -- \\r\\n \\n \\r |
|
||||
**uNKNOWNBASETYPE** | [**optional.Interface of ErrorUnknown**](UNKNOWN_BASE_TYPE.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -36,7 +36,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, *_/ ' =end --
|
||||
- **Accept**: application/json, *_/ ' =end --
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
|
44
samples/client/petstore-security-test/go/response.go
Normal file
44
samples/client/petstore-security-test/go/response.go
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
||||
*
|
||||
* API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type APIResponse struct {
|
||||
*http.Response `json:"-"`
|
||||
Message string `json:"message,omitempty"`
|
||||
// Operation is the name of the swagger operation.
|
||||
Operation string `json:"operation,omitempty"`
|
||||
// RequestURL is the request URL. This value is always available, even if the
|
||||
// embedded *http.Response is nil.
|
||||
RequestURL string `json:"url,omitempty"`
|
||||
// Method is the HTTP method used for the request. This value is always
|
||||
// available, even if the embedded *http.Response is nil.
|
||||
Method string `json:"method,omitempty"`
|
||||
// Payload holds the contents of the response body (which may be nil or empty).
|
||||
// This is provided here as the raw response.Body() reader will have already
|
||||
// been drained.
|
||||
Payload []byte `json:"-"`
|
||||
}
|
||||
|
||||
func NewAPIResponse(r *http.Response) *APIResponse {
|
||||
|
||||
response := &APIResponse{Response: r}
|
||||
return response
|
||||
}
|
||||
|
||||
func NewAPIResponseWithError(errorMessage string) *APIResponse {
|
||||
|
||||
response := &APIResponse{Message: errorMessage}
|
||||
return response
|
||||
}
|
@ -1 +1 @@
|
||||
2.4.0-SNAPSHOT
|
||||
3.0.0-SNAPSHOT
|
@ -7,7 +7,7 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge
|
||||
|
||||
- API version: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build package: io.swagger.codegen.languages.GoClientCodegen
|
||||
- Build package: org.openapitools.codegen.languages.GoClientCodegen
|
||||
|
||||
## Installation
|
||||
Put the package under your project folder and add the following in import:
|
||||
@ -26,6 +26,7 @@ Class | Method | HTTP request | Description
|
||||
*FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **Post** /fake/outer/composite |
|
||||
*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **Post** /fake/outer/number |
|
||||
*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **Post** /fake/outer/string |
|
||||
*FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **Put** /fake/body-with-query-params |
|
||||
*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **Patch** /fake | To test \"client\" model
|
||||
*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
*FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **Get** /fake | To test enum parameters
|
||||
@ -63,9 +64,11 @@ Class | Method | HTTP request | Description
|
||||
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||
- [ArrayTest](docs/ArrayTest.md)
|
||||
- [Capitalization](docs/Capitalization.md)
|
||||
- [Cat](docs/Cat.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [ClassModel](docs/ClassModel.md)
|
||||
- [Client](docs/Client.md)
|
||||
- [Dog](docs/Dog.md)
|
||||
- [EnumArrays](docs/EnumArrays.md)
|
||||
- [EnumClass](docs/EnumClass.md)
|
||||
- [EnumTest](docs/EnumTest.md)
|
||||
@ -90,8 +93,6 @@ Class | Method | HTTP request | Description
|
||||
- [SpecialModelName](docs/SpecialModelName.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [User](docs/User.md)
|
||||
- [Cat](docs/Cat.md)
|
||||
- [Dog](docs/Dog.md)
|
||||
|
||||
|
||||
## Documentation For Authorization
|
||||
|
1508
samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml
Normal file
1508
samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@ -15,9 +15,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"context"
|
||||
)
|
||||
|
||||
// Linger please
|
||||
@ -27,18 +25,21 @@ var (
|
||||
|
||||
type AnotherFakeApiService service
|
||||
|
||||
/* AnotherFakeApiService To test special tags
|
||||
/*
|
||||
AnotherFakeApiService To test special tags
|
||||
To test special tags
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body client model
|
||||
@return Client*/
|
||||
func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client) (Client, *http.Response, error) {
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param client client model
|
||||
|
||||
@return Client
|
||||
*/
|
||||
func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, client Client) (Client, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Patch")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Client
|
||||
localVarReturnValue Client
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -66,33 +67,50 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &client
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
contentType := localVarHttpResponse.Header.Get("content-type")
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Client
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -15,9 +15,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"context"
|
||||
)
|
||||
|
||||
// Linger please
|
||||
@ -27,17 +25,21 @@ var (
|
||||
|
||||
type FakeClassnameTags123ApiService service
|
||||
|
||||
/* FakeClassnameTags123ApiService To test class name in snake case
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body client model
|
||||
@return Client*/
|
||||
func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body Client) (Client, *http.Response, error) {
|
||||
/*
|
||||
FakeClassnameTags123ApiService To test class name in snake case
|
||||
To test class name in snake case
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param client client model
|
||||
|
||||
@return Client
|
||||
*/
|
||||
func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, client Client) (Client, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Patch")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Client
|
||||
localVarReturnValue Client
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -65,7 +67,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &client
|
||||
if ctx != nil {
|
||||
// API Key Authentication
|
||||
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||||
@ -75,35 +77,53 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body
|
||||
} else {
|
||||
key = auth.Key
|
||||
}
|
||||
|
||||
localVarQueryParams.Add("api_key_query", key)
|
||||
}
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
contentType := localVarHttpResponse.Header.Get("content-type")
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Client
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
@ -15,11 +15,10 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"os"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/antihax/optional"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Linger please
|
||||
@ -29,17 +28,20 @@ var (
|
||||
|
||||
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, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body Pet object that needs to be added to the store
|
||||
@return */
|
||||
func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, error) {
|
||||
|
||||
*/
|
||||
func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -59,7 +61,7 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, e
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -67,7 +69,7 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, e
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &pet
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -77,27 +79,47 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, e
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* PetApiService Deletes a pet
|
||||
/*
|
||||
PetApiService Deletes a pet
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param petId Pet id to delete
|
||||
* @param optional nil or *DeletePetOpts - Optional Parameters:
|
||||
* @param "ApiKey" (optional.String) -
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param petId Pet id to delete
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "apiKey" (string)
|
||||
@return */
|
||||
func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals map[string]interface{}) (*http.Response, error) {
|
||||
|
||||
*/
|
||||
|
||||
type DeletePetOpts struct {
|
||||
ApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals *DeletePetOpts) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Delete")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -107,9 +129,6 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
if err := typeCheckParameter(localVarOptionals["apiKey"], "string", "apiKey"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
@ -121,15 +140,15 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarTempParam, localVarOk := localVarOptionals["apiKey"].(string); localVarOk {
|
||||
localVarHeaderParams["api_key"] = parameterToString(localVarTempParam, "")
|
||||
if localVarOptionals != nil && localVarOptionals.ApiKey.IsSet() {
|
||||
localVarHeaderParams["api_key"] = parameterToString(localVarOptionals.ApiKey.Value(), "csv")
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
@ -140,26 +159,41 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* PetApiService Finds Pets by status
|
||||
/*
|
||||
PetApiService Finds Pets by status
|
||||
Multiple status values can be provided with comma separated strings
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param status Status values that need to be considered for filter
|
||||
@return []Pet*/
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param status Status values that need to be considered for filter
|
||||
|
||||
@return []Pet
|
||||
*/
|
||||
func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload []Pet
|
||||
localVarReturnValue []Pet
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -189,46 +223,66 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
contentType := localVarHttpResponse.Header.Get("content-type")
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v []Pet
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* PetApiService Finds Pets by tags
|
||||
/*
|
||||
PetApiService Finds Pets by tags
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param tags Tags to filter by
|
||||
@return []Pet*/
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param tags Tags to filter by
|
||||
|
||||
@return []Pet
|
||||
*/
|
||||
func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload []Pet
|
||||
localVarReturnValue []Pet
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -258,46 +312,66 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
contentType := localVarHttpResponse.Header.Get("content-type")
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v []Pet
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* PetApiService Find pet by ID
|
||||
/*
|
||||
PetApiService Find pet by ID
|
||||
Returns a single pet
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param petId ID of pet to return
|
||||
@return Pet*/
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param petId ID of pet to return
|
||||
|
||||
@return Pet
|
||||
*/
|
||||
func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Pet
|
||||
localVarReturnValue Pet
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -335,49 +409,70 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http
|
||||
key = auth.Key
|
||||
}
|
||||
localVarHeaderParams["api_key"] = key
|
||||
|
||||
}
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
contentType := localVarHttpResponse.Header.Get("content-type")
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Pet
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* PetApiService Update an existing pet
|
||||
/*
|
||||
PetApiService Update an existing pet
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body Pet object that needs to be added to the store
|
||||
@return */
|
||||
func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response, error) {
|
||||
|
||||
*/
|
||||
func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Put")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -397,7 +492,7 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -405,7 +500,7 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &pet
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -415,28 +510,49 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* PetApiService Updates a pet in the store with form data
|
||||
/*
|
||||
PetApiService Updates a pet in the store with form data
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param petId ID of pet that needs to be updated
|
||||
* @param optional nil or *UpdatePetWithFormOpts - Optional Parameters:
|
||||
* @param "" (optional.String) - Updated name of the pet
|
||||
* @param "" (optional.String) - Updated status of the pet
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param petId ID of pet that needs to be updated
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "name" (string) Updated name of the pet
|
||||
@param "status" (string) Updated status of the pet
|
||||
@return */
|
||||
func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals map[string]interface{}) (*http.Response, error) {
|
||||
|
||||
*/
|
||||
|
||||
type UpdatePetWithFormOpts struct {
|
||||
optional.String
|
||||
optional.String
|
||||
}
|
||||
|
||||
func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -446,12 +562,6 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
if err := typeCheckParameter(localVarOptionals["name"], "string", "name"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := typeCheckParameter(localVarOptionals["status"], "string", "status"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
@ -463,18 +573,18 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarTempParam, localVarOk := localVarOptionals["name"].(string); localVarOk {
|
||||
localVarFormParams.Add("name", parameterToString(localVarTempParam, ""))
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("name", parameterToString(localVarOptionals..Value(), ""))
|
||||
}
|
||||
if localVarTempParam, localVarOk := localVarOptionals["status"].(string); localVarOk {
|
||||
localVarFormParams.Add("status", parameterToString(localVarTempParam, ""))
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("status", parameterToString(localVarOptionals..Value(), ""))
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
@ -485,29 +595,49 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* PetApiService uploads an image
|
||||
/*
|
||||
PetApiService uploads an image
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param petId ID of pet to update
|
||||
* @param optional nil or *UploadFileOpts - Optional Parameters:
|
||||
* @param "" (optional.String) - Additional data to pass to server
|
||||
* @param "" (optional.*os.File) - file to upload
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param petId ID of pet to update
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "additionalMetadata" (string) Additional data to pass to server
|
||||
@param "file" (*os.File) file to upload
|
||||
@return ModelApiResponse*/
|
||||
func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals map[string]interface{}) (ModelApiResponse, *http.Response, error) {
|
||||
@return ModelApiResponse
|
||||
*/
|
||||
|
||||
type UploadFileOpts struct {
|
||||
optional.String
|
||||
optional.*os.File
|
||||
}
|
||||
|
||||
func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ModelApiResponse, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload ModelApiResponse
|
||||
localVarReturnValue ModelApiResponse
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -517,9 +647,6 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
if err := typeCheckParameter(localVarOptionals["additionalMetadata"], "string", "additionalMetadata"); err != nil {
|
||||
return successPayload, nil, err
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"multipart/form-data"}
|
||||
@ -538,12 +665,16 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarTempParam, localVarOk := localVarOptionals["additionalMetadata"].(string); localVarOk {
|
||||
localVarFormParams.Add("additionalMetadata", parameterToString(localVarTempParam, ""))
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals..Value(), ""))
|
||||
}
|
||||
var localVarFile (*os.File)
|
||||
if localVarTempParam, localVarOk := localVarOptionals["file"].(*os.File); localVarOk {
|
||||
localVarFile = localVarTempParam
|
||||
var localVarFile *os.File
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFileOk := false
|
||||
localVarFile, localVarFileOk = localVarOptionals..Value().(*os.File)
|
||||
if !localVarFileOk {
|
||||
return localVarReturnValue, nil, reportError("file should be *os.File")
|
||||
}
|
||||
}
|
||||
if localVarFile != nil {
|
||||
fbs, _ := ioutil.ReadAll(localVarFile)
|
||||
@ -553,30 +684,47 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
contentType := localVarHttpResponse.Header.Get("content-type")
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v ModelApiResponse
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
@ -15,9 +15,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
@ -28,17 +26,21 @@ var (
|
||||
|
||||
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
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param orderId ID of the order that needs to be deleted
|
||||
@return */
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param orderId ID of the order that needs to be deleted
|
||||
|
||||
|
||||
*/
|
||||
func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Delete")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -59,7 +61,7 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*htt
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -75,25 +77,40 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*htt
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* StoreApiService Returns pet inventories by status
|
||||
/*
|
||||
StoreApiService Returns pet inventories by status
|
||||
Returns a map of status codes to quantities
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@return map[string]int32*/
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
|
||||
@return map[string]int32
|
||||
*/
|
||||
func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload map[string]int32
|
||||
localVarReturnValue map[string]int32
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -130,50 +147,71 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *
|
||||
key = auth.Key
|
||||
}
|
||||
localVarHeaderParams["api_key"] = key
|
||||
|
||||
}
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
contentType := localVarHttpResponse.Header.Get("content-type")
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v map[string]int32
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* StoreApiService Find purchase order by ID
|
||||
/*
|
||||
StoreApiService Find purchase order by ID
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param orderId ID of pet that needs to be fetched
|
||||
@return Order*/
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
|
||||
@return Order
|
||||
*/
|
||||
func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Order
|
||||
localVarReturnValue Order
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -184,10 +222,10 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
if orderId < 1 {
|
||||
return successPayload, nil, reportError("orderId must be greater than 1")
|
||||
return localVarReturnValue, nil, reportError("orderId must be greater than 1")
|
||||
}
|
||||
if orderId > 5 {
|
||||
return successPayload, nil, reportError("orderId must be less than 5")
|
||||
return localVarReturnValue, nil, reportError("orderId must be less than 5")
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
@ -209,46 +247,65 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
contentType := localVarHttpResponse.Header.Get("content-type")
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Order
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* StoreApiService Place an order for a pet
|
||||
/*
|
||||
StoreApiService Place an order for a pet
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param order order placed for purchasing the pet
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body order placed for purchasing the pet
|
||||
@return Order*/
|
||||
func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *http.Response, error) {
|
||||
@return Order
|
||||
*/
|
||||
func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Order
|
||||
localVarReturnValue Order
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -276,33 +333,50 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *h
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &order
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
contentType := localVarHttpResponse.Header.Get("content-type")
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Order
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
@ -15,9 +15,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
@ -28,17 +26,21 @@ var (
|
||||
|
||||
type UserApiService service
|
||||
|
||||
/* UserApiService Create user
|
||||
/*
|
||||
UserApiService Create user
|
||||
This can only be done by the logged in user.
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body Created user object
|
||||
@return */
|
||||
func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Response, error) {
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param user Created user object
|
||||
|
||||
|
||||
*/
|
||||
func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -58,7 +60,7 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Respo
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -66,7 +68,7 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Respo
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &user
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -76,25 +78,40 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Respo
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* UserApiService Creates list of users with given input array
|
||||
/*
|
||||
UserApiService Creates list of users with given input array
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param user List of user object
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body List of user object
|
||||
@return */
|
||||
func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []User) (*http.Response, error) {
|
||||
|
||||
*/
|
||||
func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []User) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -114,7 +131,7 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -122,7 +139,7 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &user
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -132,25 +149,40 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* UserApiService Creates list of users with given input array
|
||||
/*
|
||||
UserApiService Creates list of users with given input array
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param user List of user object
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body List of user object
|
||||
@return */
|
||||
func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []User) (*http.Response, error) {
|
||||
|
||||
*/
|
||||
func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []User) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -170,7 +202,7 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -178,7 +210,7 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &user
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -188,25 +220,41 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* UserApiService Delete user
|
||||
/*
|
||||
UserApiService Delete user
|
||||
This can only be done by the logged in user.
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param username The name that needs to be deleted
|
||||
@return */
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param username The name that needs to be deleted
|
||||
|
||||
|
||||
*/
|
||||
func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Delete")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -227,7 +275,7 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -243,26 +291,40 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* UserApiService Get user by user name
|
||||
/*
|
||||
UserApiService Get user by user name
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param username The name that needs to be fetched. Use user1 for testing.
|
||||
@return User*/
|
||||
@return User
|
||||
*/
|
||||
func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload User
|
||||
localVarReturnValue User
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -292,47 +354,66 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
contentType := localVarHttpResponse.Header.Get("content-type")
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v User
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* UserApiService Logs user into the system
|
||||
/*
|
||||
UserApiService Logs user into the system
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param username The user name for login
|
||||
* @param password The password for login in clear text
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param username The user name for login
|
||||
@param password The password for login in clear text
|
||||
@return string*/
|
||||
@return string
|
||||
*/
|
||||
func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload string
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -342,8 +423,8 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
localVarQueryParams.Add("username", parameterToString(username, ""))
|
||||
localVarQueryParams.Add("password", parameterToString(password, ""))
|
||||
localVarQueryParams.Add("username", parameterToString(username, "csv"))
|
||||
localVarQueryParams.Add("password", parameterToString(password, "csv"))
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
@ -363,44 +444,64 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
contentType := localVarHttpResponse.Header.Get("content-type")
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v string
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* UserApiService Logs out current logged in user session
|
||||
/*
|
||||
UserApiService Logs out current logged in user session
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@return */
|
||||
|
||||
*/
|
||||
func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -420,7 +521,7 @@ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error)
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -436,26 +537,42 @@ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* UserApiService Updated user
|
||||
/*
|
||||
UserApiService Updated user
|
||||
This can only be done by the logged in user.
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param username name that need to be deleted
|
||||
@param body Updated user object
|
||||
@return */
|
||||
func (a *UserApiService) UpdateUser(ctx context.Context, username string, body User) (*http.Response, error) {
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param username name that need to be deleted
|
||||
* @param user Updated user object
|
||||
|
||||
|
||||
*/
|
||||
func (a *UserApiService) UpdateUser(ctx context.Context, username string, user User) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Put")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -476,7 +593,7 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body U
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -484,7 +601,7 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body U
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &user
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -494,10 +611,22 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body U
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"context"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
@ -315,6 +315,21 @@ func (c *APIClient) prepareRequest(
|
||||
return localVarRequest, nil
|
||||
}
|
||||
|
||||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.Unmarshal(b, v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
} else if strings.Contains(contentType, "application/json") {
|
||||
if err = json.Unmarshal(b, v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return errors.New("undefined response type")
|
||||
}
|
||||
|
||||
// Add a file to the multipart request
|
||||
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||
file, err := os.Open(path)
|
||||
@ -349,6 +364,8 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e
|
||||
_, err = bodyBuf.Write(b)
|
||||
} else if s, ok := body.(string); ok {
|
||||
_, err = bodyBuf.WriteString(s)
|
||||
} else if s, ok := body.(*string); ok {
|
||||
_, err = bodyBuf.WriteString(*s)
|
||||
} else if jsonCheck.MatchString(contentType) {
|
||||
err = json.NewEncoder(bodyBuf).Encode(body)
|
||||
} else if xmlCheck.MatchString(contentType) {
|
||||
@ -439,3 +456,25 @@ func CacheExpires(r *http.Response) time.Time {
|
||||
func strlen(s string) int {
|
||||
return utf8.RuneCountInString(s)
|
||||
}
|
||||
|
||||
// GenericSwaggerError Provides access to the body, error and model on returned errors.
|
||||
type GenericSwaggerError struct {
|
||||
body []byte
|
||||
error string
|
||||
model interface{}
|
||||
}
|
||||
|
||||
// Error returns non-empty string if there was an error.
|
||||
func (e GenericSwaggerError) Error() string {
|
||||
return e.error
|
||||
}
|
||||
|
||||
// Body returns the raw bytes of the response
|
||||
func (e GenericSwaggerError) Body() []byte {
|
||||
return e.body
|
||||
}
|
||||
|
||||
// Model returns the unpacked model of the error
|
||||
func (e GenericSwaggerError) Model() interface{} {
|
||||
return e.model
|
||||
}
|
@ -8,7 +8,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **TestSpecialTags**
|
||||
> Client TestSpecialTags(ctx, body)
|
||||
> Client TestSpecialTags(ctx, client)
|
||||
To test special tags
|
||||
|
||||
To test special tags
|
||||
@ -17,8 +17,8 @@ To test special tags
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**Client**](Client.md)| client model |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**EnumString** | **string** | | [optional] [default to null]
|
||||
**EnumStringRequired** | **string** | | [default to null]
|
||||
**EnumInteger** | **int32** | | [optional] [default to null]
|
||||
**EnumNumber** | **float64** | | [optional] [default to null]
|
||||
**OuterEnum** | [***OuterEnum**](OuterEnum.md) | | [optional] [default to null]
|
||||
|
@ -8,6 +8,7 @@ Method | HTTP request | Description
|
||||
[**FakeOuterCompositeSerialize**](FakeApi.md#FakeOuterCompositeSerialize) | **Post** /fake/outer/composite |
|
||||
[**FakeOuterNumberSerialize**](FakeApi.md#FakeOuterNumberSerialize) | **Post** /fake/outer/number |
|
||||
[**FakeOuterStringSerialize**](FakeApi.md#FakeOuterStringSerialize) | **Post** /fake/outer/string |
|
||||
[**TestBodyWithQueryParams**](FakeApi.md#TestBodyWithQueryParams) | **Put** /fake/body-with-query-params |
|
||||
[**TestClientModel**](FakeApi.md#TestClientModel) | **Patch** /fake | To test \"client\" model
|
||||
[**TestEndpointParameters**](FakeApi.md#TestEndpointParameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
[**TestEnumParameters**](FakeApi.md#TestEnumParameters) | **Get** /fake | To test enum parameters
|
||||
@ -25,15 +26,15 @@ Test serialization of outer boolean types
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**optional** | ***FakeOuterBooleanSerializeOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a FakeOuterBooleanSerializeOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body |
|
||||
**booleanPostBody** | **optional.Bool**| Input boolean as post body |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -46,7 +47,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
- **Accept**: */*
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -60,15 +61,15 @@ Test serialization of object with outer number type
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**optional** | ***FakeOuterCompositeSerializeOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a FakeOuterCompositeSerializeOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body |
|
||||
**outerComposite** | [**optional.Interface of OuterComposite**](OuterComposite.md)| Input composite as post body |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -81,7 +82,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
- **Accept**: */*
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -95,15 +96,15 @@ Test serialization of outer number types
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**optional** | ***FakeOuterNumberSerializeOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a FakeOuterNumberSerializeOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterNumber**](OuterNumber.md)| Input number as post body |
|
||||
**body** | **optional.Float32**| Input number as post body |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -116,7 +117,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
- **Accept**: */*
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -130,15 +131,15 @@ Test serialization of outer string types
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**optional** | ***FakeOuterStringSerializeOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a FakeOuterStringSerializeOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterString**](OuterString.md)| Input string as post body |
|
||||
**body** | **optional.String**| Input string as post body |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -151,12 +152,39 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: */*
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **TestBodyWithQueryParams**
|
||||
> TestBodyWithQueryParams(ctx, query, user)
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**query** | **string**| |
|
||||
**user** | [**User**](User.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **TestClientModel**
|
||||
> Client TestClientModel(ctx, body)
|
||||
> Client TestClientModel(ctx, client)
|
||||
To test \"client\" model
|
||||
|
||||
To test \"client\" model
|
||||
@ -165,8 +193,8 @@ To test \"client\" model
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**Client**](Client.md)| client model |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -184,7 +212,7 @@ No authorization required
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **TestEndpointParameters**
|
||||
> TestEndpointParameters(ctx, number, double, patternWithoutDelimiter, byte_, optional)
|
||||
> TestEndpointParameters(ctx, number, double, patternWithoutDelimiter, byte, optional)
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
@ -193,32 +221,32 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**number** | **float32**| None |
|
||||
**double** | **float64**| None |
|
||||
**patternWithoutDelimiter** | **string**| None |
|
||||
**byte_** | **string**| None |
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**byte** | **string**| None |
|
||||
**optional** | ***TestEndpointParametersOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a TestEndpointParametersOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**number** | **float32**| None |
|
||||
**double** | **float64**| None |
|
||||
**patternWithoutDelimiter** | **string**| None |
|
||||
**byte_** | **string**| None |
|
||||
**integer** | **int32**| None |
|
||||
**int32_** | **int32**| None |
|
||||
**int64_** | **int64**| None |
|
||||
**float** | **float32**| None |
|
||||
**string_** | **string**| None |
|
||||
**binary** | **string**| None |
|
||||
**date** | **string**| None |
|
||||
**dateTime** | **time.Time**| None |
|
||||
**password** | **string**| None |
|
||||
**callback** | **string**| None |
|
||||
|
||||
|
||||
|
||||
|
||||
**integer** | **optional.Int32**| None |
|
||||
**int32** | **optional.Int32**| None |
|
||||
**int64** | **optional.Int64**| None |
|
||||
**float** | **optional.Float32**| None |
|
||||
**string** | **optional.String**| None |
|
||||
**binary** | **optional.Interface of *os.File****optional.*os.File**| None |
|
||||
**date** | **optional.String**| None |
|
||||
**dateTime** | **optional.Time**| None |
|
||||
**password** | **optional.String**| None |
|
||||
**callback** | **optional.String**| None |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -230,8 +258,8 @@ Name | Type | Description | Notes
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8
|
||||
- **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -245,22 +273,22 @@ To test enum parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**optional** | ***TestEnumParametersOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a TestEnumParametersOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**enumFormStringArray** | [**[]string**](string.md)| Form parameter enum test (string array) |
|
||||
**enumFormString** | **string**| Form parameter enum test (string) | [default to -efg]
|
||||
**enumHeaderStringArray** | [**[]string**](string.md)| Header parameter enum test (string array) |
|
||||
**enumHeaderString** | **string**| Header parameter enum test (string) | [default to -efg]
|
||||
**enumQueryStringArray** | [**[]string**](string.md)| Query parameter enum test (string array) |
|
||||
**enumQueryString** | **string**| Query parameter enum test (string) | [default to -efg]
|
||||
**enumQueryInteger** | **int32**| Query parameter enum test (double) |
|
||||
**enumQueryDouble** | **float64**| Query parameter enum test (double) |
|
||||
**enumHeaderStringArray** | [**optional.Interface of []string**](string.md)| Header parameter enum test (string array) |
|
||||
**enumHeaderString** | **optional.String**| Header parameter enum test (string) | [default to -efg]
|
||||
**enumQueryStringArray** | [**optional.Interface of []string**](string.md)| Query parameter enum test (string array) |
|
||||
**enumQueryString** | **optional.String**| Query parameter enum test (string) | [default to -efg]
|
||||
**enumQueryInteger** | **optional.Int32**| Query parameter enum test (double) |
|
||||
**enumQueryDouble** | **optional.Float64**| Query parameter enum test (double) |
|
||||
**enumFormStringArray** | [**optional.Interface of []string**](array.md)| Form parameter enum test (string array) |
|
||||
**enumFormString** | **optional.String**| Form parameter enum test (string) |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -272,23 +300,21 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: */*
|
||||
- **Accept**: */*
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **TestInlineAdditionalProperties**
|
||||
> TestInlineAdditionalProperties(ctx, param)
|
||||
> TestInlineAdditionalProperties(ctx, requestBody)
|
||||
test inline additionalProperties
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**param** | [**interface{}**](interface{}.md)| request body |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**requestBody** | [**string**](string.md)| request body |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -309,13 +335,11 @@ No authorization required
|
||||
> TestJsonFormData(ctx, param, param2)
|
||||
test json serialization of form data
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**param** | **string**| field1 |
|
||||
**param2** | **string**| field2 |
|
||||
|
||||
@ -329,7 +353,7 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
@ -8,15 +8,17 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **TestClassname**
|
||||
> Client TestClassname(ctx, body)
|
||||
> Client TestClassname(ctx, client)
|
||||
To test class name in snake case
|
||||
|
||||
To test class name in snake case
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**Client**](Client.md)| client model |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -11,7 +11,7 @@ Name | Type | Description | Notes
|
||||
**Double** | **float64** | | [optional] [default to null]
|
||||
**String_** | **string** | | [optional] [default to null]
|
||||
**Byte_** | **string** | | [default to null]
|
||||
**Binary** | **string** | | [optional] [default to null]
|
||||
**Binary** | [****os.File**](*os.File.md) | | [optional] [default to null]
|
||||
**Date** | **string** | | [default to null]
|
||||
**DateTime** | [**time.Time**](time.Time.md) | | [optional] [default to null]
|
||||
**Uuid** | **string** | | [optional] [default to null]
|
||||
|
@ -15,17 +15,15 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **AddPet**
|
||||
> AddPet(ctx, body)
|
||||
> AddPet(ctx, pet)
|
||||
Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -38,7 +36,7 @@ Name | Type | Description | Notes
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -46,23 +44,21 @@ Name | Type | Description | Notes
|
||||
> DeletePet(ctx, petId, optional)
|
||||
Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**petId** | **int64**| Pet id to delete |
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**optional** | ***DeletePetOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a DeletePetOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int64**| Pet id to delete |
|
||||
**apiKey** | **string**| |
|
||||
|
||||
**apiKey** | **optional.String**| |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -75,7 +71,7 @@ Name | Type | Description | Notes
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -89,7 +85,7 @@ Multiple status values can be provided with comma separated strings
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**status** | [**[]string**](string.md)| Status values that need to be considered for filter |
|
||||
|
||||
### Return type
|
||||
@ -117,7 +113,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**tags** | [**[]string**](string.md)| Tags to filter by |
|
||||
|
||||
### Return type
|
||||
@ -145,7 +141,7 @@ Returns a single pet
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**petId** | **int64**| ID of pet to return |
|
||||
|
||||
### Return type
|
||||
@ -164,17 +160,15 @@ Name | Type | Description | Notes
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **UpdatePet**
|
||||
> UpdatePet(ctx, body)
|
||||
> UpdatePet(ctx, pet)
|
||||
Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -187,7 +181,7 @@ Name | Type | Description | Notes
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -195,24 +189,22 @@ Name | Type | Description | Notes
|
||||
> UpdatePetWithForm(ctx, petId, optional)
|
||||
Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**petId** | **int64**| ID of pet that needs to be updated |
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**optional** | ***UpdatePetWithFormOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a UpdatePetWithFormOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int64**| ID of pet that needs to be updated |
|
||||
**name** | **string**| Updated name of the pet |
|
||||
**status** | **string**| Updated status of the pet |
|
||||
|
||||
**name** | **optional.String**| Updated name of the pet |
|
||||
**status** | **optional.String**| Updated status of the pet |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -225,7 +217,7 @@ Name | Type | Description | Notes
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -233,24 +225,22 @@ Name | Type | Description | Notes
|
||||
> ModelApiResponse UploadFile(ctx, petId, optional)
|
||||
uploads an image
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**petId** | **int64**| ID of pet to update |
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**optional** | ***UploadFileOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a UploadFileOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int64**| ID of pet to update |
|
||||
**additionalMetadata** | **string**| Additional data to pass to server |
|
||||
**file** | ***os.File**| file to upload |
|
||||
|
||||
**additionalMetadata** | **optional.String**| Additional data to pass to server |
|
||||
**file** | **optional.Interface of *os.File****optional.*os.File**| file to upload |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -20,7 +20,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**orderId** | **string**| ID of the order that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
@ -34,7 +34,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -72,7 +72,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**orderId** | **int64**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
@ -91,17 +91,15 @@ No authorization required
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **PlaceOrder**
|
||||
> Order PlaceOrder(ctx, body)
|
||||
> Order PlaceOrder(ctx, order)
|
||||
Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -15,7 +15,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **CreateUser**
|
||||
> CreateUser(ctx, body)
|
||||
> CreateUser(ctx, user)
|
||||
Create user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
@ -24,8 +24,8 @@ This can only be done by the logged in user.
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**User**](User.md)| Created user object |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**user** | [**User**](User.md)| Created user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -38,22 +38,20 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **CreateUsersWithArrayInput**
|
||||
> CreateUsersWithArrayInput(ctx, body)
|
||||
> CreateUsersWithArrayInput(ctx, user)
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**[]User**](User.md)| List of user object |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**user** | [**[]User**](array.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -66,22 +64,20 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **CreateUsersWithListInput**
|
||||
> CreateUsersWithListInput(ctx, body)
|
||||
> CreateUsersWithListInput(ctx, user)
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**[]User**](User.md)| List of user object |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**user** | [**[]User**](array.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -94,7 +90,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -108,7 +104,7 @@ This can only be done by the logged in user.
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**username** | **string**| The name that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
@ -122,7 +118,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -130,14 +126,12 @@ No authorization required
|
||||
> User GetUserByName(ctx, username)
|
||||
Get user by user name
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**username** | **string**| The name that needs to be fetched. Use user1 for testing. |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**username** | **string**| The name that needs to be fetched. Use user1 for testing. |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -158,13 +152,11 @@ No authorization required
|
||||
> string LoginUser(ctx, username, password)
|
||||
Logs user into the system
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**username** | **string**| The user name for login |
|
||||
**password** | **string**| The password for login in clear text |
|
||||
|
||||
@ -187,8 +179,6 @@ No authorization required
|
||||
> LogoutUser(ctx, )
|
||||
Logs out current logged in user session
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
@ -203,12 +193,12 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **UpdateUser**
|
||||
> UpdateUser(ctx, username, body)
|
||||
> UpdateUser(ctx, username, user)
|
||||
Updated user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
@ -217,9 +207,9 @@ This can only be done by the logged in user.
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**username** | **string**| name that need to be deleted |
|
||||
**body** | [**User**](User.md)| Updated user object |
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -232,7 +222,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -13,6 +13,5 @@ package petstore
|
||||
// Model for testing model name starting with number
|
||||
type Model200Response struct {
|
||||
Name int32 `json:"name,omitempty" xml:"name"`
|
||||
|
||||
Class string `json:"class,omitempty" xml:"class"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type AdditionalPropertiesClass struct {
|
||||
MapProperty map[string]string `json:"map_property,omitempty" xml:"map_property"`
|
||||
|
||||
MapOfMapProperty map[string]map[string]string `json:"map_of_map_property,omitempty" xml:"map_of_map_property"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type Animal struct {
|
||||
ClassName string `json:"className" xml:"className"`
|
||||
|
||||
Color string `json:"color,omitempty" xml:"color"`
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ package petstore
|
||||
|
||||
type ModelApiResponse struct {
|
||||
Code int32 `json:"code,omitempty" xml:"code"`
|
||||
|
||||
Type_ string `json:"type,omitempty" xml:"type"`
|
||||
|
||||
Message string `json:"message,omitempty" xml:"message"`
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ package petstore
|
||||
|
||||
type ArrayTest struct {
|
||||
ArrayOfString []string `json:"array_of_string,omitempty" xml:"array_of_string"`
|
||||
|
||||
ArrayArrayOfInteger [][]int64 `json:"array_array_of_integer,omitempty" xml:"array_array_of_integer"`
|
||||
|
||||
ArrayArrayOfModel [][]ReadOnlyFirst `json:"array_array_of_model,omitempty" xml:"array_array_of_model"`
|
||||
}
|
||||
|
@ -12,15 +12,10 @@ package petstore
|
||||
|
||||
type Capitalization struct {
|
||||
SmallCamel string `json:"smallCamel,omitempty" xml:"smallCamel"`
|
||||
|
||||
CapitalCamel string `json:"CapitalCamel,omitempty" xml:"CapitalCamel"`
|
||||
|
||||
SmallSnake string `json:"small_Snake,omitempty" xml:"small_Snake"`
|
||||
|
||||
CapitalSnake string `json:"Capital_Snake,omitempty" xml:"Capital_Snake"`
|
||||
|
||||
SCAETHFlowPoints string `json:"SCA_ETH_Flow_Points,omitempty" xml:"SCA_ETH_Flow_Points"`
|
||||
|
||||
// Name of the pet
|
||||
ATT_NAME string `json:"ATT_NAME,omitempty" xml:"ATT_NAME"`
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ package petstore
|
||||
|
||||
type Cat struct {
|
||||
ClassName string `json:"className" xml:"className"`
|
||||
|
||||
Color string `json:"color,omitempty" xml:"color"`
|
||||
|
||||
Declawed bool `json:"declawed,omitempty" xml:"declawed"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type Category struct {
|
||||
Id int64 `json:"id,omitempty" xml:"id"`
|
||||
|
||||
Name string `json:"name,omitempty" xml:"name"`
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ package petstore
|
||||
|
||||
type Dog struct {
|
||||
ClassName string `json:"className" xml:"className"`
|
||||
|
||||
Color string `json:"color,omitempty" xml:"color"`
|
||||
|
||||
Breed string `json:"breed,omitempty" xml:"breed"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type EnumArrays struct {
|
||||
JustSymbol string `json:"just_symbol,omitempty" xml:"just_symbol"`
|
||||
|
||||
ArrayEnum []string `json:"array_enum,omitempty" xml:"array_enum"`
|
||||
}
|
||||
|
@ -15,8 +15,6 @@ type EnumClass string
|
||||
// List of EnumClass
|
||||
const (
|
||||
ABC EnumClass = "_abc"
|
||||
|
||||
EFG EnumClass = "-efg"
|
||||
|
||||
XYZ EnumClass = "(xyz)"
|
||||
)
|
||||
|
@ -12,10 +12,8 @@ package petstore
|
||||
|
||||
type EnumTest struct {
|
||||
EnumString string `json:"enum_string,omitempty" xml:"enum_string"`
|
||||
|
||||
EnumStringRequired string `json:"enum_string_required" xml:"enum_string_required"`
|
||||
EnumInteger int32 `json:"enum_integer,omitempty" xml:"enum_integer"`
|
||||
|
||||
EnumNumber float64 `json:"enum_number,omitempty" xml:"enum_number"`
|
||||
|
||||
OuterEnum *OuterEnum `json:"outerEnum,omitempty" xml:"outerEnum"`
|
||||
}
|
||||
|
@ -11,33 +11,25 @@
|
||||
package petstore
|
||||
|
||||
import (
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
type FormatTest struct {
|
||||
Integer int32 `json:"integer,omitempty" xml:"integer"`
|
||||
|
||||
Int32_ int32 `json:"int32,omitempty" xml:"int32"`
|
||||
|
||||
Int64_ int64 `json:"int64,omitempty" xml:"int64"`
|
||||
|
||||
Number float32 `json:"number" xml:"number"`
|
||||
|
||||
Float float32 `json:"float,omitempty" xml:"float"`
|
||||
|
||||
Double float64 `json:"double,omitempty" xml:"double"`
|
||||
|
||||
String_ string `json:"string,omitempty" xml:"string"`
|
||||
|
||||
Byte_ string `json:"byte" xml:"byte"`
|
||||
|
||||
Binary string `json:"binary,omitempty" xml:"binary"`
|
||||
|
||||
Binary **os.File `json:"binary,omitempty" xml:"binary"`
|
||||
Date string `json:"date" xml:"date"`
|
||||
|
||||
DateTime time.Time `json:"dateTime,omitempty" xml:"dateTime"`
|
||||
|
||||
Uuid string `json:"uuid,omitempty" xml:"uuid"`
|
||||
|
||||
Password string `json:"password" xml:"password"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type HasOnlyReadOnly struct {
|
||||
Bar string `json:"bar,omitempty" xml:"bar"`
|
||||
|
||||
Foo string `json:"foo,omitempty" xml:"foo"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type MapTest struct {
|
||||
MapMapOfString map[string]map[string]string `json:"map_map_of_string,omitempty" xml:"map_map_of_string"`
|
||||
|
||||
MapOfEnumString map[string]string `json:"map_of_enum_string,omitempty" xml:"map_of_enum_string"`
|
||||
}
|
||||
|
@ -16,8 +16,6 @@ import (
|
||||
|
||||
type MixedPropertiesAndAdditionalPropertiesClass struct {
|
||||
Uuid string `json:"uuid,omitempty" xml:"uuid"`
|
||||
|
||||
DateTime time.Time `json:"dateTime,omitempty" xml:"dateTime"`
|
||||
|
||||
Map_ map[string]Animal `json:"map,omitempty" xml:"map"`
|
||||
}
|
||||
|
@ -13,10 +13,7 @@ package petstore
|
||||
// Model for testing model name same as property name
|
||||
type Name struct {
|
||||
Name int32 `json:"name" xml:"name"`
|
||||
|
||||
SnakeCase int32 `json:"snake_case,omitempty" xml:"snake_case"`
|
||||
|
||||
Property string `json:"property,omitempty" xml:"property"`
|
||||
|
||||
Var123Number int32 `json:"123Number,omitempty" xml:"123Number"`
|
||||
}
|
||||
|
@ -16,15 +16,10 @@ import (
|
||||
|
||||
type Order struct {
|
||||
Id int64 `json:"id,omitempty" xml:"id"`
|
||||
|
||||
PetId int64 `json:"petId,omitempty" xml:"petId"`
|
||||
|
||||
Quantity int32 `json:"quantity,omitempty" xml:"quantity"`
|
||||
|
||||
ShipDate time.Time `json:"shipDate,omitempty" xml:"shipDate"`
|
||||
|
||||
// Order Status
|
||||
Status string `json:"status,omitempty" xml:"status"`
|
||||
|
||||
Complete bool `json:"complete,omitempty" xml:"complete"`
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ package petstore
|
||||
|
||||
type OuterComposite struct {
|
||||
MyNumber *OuterNumber `json:"my_number,omitempty" xml:"my_number"`
|
||||
|
||||
MyString *OuterString `json:"my_string,omitempty" xml:"my_string"`
|
||||
|
||||
MyBoolean *OuterBoolean `json:"my_boolean,omitempty" xml:"my_boolean"`
|
||||
}
|
||||
|
@ -15,8 +15,6 @@ type OuterEnum string
|
||||
// List of OuterEnum
|
||||
const (
|
||||
PLACED OuterEnum = "placed"
|
||||
|
||||
APPROVED OuterEnum = "approved"
|
||||
|
||||
DELIVERED OuterEnum = "delivered"
|
||||
)
|
||||
|
@ -12,15 +12,10 @@ package petstore
|
||||
|
||||
type Pet struct {
|
||||
Id int64 `json:"id,omitempty" xml:"id"`
|
||||
|
||||
Category *Category `json:"category,omitempty" xml:"category"`
|
||||
|
||||
Name string `json:"name" xml:"name"`
|
||||
|
||||
PhotoUrls []string `json:"photoUrls" xml:"photoUrls"`
|
||||
|
||||
Tags []Tag `json:"tags,omitempty" xml:"tags"`
|
||||
|
||||
// pet status in the store
|
||||
Status string `json:"status,omitempty" xml:"status"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type ReadOnlyFirst struct {
|
||||
Bar string `json:"bar,omitempty" xml:"bar"`
|
||||
|
||||
Baz string `json:"baz,omitempty" xml:"baz"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type Tag struct {
|
||||
Id int64 `json:"id,omitempty" xml:"id"`
|
||||
|
||||
Name string `json:"name,omitempty" xml:"name"`
|
||||
}
|
||||
|
@ -12,19 +12,12 @@ package petstore
|
||||
|
||||
type User struct {
|
||||
Id int64 `json:"id,omitempty" xml:"id"`
|
||||
|
||||
Username string `json:"username,omitempty" xml:"username"`
|
||||
|
||||
FirstName string `json:"firstName,omitempty" xml:"firstName"`
|
||||
|
||||
LastName string `json:"lastName,omitempty" xml:"lastName"`
|
||||
|
||||
Email string `json:"email,omitempty" xml:"email"`
|
||||
|
||||
Password string `json:"password,omitempty" xml:"password"`
|
||||
|
||||
Phone string `json:"phone,omitempty" xml:"phone"`
|
||||
|
||||
// User Status
|
||||
UserStatus int32 `json:"userStatus,omitempty" xml:"userStatus"`
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
2.4.0-SNAPSHOT
|
||||
3.0.0-SNAPSHOT
|
@ -7,7 +7,7 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge
|
||||
|
||||
- API version: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build package: io.swagger.codegen.languages.GoClientCodegen
|
||||
- Build package: org.openapitools.codegen.languages.GoClientCodegen
|
||||
|
||||
## Installation
|
||||
Put the package under your project folder and add the following in import:
|
||||
@ -26,6 +26,7 @@ Class | Method | HTTP request | Description
|
||||
*FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **Post** /fake/outer/composite |
|
||||
*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **Post** /fake/outer/number |
|
||||
*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **Post** /fake/outer/string |
|
||||
*FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **Put** /fake/body-with-query-params |
|
||||
*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **Patch** /fake | To test \"client\" model
|
||||
*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
*FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **Get** /fake | To test enum parameters
|
||||
@ -63,9 +64,11 @@ Class | Method | HTTP request | Description
|
||||
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||
- [ArrayTest](docs/ArrayTest.md)
|
||||
- [Capitalization](docs/Capitalization.md)
|
||||
- [Cat](docs/Cat.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [ClassModel](docs/ClassModel.md)
|
||||
- [Client](docs/Client.md)
|
||||
- [Dog](docs/Dog.md)
|
||||
- [EnumArrays](docs/EnumArrays.md)
|
||||
- [EnumClass](docs/EnumClass.md)
|
||||
- [EnumTest](docs/EnumTest.md)
|
||||
@ -90,8 +93,6 @@ Class | Method | HTTP request | Description
|
||||
- [SpecialModelName](docs/SpecialModelName.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [User](docs/User.md)
|
||||
- [Cat](docs/Cat.md)
|
||||
- [Dog](docs/Dog.md)
|
||||
|
||||
|
||||
## Documentation For Authorization
|
||||
|
1508
samples/client/petstore/go/go-petstore/api/openapi.yaml
Normal file
1508
samples/client/petstore/go/go-petstore/api/openapi.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@ -15,8 +15,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"encoding/json"
|
||||
"context"
|
||||
)
|
||||
|
||||
// Linger please
|
||||
@ -26,18 +25,21 @@ var (
|
||||
|
||||
type AnotherFakeApiService service
|
||||
|
||||
/* AnotherFakeApiService To test special tags
|
||||
/*
|
||||
AnotherFakeApiService To test special tags
|
||||
To test special tags
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body client model
|
||||
@return Client*/
|
||||
func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client) (Client, *http.Response, error) {
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param client client model
|
||||
|
||||
@return Client
|
||||
*/
|
||||
func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, client Client) (Client, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Patch")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Client
|
||||
localVarReturnValue Client
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -65,25 +67,50 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, body Client
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &client
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Client
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -15,8 +15,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"encoding/json"
|
||||
"context"
|
||||
)
|
||||
|
||||
// Linger please
|
||||
@ -26,17 +25,21 @@ var (
|
||||
|
||||
type FakeClassnameTags123ApiService service
|
||||
|
||||
/* FakeClassnameTags123ApiService To test class name in snake case
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body client model
|
||||
@return Client*/
|
||||
func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body Client) (Client, *http.Response, error) {
|
||||
/*
|
||||
FakeClassnameTags123ApiService To test class name in snake case
|
||||
To test class name in snake case
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param client client model
|
||||
|
||||
@return Client
|
||||
*/
|
||||
func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, client Client) (Client, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Patch")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Client
|
||||
localVarReturnValue Client
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -64,7 +67,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &client
|
||||
if ctx != nil {
|
||||
// API Key Authentication
|
||||
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||||
@ -74,27 +77,53 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body
|
||||
} else {
|
||||
key = auth.Key
|
||||
}
|
||||
|
||||
localVarQueryParams.Add("api_key_query", key)
|
||||
}
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Client
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"os"
|
||||
"encoding/json"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/antihax/optional"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Linger please
|
||||
@ -28,17 +28,20 @@ var (
|
||||
|
||||
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, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body Pet object that needs to be added to the store
|
||||
@return */
|
||||
func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, error) {
|
||||
|
||||
*/
|
||||
func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -58,7 +61,7 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, e
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -66,7 +69,7 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, e
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &pet
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -76,27 +79,47 @@ func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, e
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* PetApiService Deletes a pet
|
||||
/*
|
||||
PetApiService Deletes a pet
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param petId Pet id to delete
|
||||
* @param optional nil or *DeletePetOpts - Optional Parameters:
|
||||
* @param "ApiKey" (optional.String) -
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param petId Pet id to delete
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "apiKey" (string)
|
||||
@return */
|
||||
func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals map[string]interface{}) (*http.Response, error) {
|
||||
|
||||
*/
|
||||
|
||||
type DeletePetOpts struct {
|
||||
ApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals *DeletePetOpts) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Delete")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -106,9 +129,6 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
if err := typeCheckParameter(localVarOptionals["apiKey"], "string", "apiKey"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
@ -120,15 +140,15 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarTempParam, localVarOk := localVarOptionals["apiKey"].(string); localVarOk {
|
||||
localVarHeaderParams["api_key"] = parameterToString(localVarTempParam, "")
|
||||
if localVarOptionals != nil && localVarOptionals.ApiKey.IsSet() {
|
||||
localVarHeaderParams["api_key"] = parameterToString(localVarOptionals.ApiKey.Value(), "csv")
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
@ -139,26 +159,41 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* PetApiService Finds Pets by status
|
||||
/*
|
||||
PetApiService Finds Pets by status
|
||||
Multiple status values can be provided with comma separated strings
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param status Status values that need to be considered for filter
|
||||
@return []Pet*/
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param status Status values that need to be considered for filter
|
||||
|
||||
@return []Pet
|
||||
*/
|
||||
func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload []Pet
|
||||
localVarReturnValue []Pet
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -188,38 +223,66 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v []Pet
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* PetApiService Finds Pets by tags
|
||||
/*
|
||||
PetApiService Finds Pets by tags
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param tags Tags to filter by
|
||||
@return []Pet*/
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param tags Tags to filter by
|
||||
|
||||
@return []Pet
|
||||
*/
|
||||
func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload []Pet
|
||||
localVarReturnValue []Pet
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -249,38 +312,66 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v []Pet
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* PetApiService Find pet by ID
|
||||
/*
|
||||
PetApiService Find pet by ID
|
||||
Returns a single pet
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param petId ID of pet to return
|
||||
@return Pet*/
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param petId ID of pet to return
|
||||
|
||||
@return Pet
|
||||
*/
|
||||
func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Pet
|
||||
localVarReturnValue Pet
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -318,41 +409,70 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http
|
||||
key = auth.Key
|
||||
}
|
||||
localVarHeaderParams["api_key"] = key
|
||||
|
||||
}
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Pet
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* PetApiService Update an existing pet
|
||||
/*
|
||||
PetApiService Update an existing pet
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body Pet object that needs to be added to the store
|
||||
@return */
|
||||
func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response, error) {
|
||||
|
||||
*/
|
||||
func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Put")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -372,7 +492,7 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -380,7 +500,7 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &pet
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -390,28 +510,49 @@ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* PetApiService Updates a pet in the store with form data
|
||||
/*
|
||||
PetApiService Updates a pet in the store with form data
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param petId ID of pet that needs to be updated
|
||||
* @param optional nil or *UpdatePetWithFormOpts - Optional Parameters:
|
||||
* @param "" (optional.String) - Updated name of the pet
|
||||
* @param "" (optional.String) - Updated status of the pet
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param petId ID of pet that needs to be updated
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "name" (string) Updated name of the pet
|
||||
@param "status" (string) Updated status of the pet
|
||||
@return */
|
||||
func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals map[string]interface{}) (*http.Response, error) {
|
||||
|
||||
*/
|
||||
|
||||
type UpdatePetWithFormOpts struct {
|
||||
optional.String
|
||||
optional.String
|
||||
}
|
||||
|
||||
func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -421,12 +562,6 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
if err := typeCheckParameter(localVarOptionals["name"], "string", "name"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := typeCheckParameter(localVarOptionals["status"], "string", "status"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
@ -438,18 +573,18 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarTempParam, localVarOk := localVarOptionals["name"].(string); localVarOk {
|
||||
localVarFormParams.Add("name", parameterToString(localVarTempParam, ""))
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("name", parameterToString(localVarOptionals..Value(), ""))
|
||||
}
|
||||
if localVarTempParam, localVarOk := localVarOptionals["status"].(string); localVarOk {
|
||||
localVarFormParams.Add("status", parameterToString(localVarTempParam, ""))
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("status", parameterToString(localVarOptionals..Value(), ""))
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
@ -460,29 +595,49 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* PetApiService uploads an image
|
||||
/*
|
||||
PetApiService uploads an image
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param petId ID of pet to update
|
||||
* @param optional nil or *UploadFileOpts - Optional Parameters:
|
||||
* @param "" (optional.String) - Additional data to pass to server
|
||||
* @param "" (optional.*os.File) - file to upload
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param petId ID of pet to update
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "additionalMetadata" (string) Additional data to pass to server
|
||||
@param "file" (*os.File) file to upload
|
||||
@return ModelApiResponse*/
|
||||
func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals map[string]interface{}) (ModelApiResponse, *http.Response, error) {
|
||||
@return ModelApiResponse
|
||||
*/
|
||||
|
||||
type UploadFileOpts struct {
|
||||
optional.String
|
||||
optional.*os.File
|
||||
}
|
||||
|
||||
func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ModelApiResponse, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload ModelApiResponse
|
||||
localVarReturnValue ModelApiResponse
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -492,9 +647,6 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
if err := typeCheckParameter(localVarOptionals["additionalMetadata"], "string", "additionalMetadata"); err != nil {
|
||||
return successPayload, nil, err
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"multipart/form-data"}
|
||||
@ -513,12 +665,16 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarTempParam, localVarOk := localVarOptionals["additionalMetadata"].(string); localVarOk {
|
||||
localVarFormParams.Add("additionalMetadata", parameterToString(localVarTempParam, ""))
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals..Value(), ""))
|
||||
}
|
||||
var localVarFile (*os.File)
|
||||
if localVarTempParam, localVarOk := localVarOptionals["file"].(*os.File); localVarOk {
|
||||
localVarFile = localVarTempParam
|
||||
var localVarFile *os.File
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFileOk := false
|
||||
localVarFile, localVarFileOk = localVarOptionals..Value().(*os.File)
|
||||
if !localVarFileOk {
|
||||
return localVarReturnValue, nil, reportError("file should be *os.File")
|
||||
}
|
||||
}
|
||||
if localVarFile != nil {
|
||||
fbs, _ := ioutil.ReadAll(localVarFile)
|
||||
@ -528,22 +684,47 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v ModelApiResponse
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
@ -15,8 +15,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"encoding/json"
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
@ -27,17 +26,21 @@ var (
|
||||
|
||||
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
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param orderId ID of the order that needs to be deleted
|
||||
@return */
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param orderId ID of the order that needs to be deleted
|
||||
|
||||
|
||||
*/
|
||||
func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Delete")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -58,7 +61,7 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*htt
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -74,25 +77,40 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*htt
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* StoreApiService Returns pet inventories by status
|
||||
/*
|
||||
StoreApiService Returns pet inventories by status
|
||||
Returns a map of status codes to quantities
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@return map[string]int32*/
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
|
||||
@return map[string]int32
|
||||
*/
|
||||
func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload map[string]int32
|
||||
localVarReturnValue map[string]int32
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -129,42 +147,71 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *
|
||||
key = auth.Key
|
||||
}
|
||||
localVarHeaderParams["api_key"] = key
|
||||
|
||||
}
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v map[string]int32
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* StoreApiService Find purchase order by ID
|
||||
/*
|
||||
StoreApiService Find purchase order by ID
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param orderId ID of pet that needs to be fetched
|
||||
@return Order*/
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
|
||||
@return Order
|
||||
*/
|
||||
func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Order
|
||||
localVarReturnValue Order
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -175,10 +222,10 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
if orderId < 1 {
|
||||
return successPayload, nil, reportError("orderId must be greater than 1")
|
||||
return localVarReturnValue, nil, reportError("orderId must be greater than 1")
|
||||
}
|
||||
if orderId > 5 {
|
||||
return successPayload, nil, reportError("orderId must be less than 5")
|
||||
return localVarReturnValue, nil, reportError("orderId must be less than 5")
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
@ -200,38 +247,65 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Order
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* StoreApiService Place an order for a pet
|
||||
/*
|
||||
StoreApiService Place an order for a pet
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param order order placed for purchasing the pet
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body order placed for purchasing the pet
|
||||
@return Order*/
|
||||
func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *http.Response, error) {
|
||||
@return Order
|
||||
*/
|
||||
func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload Order
|
||||
localVarReturnValue Order
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -259,25 +333,50 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *h
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &order
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Order
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
@ -15,8 +15,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"golang.org/x/net/context"
|
||||
"encoding/json"
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
@ -27,17 +26,21 @@ var (
|
||||
|
||||
type UserApiService service
|
||||
|
||||
/* UserApiService Create user
|
||||
/*
|
||||
UserApiService Create user
|
||||
This can only be done by the logged in user.
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body Created user object
|
||||
@return */
|
||||
func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Response, error) {
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param user Created user object
|
||||
|
||||
|
||||
*/
|
||||
func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -57,7 +60,7 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Respo
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -65,7 +68,7 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Respo
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &user
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -75,25 +78,40 @@ func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Respo
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* UserApiService Creates list of users with given input array
|
||||
/*
|
||||
UserApiService Creates list of users with given input array
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param user List of user object
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body List of user object
|
||||
@return */
|
||||
func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []User) (*http.Response, error) {
|
||||
|
||||
*/
|
||||
func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []User) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -113,7 +131,7 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -121,7 +139,7 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &user
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -131,25 +149,40 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []U
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* UserApiService Creates list of users with given input array
|
||||
/*
|
||||
UserApiService Creates list of users with given input array
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param user List of user object
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param body List of user object
|
||||
@return */
|
||||
func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []User) (*http.Response, error) {
|
||||
|
||||
*/
|
||||
func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []User) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -169,7 +202,7 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -177,7 +210,7 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &user
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -187,25 +220,41 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []Us
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* UserApiService Delete user
|
||||
/*
|
||||
UserApiService Delete user
|
||||
This can only be done by the logged in user.
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param username The name that needs to be deleted
|
||||
@return */
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param username The name that needs to be deleted
|
||||
|
||||
|
||||
*/
|
||||
func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Delete")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -226,7 +275,7 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -242,26 +291,40 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* UserApiService Get user by user name
|
||||
/*
|
||||
UserApiService Get user by user name
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param username The name that needs to be fetched. Use user1 for testing.
|
||||
@return User*/
|
||||
@return User
|
||||
*/
|
||||
func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload User
|
||||
localVarReturnValue User
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -291,39 +354,66 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v User
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* UserApiService Logs user into the system
|
||||
/*
|
||||
UserApiService Logs user into the system
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param username The user name for login
|
||||
* @param password The password for login in clear text
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param username The user name for login
|
||||
@param password The password for login in clear text
|
||||
@return string*/
|
||||
@return string
|
||||
*/
|
||||
func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
successPayload string
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -333,8 +423,8 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
localVarQueryParams.Add("username", parameterToString(username, ""))
|
||||
localVarQueryParams.Add("password", parameterToString(password, ""))
|
||||
localVarQueryParams.Add("username", parameterToString(username, "csv"))
|
||||
localVarQueryParams.Add("password", parameterToString(password, "csv"))
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
@ -354,36 +444,64 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return successPayload, nil, err
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v string
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
||||
return successPayload, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
return successPayload, localVarHttpResponse, err
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* UserApiService Logs out current logged in user session
|
||||
/*
|
||||
UserApiService Logs out current logged in user session
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@return */
|
||||
|
||||
*/
|
||||
func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -403,7 +521,7 @@ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error)
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -419,26 +537,42 @@ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/* UserApiService Updated user
|
||||
/*
|
||||
UserApiService Updated user
|
||||
This can only be done by the logged in user.
|
||||
* @param ctx context.Context for authentication, logging, tracing, etc.
|
||||
@param username name that need to be deleted
|
||||
@param body Updated user object
|
||||
@return */
|
||||
func (a *UserApiService) UpdateUser(ctx context.Context, username string, body User) (*http.Response, error) {
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param username name that need to be deleted
|
||||
* @param user Updated user object
|
||||
|
||||
|
||||
*/
|
||||
func (a *UserApiService) UpdateUser(ctx context.Context, username string, user User) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Put")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@ -459,7 +593,7 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body U
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
@ -467,7 +601,7 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body U
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &body
|
||||
localVarPostBody = &user
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -477,10 +611,22 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body U
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
defer localVarHttpResponse.Body.Close()
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
return localVarHttpResponse, err
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"context"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
@ -315,6 +315,21 @@ func (c *APIClient) prepareRequest(
|
||||
return localVarRequest, nil
|
||||
}
|
||||
|
||||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||
if strings.Contains(contentType, "application/xml") {
|
||||
if err = xml.Unmarshal(b, v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
} else if strings.Contains(contentType, "application/json") {
|
||||
if err = json.Unmarshal(b, v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return errors.New("undefined response type")
|
||||
}
|
||||
|
||||
// Add a file to the multipart request
|
||||
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||
file, err := os.Open(path)
|
||||
@ -349,6 +364,8 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e
|
||||
_, err = bodyBuf.Write(b)
|
||||
} else if s, ok := body.(string); ok {
|
||||
_, err = bodyBuf.WriteString(s)
|
||||
} else if s, ok := body.(*string); ok {
|
||||
_, err = bodyBuf.WriteString(*s)
|
||||
} else if jsonCheck.MatchString(contentType) {
|
||||
err = json.NewEncoder(bodyBuf).Encode(body)
|
||||
} else if xmlCheck.MatchString(contentType) {
|
||||
@ -439,3 +456,25 @@ func CacheExpires(r *http.Response) time.Time {
|
||||
func strlen(s string) int {
|
||||
return utf8.RuneCountInString(s)
|
||||
}
|
||||
|
||||
// GenericSwaggerError Provides access to the body, error and model on returned errors.
|
||||
type GenericSwaggerError struct {
|
||||
body []byte
|
||||
error string
|
||||
model interface{}
|
||||
}
|
||||
|
||||
// Error returns non-empty string if there was an error.
|
||||
func (e GenericSwaggerError) Error() string {
|
||||
return e.error
|
||||
}
|
||||
|
||||
// Body returns the raw bytes of the response
|
||||
func (e GenericSwaggerError) Body() []byte {
|
||||
return e.body
|
||||
}
|
||||
|
||||
// Model returns the unpacked model of the error
|
||||
func (e GenericSwaggerError) Model() interface{} {
|
||||
return e.model
|
||||
}
|
@ -8,7 +8,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **TestSpecialTags**
|
||||
> Client TestSpecialTags(ctx, body)
|
||||
> Client TestSpecialTags(ctx, client)
|
||||
To test special tags
|
||||
|
||||
To test special tags
|
||||
@ -17,8 +17,8 @@ To test special tags
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**Client**](Client.md)| client model |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**EnumString** | **string** | | [optional] [default to null]
|
||||
**EnumStringRequired** | **string** | | [default to null]
|
||||
**EnumInteger** | **int32** | | [optional] [default to null]
|
||||
**EnumNumber** | **float64** | | [optional] [default to null]
|
||||
**OuterEnum** | [***OuterEnum**](OuterEnum.md) | | [optional] [default to null]
|
||||
|
@ -8,6 +8,7 @@ Method | HTTP request | Description
|
||||
[**FakeOuterCompositeSerialize**](FakeApi.md#FakeOuterCompositeSerialize) | **Post** /fake/outer/composite |
|
||||
[**FakeOuterNumberSerialize**](FakeApi.md#FakeOuterNumberSerialize) | **Post** /fake/outer/number |
|
||||
[**FakeOuterStringSerialize**](FakeApi.md#FakeOuterStringSerialize) | **Post** /fake/outer/string |
|
||||
[**TestBodyWithQueryParams**](FakeApi.md#TestBodyWithQueryParams) | **Put** /fake/body-with-query-params |
|
||||
[**TestClientModel**](FakeApi.md#TestClientModel) | **Patch** /fake | To test \"client\" model
|
||||
[**TestEndpointParameters**](FakeApi.md#TestEndpointParameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
[**TestEnumParameters**](FakeApi.md#TestEnumParameters) | **Get** /fake | To test enum parameters
|
||||
@ -25,15 +26,15 @@ Test serialization of outer boolean types
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**optional** | ***FakeOuterBooleanSerializeOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a FakeOuterBooleanSerializeOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body |
|
||||
**booleanPostBody** | **optional.Bool**| Input boolean as post body |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -46,7 +47,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
- **Accept**: */*
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -60,15 +61,15 @@ Test serialization of object with outer number type
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**optional** | ***FakeOuterCompositeSerializeOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a FakeOuterCompositeSerializeOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body |
|
||||
**outerComposite** | [**optional.Interface of OuterComposite**](OuterComposite.md)| Input composite as post body |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -81,7 +82,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
- **Accept**: */*
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -95,15 +96,15 @@ Test serialization of outer number types
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**optional** | ***FakeOuterNumberSerializeOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a FakeOuterNumberSerializeOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterNumber**](OuterNumber.md)| Input number as post body |
|
||||
**body** | **optional.Float32**| Input number as post body |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -116,7 +117,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
- **Accept**: */*
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -130,15 +131,15 @@ Test serialization of outer string types
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**optional** | ***FakeOuterStringSerializeOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a FakeOuterStringSerializeOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterString**](OuterString.md)| Input string as post body |
|
||||
**body** | **optional.String**| Input string as post body |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -151,12 +152,39 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: */*
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **TestBodyWithQueryParams**
|
||||
> TestBodyWithQueryParams(ctx, query, user)
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**query** | **string**| |
|
||||
**user** | [**User**](User.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **TestClientModel**
|
||||
> Client TestClientModel(ctx, body)
|
||||
> Client TestClientModel(ctx, client)
|
||||
To test \"client\" model
|
||||
|
||||
To test \"client\" model
|
||||
@ -165,8 +193,8 @@ To test \"client\" model
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**Client**](Client.md)| client model |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -184,7 +212,7 @@ No authorization required
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **TestEndpointParameters**
|
||||
> TestEndpointParameters(ctx, number, double, patternWithoutDelimiter, byte_, optional)
|
||||
> TestEndpointParameters(ctx, number, double, patternWithoutDelimiter, byte, optional)
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
@ -193,32 +221,32 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**number** | **float32**| None |
|
||||
**double** | **float64**| None |
|
||||
**patternWithoutDelimiter** | **string**| None |
|
||||
**byte_** | **string**| None |
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**byte** | **string**| None |
|
||||
**optional** | ***TestEndpointParametersOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a TestEndpointParametersOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**number** | **float32**| None |
|
||||
**double** | **float64**| None |
|
||||
**patternWithoutDelimiter** | **string**| None |
|
||||
**byte_** | **string**| None |
|
||||
**integer** | **int32**| None |
|
||||
**int32_** | **int32**| None |
|
||||
**int64_** | **int64**| None |
|
||||
**float** | **float32**| None |
|
||||
**string_** | **string**| None |
|
||||
**binary** | **string**| None |
|
||||
**date** | **string**| None |
|
||||
**dateTime** | **time.Time**| None |
|
||||
**password** | **string**| None |
|
||||
**callback** | **string**| None |
|
||||
|
||||
|
||||
|
||||
|
||||
**integer** | **optional.Int32**| None |
|
||||
**int32** | **optional.Int32**| None |
|
||||
**int64** | **optional.Int64**| None |
|
||||
**float** | **optional.Float32**| None |
|
||||
**string** | **optional.String**| None |
|
||||
**binary** | **optional.Interface of *os.File****optional.*os.File**| None |
|
||||
**date** | **optional.String**| None |
|
||||
**dateTime** | **optional.Time**| None |
|
||||
**password** | **optional.String**| None |
|
||||
**callback** | **optional.String**| None |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -230,8 +258,8 @@ Name | Type | Description | Notes
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8
|
||||
- **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -245,22 +273,22 @@ To test enum parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**optional** | ***TestEnumParametersOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a TestEnumParametersOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**enumFormStringArray** | [**[]string**](string.md)| Form parameter enum test (string array) |
|
||||
**enumFormString** | **string**| Form parameter enum test (string) | [default to -efg]
|
||||
**enumHeaderStringArray** | [**[]string**](string.md)| Header parameter enum test (string array) |
|
||||
**enumHeaderString** | **string**| Header parameter enum test (string) | [default to -efg]
|
||||
**enumQueryStringArray** | [**[]string**](string.md)| Query parameter enum test (string array) |
|
||||
**enumQueryString** | **string**| Query parameter enum test (string) | [default to -efg]
|
||||
**enumQueryInteger** | **int32**| Query parameter enum test (double) |
|
||||
**enumQueryDouble** | **float64**| Query parameter enum test (double) |
|
||||
**enumHeaderStringArray** | [**optional.Interface of []string**](string.md)| Header parameter enum test (string array) |
|
||||
**enumHeaderString** | **optional.String**| Header parameter enum test (string) | [default to -efg]
|
||||
**enumQueryStringArray** | [**optional.Interface of []string**](string.md)| Query parameter enum test (string array) |
|
||||
**enumQueryString** | **optional.String**| Query parameter enum test (string) | [default to -efg]
|
||||
**enumQueryInteger** | **optional.Int32**| Query parameter enum test (double) |
|
||||
**enumQueryDouble** | **optional.Float64**| Query parameter enum test (double) |
|
||||
**enumFormStringArray** | [**optional.Interface of []string**](array.md)| Form parameter enum test (string array) |
|
||||
**enumFormString** | **optional.String**| Form parameter enum test (string) |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -272,23 +300,21 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: */*
|
||||
- **Accept**: */*
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **TestInlineAdditionalProperties**
|
||||
> TestInlineAdditionalProperties(ctx, param)
|
||||
> TestInlineAdditionalProperties(ctx, requestBody)
|
||||
test inline additionalProperties
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**param** | [**interface{}**](interface{}.md)| request body |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**requestBody** | [**string**](string.md)| request body |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -309,13 +335,11 @@ No authorization required
|
||||
> TestJsonFormData(ctx, param, param2)
|
||||
test json serialization of form data
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**param** | **string**| field1 |
|
||||
**param2** | **string**| field2 |
|
||||
|
||||
@ -329,7 +353,7 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
@ -8,15 +8,17 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **TestClassname**
|
||||
> Client TestClassname(ctx, body)
|
||||
> Client TestClassname(ctx, client)
|
||||
To test class name in snake case
|
||||
|
||||
To test class name in snake case
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**Client**](Client.md)| client model |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -11,7 +11,7 @@ Name | Type | Description | Notes
|
||||
**Double** | **float64** | | [optional] [default to null]
|
||||
**String_** | **string** | | [optional] [default to null]
|
||||
**Byte_** | **string** | | [default to null]
|
||||
**Binary** | **string** | | [optional] [default to null]
|
||||
**Binary** | [****os.File**](*os.File.md) | | [optional] [default to null]
|
||||
**Date** | **string** | | [default to null]
|
||||
**DateTime** | [**time.Time**](time.Time.md) | | [optional] [default to null]
|
||||
**Uuid** | **string** | | [optional] [default to null]
|
||||
|
@ -15,17 +15,15 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **AddPet**
|
||||
> AddPet(ctx, body)
|
||||
> AddPet(ctx, pet)
|
||||
Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -38,7 +36,7 @@ Name | Type | Description | Notes
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -46,23 +44,21 @@ Name | Type | Description | Notes
|
||||
> DeletePet(ctx, petId, optional)
|
||||
Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**petId** | **int64**| Pet id to delete |
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**optional** | ***DeletePetOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a DeletePetOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int64**| Pet id to delete |
|
||||
**apiKey** | **string**| |
|
||||
|
||||
**apiKey** | **optional.String**| |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -75,7 +71,7 @@ Name | Type | Description | Notes
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -89,7 +85,7 @@ Multiple status values can be provided with comma separated strings
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**status** | [**[]string**](string.md)| Status values that need to be considered for filter |
|
||||
|
||||
### Return type
|
||||
@ -117,7 +113,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**tags** | [**[]string**](string.md)| Tags to filter by |
|
||||
|
||||
### Return type
|
||||
@ -145,7 +141,7 @@ Returns a single pet
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**petId** | **int64**| ID of pet to return |
|
||||
|
||||
### Return type
|
||||
@ -164,17 +160,15 @@ Name | Type | Description | Notes
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **UpdatePet**
|
||||
> UpdatePet(ctx, body)
|
||||
> UpdatePet(ctx, pet)
|
||||
Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -187,7 +181,7 @@ Name | Type | Description | Notes
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -195,24 +189,22 @@ Name | Type | Description | Notes
|
||||
> UpdatePetWithForm(ctx, petId, optional)
|
||||
Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**petId** | **int64**| ID of pet that needs to be updated |
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**optional** | ***UpdatePetWithFormOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a UpdatePetWithFormOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int64**| ID of pet that needs to be updated |
|
||||
**name** | **string**| Updated name of the pet |
|
||||
**status** | **string**| Updated status of the pet |
|
||||
|
||||
**name** | **optional.String**| Updated name of the pet |
|
||||
**status** | **optional.String**| Updated status of the pet |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -225,7 +217,7 @@ Name | Type | Description | Notes
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -233,24 +225,22 @@ Name | Type | Description | Notes
|
||||
> ModelApiResponse UploadFile(ctx, petId, optional)
|
||||
uploads an image
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**petId** | **int64**| ID of pet to update |
|
||||
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
|
||||
**optional** | ***UploadFileOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a map[string]interface{}.
|
||||
Optional parameters are passed through a pointer to a UploadFileOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int64**| ID of pet to update |
|
||||
**additionalMetadata** | **string**| Additional data to pass to server |
|
||||
**file** | ***os.File**| file to upload |
|
||||
|
||||
**additionalMetadata** | **optional.String**| Additional data to pass to server |
|
||||
**file** | **optional.Interface of *os.File****optional.*os.File**| file to upload |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -20,7 +20,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**orderId** | **string**| ID of the order that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
@ -34,7 +34,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -72,7 +72,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**orderId** | **int64**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
@ -91,17 +91,15 @@ No authorization required
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **PlaceOrder**
|
||||
> Order PlaceOrder(ctx, body)
|
||||
> Order PlaceOrder(ctx, order)
|
||||
Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -15,7 +15,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **CreateUser**
|
||||
> CreateUser(ctx, body)
|
||||
> CreateUser(ctx, user)
|
||||
Create user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
@ -24,8 +24,8 @@ This can only be done by the logged in user.
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**User**](User.md)| Created user object |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**user** | [**User**](User.md)| Created user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -38,22 +38,20 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **CreateUsersWithArrayInput**
|
||||
> CreateUsersWithArrayInput(ctx, body)
|
||||
> CreateUsersWithArrayInput(ctx, user)
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**[]User**](User.md)| List of user object |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**user** | [**[]User**](array.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -66,22 +64,20 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **CreateUsersWithListInput**
|
||||
> CreateUsersWithListInput(ctx, body)
|
||||
> CreateUsersWithListInput(ctx, user)
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**body** | [**[]User**](User.md)| List of user object |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**user** | [**[]User**](array.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -94,7 +90,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -108,7 +104,7 @@ This can only be done by the logged in user.
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**username** | **string**| The name that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
@ -122,7 +118,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -130,14 +126,12 @@ No authorization required
|
||||
> User GetUserByName(ctx, username)
|
||||
Get user by user name
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**username** | **string**| The name that needs to be fetched. Use user1 for testing. |
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**username** | **string**| The name that needs to be fetched. Use user1 for testing. |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -158,13 +152,11 @@ No authorization required
|
||||
> string LoginUser(ctx, username, password)
|
||||
Logs user into the system
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**username** | **string**| The user name for login |
|
||||
**password** | **string**| The password for login in clear text |
|
||||
|
||||
@ -187,8 +179,6 @@ No authorization required
|
||||
> LogoutUser(ctx, )
|
||||
Logs out current logged in user session
|
||||
|
||||
|
||||
|
||||
### Required Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
@ -203,12 +193,12 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **UpdateUser**
|
||||
> UpdateUser(ctx, username, body)
|
||||
> UpdateUser(ctx, username, user)
|
||||
Updated user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
@ -217,9 +207,9 @@ This can only be done by the logged in user.
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**username** | **string**| name that need to be deleted |
|
||||
**body** | [**User**](User.md)| Updated user object |
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -232,7 +222,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -13,6 +13,5 @@ package petstore
|
||||
// Model for testing model name starting with number
|
||||
type Model200Response struct {
|
||||
Name int32 `json:"name,omitempty"`
|
||||
|
||||
Class string `json:"class,omitempty"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type AdditionalPropertiesClass struct {
|
||||
MapProperty map[string]string `json:"map_property,omitempty"`
|
||||
|
||||
MapOfMapProperty map[string]map[string]string `json:"map_of_map_property,omitempty"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type Animal struct {
|
||||
ClassName string `json:"className"`
|
||||
|
||||
Color string `json:"color,omitempty"`
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ package petstore
|
||||
|
||||
type ModelApiResponse struct {
|
||||
Code int32 `json:"code,omitempty"`
|
||||
|
||||
Type_ string `json:"type,omitempty"`
|
||||
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ package petstore
|
||||
|
||||
type ArrayTest struct {
|
||||
ArrayOfString []string `json:"array_of_string,omitempty"`
|
||||
|
||||
ArrayArrayOfInteger [][]int64 `json:"array_array_of_integer,omitempty"`
|
||||
|
||||
ArrayArrayOfModel [][]ReadOnlyFirst `json:"array_array_of_model,omitempty"`
|
||||
}
|
||||
|
@ -12,15 +12,10 @@ package petstore
|
||||
|
||||
type Capitalization struct {
|
||||
SmallCamel string `json:"smallCamel,omitempty"`
|
||||
|
||||
CapitalCamel string `json:"CapitalCamel,omitempty"`
|
||||
|
||||
SmallSnake string `json:"small_Snake,omitempty"`
|
||||
|
||||
CapitalSnake string `json:"Capital_Snake,omitempty"`
|
||||
|
||||
SCAETHFlowPoints string `json:"SCA_ETH_Flow_Points,omitempty"`
|
||||
|
||||
// Name of the pet
|
||||
ATT_NAME string `json:"ATT_NAME,omitempty"`
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ package petstore
|
||||
|
||||
type Cat struct {
|
||||
ClassName string `json:"className"`
|
||||
|
||||
Color string `json:"color,omitempty"`
|
||||
|
||||
Declawed bool `json:"declawed,omitempty"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type Category struct {
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ package petstore
|
||||
|
||||
type Dog struct {
|
||||
ClassName string `json:"className"`
|
||||
|
||||
Color string `json:"color,omitempty"`
|
||||
|
||||
Breed string `json:"breed,omitempty"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type EnumArrays struct {
|
||||
JustSymbol string `json:"just_symbol,omitempty"`
|
||||
|
||||
ArrayEnum []string `json:"array_enum,omitempty"`
|
||||
}
|
||||
|
@ -15,8 +15,6 @@ type EnumClass string
|
||||
// List of EnumClass
|
||||
const (
|
||||
ABC EnumClass = "_abc"
|
||||
|
||||
EFG EnumClass = "-efg"
|
||||
|
||||
XYZ EnumClass = "(xyz)"
|
||||
)
|
||||
|
@ -12,10 +12,8 @@ package petstore
|
||||
|
||||
type EnumTest struct {
|
||||
EnumString string `json:"enum_string,omitempty"`
|
||||
|
||||
EnumStringRequired string `json:"enum_string_required"`
|
||||
EnumInteger int32 `json:"enum_integer,omitempty"`
|
||||
|
||||
EnumNumber float64 `json:"enum_number,omitempty"`
|
||||
|
||||
OuterEnum *OuterEnum `json:"outerEnum,omitempty"`
|
||||
}
|
||||
|
@ -11,33 +11,25 @@
|
||||
package petstore
|
||||
|
||||
import (
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
type FormatTest struct {
|
||||
Integer int32 `json:"integer,omitempty"`
|
||||
|
||||
Int32_ int32 `json:"int32,omitempty"`
|
||||
|
||||
Int64_ int64 `json:"int64,omitempty"`
|
||||
|
||||
Number float32 `json:"number"`
|
||||
|
||||
Float float32 `json:"float,omitempty"`
|
||||
|
||||
Double float64 `json:"double,omitempty"`
|
||||
|
||||
String_ string `json:"string,omitempty"`
|
||||
|
||||
Byte_ string `json:"byte"`
|
||||
|
||||
Binary string `json:"binary,omitempty"`
|
||||
|
||||
Binary **os.File `json:"binary,omitempty"`
|
||||
Date string `json:"date"`
|
||||
|
||||
DateTime time.Time `json:"dateTime,omitempty"`
|
||||
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type HasOnlyReadOnly struct {
|
||||
Bar string `json:"bar,omitempty"`
|
||||
|
||||
Foo string `json:"foo,omitempty"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type MapTest struct {
|
||||
MapMapOfString map[string]map[string]string `json:"map_map_of_string,omitempty"`
|
||||
|
||||
MapOfEnumString map[string]string `json:"map_of_enum_string,omitempty"`
|
||||
}
|
||||
|
@ -16,8 +16,6 @@ import (
|
||||
|
||||
type MixedPropertiesAndAdditionalPropertiesClass struct {
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
|
||||
DateTime time.Time `json:"dateTime,omitempty"`
|
||||
|
||||
Map_ map[string]Animal `json:"map,omitempty"`
|
||||
}
|
||||
|
@ -13,10 +13,7 @@ package petstore
|
||||
// Model for testing model name same as property name
|
||||
type Name struct {
|
||||
Name int32 `json:"name"`
|
||||
|
||||
SnakeCase int32 `json:"snake_case,omitempty"`
|
||||
|
||||
Property string `json:"property,omitempty"`
|
||||
|
||||
Var123Number int32 `json:"123Number,omitempty"`
|
||||
}
|
||||
|
@ -16,15 +16,10 @@ import (
|
||||
|
||||
type Order struct {
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
PetId int64 `json:"petId,omitempty"`
|
||||
|
||||
Quantity int32 `json:"quantity,omitempty"`
|
||||
|
||||
ShipDate time.Time `json:"shipDate,omitempty"`
|
||||
|
||||
// Order Status
|
||||
Status string `json:"status,omitempty"`
|
||||
|
||||
Complete bool `json:"complete,omitempty"`
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ package petstore
|
||||
|
||||
type OuterComposite struct {
|
||||
MyNumber *OuterNumber `json:"my_number,omitempty"`
|
||||
|
||||
MyString *OuterString `json:"my_string,omitempty"`
|
||||
|
||||
MyBoolean *OuterBoolean `json:"my_boolean,omitempty"`
|
||||
}
|
||||
|
@ -15,8 +15,6 @@ type OuterEnum string
|
||||
// List of OuterEnum
|
||||
const (
|
||||
PLACED OuterEnum = "placed"
|
||||
|
||||
APPROVED OuterEnum = "approved"
|
||||
|
||||
DELIVERED OuterEnum = "delivered"
|
||||
)
|
||||
|
@ -12,15 +12,10 @@ package petstore
|
||||
|
||||
type Pet struct {
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
Category *Category `json:"category,omitempty"`
|
||||
|
||||
Name string `json:"name"`
|
||||
|
||||
PhotoUrls []string `json:"photoUrls"`
|
||||
|
||||
Tags []Tag `json:"tags,omitempty"`
|
||||
|
||||
// pet status in the store
|
||||
Status string `json:"status,omitempty"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type ReadOnlyFirst struct {
|
||||
Bar string `json:"bar,omitempty"`
|
||||
|
||||
Baz string `json:"baz,omitempty"`
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ package petstore
|
||||
|
||||
type Tag struct {
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
@ -12,19 +12,12 @@ package petstore
|
||||
|
||||
type User struct {
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
Username string `json:"username,omitempty"`
|
||||
|
||||
FirstName string `json:"firstName,omitempty"`
|
||||
|
||||
LastName string `json:"lastName,omitempty"`
|
||||
|
||||
Email string `json:"email,omitempty"`
|
||||
|
||||
Password string `json:"password,omitempty"`
|
||||
|
||||
Phone string `json:"phone,omitempty"`
|
||||
|
||||
// User Status
|
||||
UserStatus int32 `json:"userStatus,omitempty"`
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user