#3690 adding RequestURL, Method, Operation and Payload fields to APIResponse

This commit is contained in:
Neil O'Toole
2016-09-02 06:49:39 -06:00
parent 7a4a430c43
commit 8183d96088
55 changed files with 1686 additions and 91 deletions

View File

@@ -414,11 +414,10 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
}
}
// this will only import "strings" "fmt" if there are items in pathParams
// this will only import "fmt" if there are items in pathParams
for (CodegenOperation operation : operations) {
if(operation.pathParams != null && operation.pathParams.size() > 0) {
imports.add(createMapping("import", "fmt"));
imports.add(createMapping("import", "strings"));
break; //just need to import once
}
}

View File

@@ -4,6 +4,7 @@ package {{packageName}}
{{#operations}}
import (
"net/url"
"strings"
{{#imports}} "{{import}}"
{{/imports}}
)
@@ -38,7 +39,7 @@ func New{{classname}}WithBasePath(basePath string) *{{classname}} {
*/
func (a {{{classname}}}) {{{nickname}}}({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{^isListContainer}}*{{/isListContainer}}{{{returnType}}}, {{/returnType}}*APIResponse, error) {
var localVarHttpMethod = "{{httpMethod}}"
var localVarHttpMethod = strings.ToUpper("{{httpMethod}}")
// create path and map variables
localVarPath := a.Configuration.BasePath + "{{path}}"{{#pathParams}}
localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", fmt.Sprintf("%v", {{paramName}}), -1){{/pathParams}}
@@ -135,11 +136,20 @@ func (a {{{classname}}}) {{{nickname}}}({{#allParams}}{{paramName}} {{{dataType}
{{/bodyParams}}{{/hasBodyParam}}
{{#returnType}} var successPayload = new({{returnType}}){{/returnType}}
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}successPayload, {{/returnType}}NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "{{operationId}}", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
if err != nil {
return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}successPayload, {{/returnType}}localVarAPIResponse, err
}
{{#returnType}}
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload){{/returnType}}
return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}successPayload, {{/returnType}}NewAPIResponse(localVarHttpResponse.RawResponse), err
return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}successPayload, {{/returnType}}localVarAPIResponse, err
}
{{/operation}}{{/operations}}

View File

@@ -6,8 +6,20 @@ import (
)
type APIResponse struct {
*http.Response
*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 {

View File

@@ -0,0 +1,30 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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"`
}

View File

@@ -0,0 +1,30 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type Animal struct {
ClassName string `json:"className,omitempty"`
Color string `json:"color,omitempty"`
}

View File

@@ -0,0 +1,26 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type AnimalFarm struct {
}

View File

@@ -27,8 +27,20 @@ import (
)
type APIResponse struct {
*http.Response
*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 {

View File

@@ -0,0 +1,28 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type ArrayOfArrayOfNumberOnly struct {
ArrayArrayNumber [][]float32 `json:"ArrayArrayNumber,omitempty"`
}

View File

@@ -0,0 +1,28 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type ArrayOfNumberOnly struct {
ArrayNumber []float32 `json:"ArrayNumber,omitempty"`
}

View File

@@ -0,0 +1,32 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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"`
}

View File

@@ -0,0 +1,32 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type Cat struct {
ClassName string `json:"className,omitempty"`
Color string `json:"color,omitempty"`
Declawed bool `json:"declawed,omitempty"`
}

View File

@@ -0,0 +1,28 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type Client struct {
Client string `json:"client,omitempty"`
}

View File

@@ -0,0 +1,11 @@
# AdditionalPropertiesClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MapProperty** | **map[string]string** | | [optional] [default to null]
**MapOfMapProperty** | [**map[string]map[string]string**](map.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,11 @@
# Animal
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | | [default to null]
**Color** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,9 @@
# AnimalFarm
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,10 @@
# ArrayOfArrayOfNumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayArrayNumber** | [**[][]float32**](array.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,10 @@
# ArrayOfNumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayNumber** | **[]float32** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,12 @@
# ArrayTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayOfString** | **[]string** | | [optional] [default to null]
**ArrayArrayOfInteger** | [**[][]int64**](array.md) | | [optional] [default to null]
**ArrayArrayOfModel** | [**[][]ReadOnlyFirst**](array.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,12 @@
# Cat
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | | [default to null]
**Color** | **string** | | [optional] [default to null]
**Declawed** | **bool** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,10 @@
# Client
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Client** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,12 @@
# Dog
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | | [default to null]
**Color** | **string** | | [optional] [default to null]
**Breed** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,11 @@
# EnumArrays
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**JustSymbol** | **string** | | [optional] [default to null]
**ArrayEnum** | **[]string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,9 @@
# EnumClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,12 @@
# EnumTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**EnumString** | **string** | | [optional] [default to null]
**EnumInteger** | **int32** | | [optional] [default to null]
**EnumNumber** | **float64** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,113 @@
# \FakeApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**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
# **TestClientModel**
> Client TestClientModel($body)
To test \"client\" model
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Client**](Client.md)| client model |
### Return type
[**Client**](Client.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[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($number, $double, $patternWithoutDelimiter, $byte_, $integer, $int32_, $int64_, $float, $string_, $binary, $date, $dateTime, $password)
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**number** | **float32**| None |
**double** | **float64**| None |
**patternWithoutDelimiter** | **string**| None |
**byte_** | **string**| None |
**integer** | **int32**| None | [optional]
**int32_** | **int32**| None | [optional]
**int64_** | **int64**| None | [optional]
**float** | **float32**| None | [optional]
**string_** | **string**| None | [optional]
**binary** | **string**| None | [optional]
**date** | **time.Time**| None | [optional]
**dateTime** | **time.Time**| None | [optional]
**password** | **string**| None | [optional]
### Return type
void (empty response body)
### Authorization
[http_basic_test](../README.md#http_basic_test)
### 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
[[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)
# **TestEnumParameters**
> TestEnumParameters($enumFormStringArray, $enumFormString, $enumHeaderStringArray, $enumHeaderString, $enumQueryStringArray, $enumQueryString, $enumQueryInteger, $enumQueryDouble)
To test enum parameters
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**enumFormStringArray** | [**[]string**](string.md)| Form parameter enum test (string array) | [optional]
**enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg]
**enumHeaderStringArray** | [**[]string**](string.md)| Header parameter enum test (string array) | [optional]
**enumHeaderString** | **string**| Header parameter enum test (string) | [optional] [default to -efg]
**enumQueryStringArray** | [**[]string**](string.md)| Query parameter enum test (string array) | [optional]
**enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg]
**enumQueryInteger** | **float32**| Query parameter enum test (double) | [optional]
**enumQueryDouble** | **float64**| Query parameter enum test (double) | [optional]
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[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)

View File

@@ -0,0 +1,22 @@
# FormatTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Integer** | **int32** | | [optional] [default to null]
**Int32_** | **int32** | | [optional] [default to null]
**Int64_** | **int64** | | [optional] [default to null]
**Number** | **float32** | | [default to null]
**Float** | **float32** | | [optional] [default to null]
**Double** | **float64** | | [optional] [default to null]
**String_** | **string** | | [optional] [default to null]
**Byte_** | **string** | | [default to null]
**Binary** | **string** | | [optional] [default to null]
**Date** | [**time.Time**](time.Time.md) | | [default to null]
**DateTime** | [**time.Time**](time.Time.md) | | [optional] [default to null]
**Uuid** | **string** | | [optional] [default to null]
**Password** | **string** | | [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,11 @@
# HasOnlyReadOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Bar** | **string** | | [optional] [default to null]
**Foo** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,10 @@
# List
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Var123List** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,11 @@
# MapTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MapMapOfString** | [**map[string]map[string]string**](map.md) | | [optional] [default to null]
**MapOfEnumString** | **map[string]string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,12 @@
# MixedPropertiesAndAdditionalPropertiesClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Uuid** | **string** | | [optional] [default to null]
**DateTime** | [**time.Time**](time.Time.md) | | [optional] [default to null]
**Map_** | [**map[string]Animal**](Animal.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,11 @@
# Model200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **int32** | | [optional] [default to null]
**Class** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,10 @@
# ModelReturn
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Return_** | **int32** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,13 @@
# Name
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **int32** | | [default to null]
**SnakeCase** | **int32** | | [optional] [default to null]
**Property** | **string** | | [optional] [default to null]
**Var123Number** | **int32** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,10 @@
# NumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**JustNumber** | **float32** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,11 @@
# ReadOnlyFirst
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Bar** | **string** | | [optional] [default to null]
**Baz** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,10 @@
# SpecialModelName
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**SpecialPropertyName** | **int64** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,32 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type Dog struct {
ClassName string `json:"className,omitempty"`
Color string `json:"color,omitempty"`
Breed string `json:"breed,omitempty"`
}

View File

@@ -0,0 +1,30 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type EnumArrays struct {
JustSymbol string `json:"just_symbol,omitempty"`
ArrayEnum []string `json:"array_enum,omitempty"`
}

View File

@@ -0,0 +1,26 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type EnumClass struct {
}

View File

@@ -0,0 +1,32 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type EnumTest struct {
EnumString string `json:"enum_string,omitempty"`
EnumInteger int32 `json:"enum_integer,omitempty"`
EnumNumber float64 `json:"enum_number,omitempty"`
}

View File

@@ -0,0 +1,294 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
import (
"net/url"
"strings"
"time"
"encoding/json"
)
type FakeApi struct {
Configuration *Configuration
}
func NewFakeApi() *FakeApi {
configuration := NewConfiguration()
return &FakeApi{
Configuration: configuration,
}
}
func NewFakeApiWithBasePath(basePath string) *FakeApi {
configuration := NewConfiguration()
configuration.BasePath = basePath
return &FakeApi{
Configuration: configuration,
}
}
/**
* To test \"client\" model
*
* @param body client model
* @return *Client
*/
func (a FakeApi) TestClientModel(body Client) (*Client, *APIResponse, error) {
var localVarHttpMethod = strings.ToUpper("Patch")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/fake"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any
for key := range a.Configuration.DefaultHeader {
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{ "application/json", }
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"application/json",
}
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
// body params
localVarPostBody = &body
var successPayload = new(Client)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "TestClientModel", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
if err != nil {
return successPayload, localVarAPIResponse, err
}
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, localVarAPIResponse, err
}
/**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*
* @param number None
* @param double None
* @param patternWithoutDelimiter None
* @param byte_ None
* @param integer None
* @param int32_ None
* @param int64_ None
* @param float None
* @param string_ None
* @param binary None
* @param date None
* @param dateTime None
* @param password None
* @return void
*/
func (a FakeApi) TestEndpointParameters(number float32, double float64, patternWithoutDelimiter string, byte_ string, integer int32, int32_ int32, int64_ int64, float float32, string_ string, binary string, date time.Time, dateTime time.Time, password string) (*APIResponse, error) {
var localVarHttpMethod = strings.ToUpper("Post")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/fake"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// authentication '(http_basic_test)' required
// http basic authentication required
if a.Configuration.UserName != "" || a.Configuration.Password != ""{
localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString()
}
// add default headers if any
for key := range a.Configuration.DefaultHeader {
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{ "application/xml; charset=utf-8", "application/json; charset=utf-8", }
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"application/xml; charset=utf-8",
"application/json; charset=utf-8",
}
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
localVarFormParams["integer"] = a.Configuration.APIClient.ParameterToString(integer, "")
localVarFormParams["int32_"] = a.Configuration.APIClient.ParameterToString(int32_, "")
localVarFormParams["int64_"] = a.Configuration.APIClient.ParameterToString(int64_, "")
localVarFormParams["number"] = a.Configuration.APIClient.ParameterToString(number, "")
localVarFormParams["float"] = a.Configuration.APIClient.ParameterToString(float, "")
localVarFormParams["double"] = a.Configuration.APIClient.ParameterToString(double, "")
localVarFormParams["string_"] = a.Configuration.APIClient.ParameterToString(string_, "")
localVarFormParams["patternWithoutDelimiter"] = a.Configuration.APIClient.ParameterToString(patternWithoutDelimiter, "")
localVarFormParams["byte_"] = a.Configuration.APIClient.ParameterToString(byte_, "")
localVarFormParams["binary"] = a.Configuration.APIClient.ParameterToString(binary, "")
localVarFormParams["date"] = a.Configuration.APIClient.ParameterToString(date, "")
localVarFormParams["dateTime"] = a.Configuration.APIClient.ParameterToString(dateTime, "")
localVarFormParams["password"] = a.Configuration.APIClient.ParameterToString(password, "")
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "TestEndpointParameters", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
if err != nil {
return localVarAPIResponse, err
}
return localVarAPIResponse, err
}
/**
* To test enum parameters
*
* @param enumFormStringArray Form parameter enum test (string array)
* @param enumFormString Form parameter enum test (string)
* @param enumHeaderStringArray Header parameter enum test (string array)
* @param enumHeaderString Header parameter enum test (string)
* @param enumQueryStringArray Query parameter enum test (string array)
* @param enumQueryString Query parameter enum test (string)
* @param enumQueryInteger Query parameter enum test (double)
* @param enumQueryDouble Query parameter enum test (double)
* @return void
*/
func (a FakeApi) TestEnumParameters(enumFormStringArray []string, enumFormString string, enumHeaderStringArray []string, enumHeaderString string, enumQueryStringArray []string, enumQueryString string, enumQueryInteger float32, enumQueryDouble float64) (*APIResponse, error) {
var localVarHttpMethod = strings.ToUpper("Get")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/fake"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any
for key := range a.Configuration.DefaultHeader {
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
var collectionFormat = "csv"
if collectionFormat == "multi" {
for _, value := range enumQueryStringArray {
localVarQueryParams.Add("enum_query_string_array", value)
}
} else {
localVarQueryParams.Add("enum_query_string_array", a.Configuration.APIClient.ParameterToString(enumQueryStringArray, collectionFormat))
}
localVarQueryParams.Add("enum_query_string", a.Configuration.APIClient.ParameterToString(enumQueryString, ""))
localVarQueryParams.Add("enum_query_integer", a.Configuration.APIClient.ParameterToString(enumQueryInteger, ""))
// to determine the Content-Type header
localVarHttpContentTypes := []string{ "application/json", }
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"application/json",
}
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
// header params "enum_header_string_array"
localVarHeaderParams["enum_header_string_array"] = a.Configuration.APIClient.ParameterToString(enumHeaderStringArray, "")
// header params "enum_header_string"
localVarHeaderParams["enum_header_string"] = a.Configuration.APIClient.ParameterToString(enumHeaderString, "")
localVarFormParams["enumFormStringArray"] = a.Configuration.APIClient.ParameterToString(enumFormStringArray, "")
localVarFormParams["enumFormString"] = a.Configuration.APIClient.ParameterToString(enumFormString, "")
localVarFormParams["enumQueryDouble"] = a.Configuration.APIClient.ParameterToString(enumQueryDouble, "")
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "TestEnumParameters", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
if err != nil {
return localVarAPIResponse, err
}
return localVarAPIResponse, err
}

View File

@@ -0,0 +1,56 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
import (
"time"
)
type FormatTest struct {
Integer int32 `json:"integer,omitempty"`
Int32_ int32 `json:"int32,omitempty"`
Int64_ int64 `json:"int64,omitempty"`
Number float32 `json:"number,omitempty"`
Float float32 `json:"float,omitempty"`
Double float64 `json:"double,omitempty"`
String_ string `json:"string,omitempty"`
Byte_ string `json:"byte,omitempty"`
Binary string `json:"binary,omitempty"`
Date time.Time `json:"date,omitempty"`
DateTime time.Time `json:"dateTime,omitempty"`
Uuid string `json:"uuid,omitempty"`
Password string `json:"password,omitempty"`
}

View File

@@ -0,0 +1,30 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type HasOnlyReadOnly struct {
Bar string `json:"bar,omitempty"`
Foo string `json:"foo,omitempty"`
}

View File

@@ -0,0 +1,28 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type List struct {
Var123List string `json:"123-list,omitempty"`
}

View File

@@ -0,0 +1,30 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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"`
}

View File

@@ -0,0 +1,36 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
import (
"time"
)
type MixedPropertiesAndAdditionalPropertiesClass struct {
Uuid string `json:"uuid,omitempty"`
DateTime time.Time `json:"dateTime,omitempty"`
Map_ map[string]Animal `json:"map,omitempty"`
}

View File

@@ -0,0 +1,31 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
// Model for testing model name starting with number
type Model200Response struct {
Name int32 `json:"name,omitempty"`
Class string `json:"class,omitempty"`
}

View File

@@ -0,0 +1,29 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
// Model for testing reserved words
type ModelReturn struct {
Return_ int32 `json:"return,omitempty"`
}

View File

@@ -0,0 +1,35 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
// Model for testing model name same as property name
type Name struct {
Name int32 `json:"name,omitempty"`
SnakeCase int32 `json:"snake_case,omitempty"`
Property string `json:"property,omitempty"`
Var123Number int32 `json:"123Number,omitempty"`
}

View File

@@ -0,0 +1,28 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type NumberOnly struct {
JustNumber float32 `json:"JustNumber,omitempty"`
}

View File

@@ -24,11 +24,11 @@ package petstore
import (
"net/url"
"strings"
"os"
"io/ioutil"
"encoding/json"
"fmt"
"strings"
)
type PetApi struct {
@@ -60,7 +60,7 @@ func NewPetApiWithBasePath(basePath string) *PetApi {
*/
func (a PetApi) AddPet(body Pet) (*APIResponse, error) {
var localVarHttpMethod = "Post"
var localVarHttpMethod = strings.ToUpper("Post")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/pet"
@@ -105,11 +105,20 @@ func (a PetApi) AddPet(body Pet) (*APIResponse, error) {
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "AddPet", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
return NewAPIResponse(localVarHttpResponse.RawResponse), err
if err != nil {
return localVarAPIResponse, err
}
return localVarAPIResponse, err
}
/**
@@ -122,7 +131,7 @@ func (a PetApi) AddPet(body Pet) (*APIResponse, error) {
*/
func (a PetApi) DeletePet(petId int64, apiKey string) (*APIResponse, error) {
var localVarHttpMethod = "Delete"
var localVarHttpMethod = strings.ToUpper("Delete")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
@@ -170,11 +179,20 @@ func (a PetApi) DeletePet(petId int64, apiKey string) (*APIResponse, error) {
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "DeletePet", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
return NewAPIResponse(localVarHttpResponse.RawResponse), err
if err != nil {
return localVarAPIResponse, err
}
return localVarAPIResponse, err
}
/**
@@ -186,7 +204,7 @@ func (a PetApi) DeletePet(petId int64, apiKey string) (*APIResponse, error) {
*/
func (a PetApi) FindPetsByStatus(status []string) ([]Pet, *APIResponse, error) {
var localVarHttpMethod = "Get"
var localVarHttpMethod = strings.ToUpper("Get")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/pet/findByStatus"
@@ -237,11 +255,20 @@ func (a PetApi) FindPetsByStatus(status []string) ([]Pet, *APIResponse, error) {
var successPayload = new([]Pet)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return *successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "FindPetsByStatus", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
if err != nil {
return *successPayload, localVarAPIResponse, err
}
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return *successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
return *successPayload, localVarAPIResponse, err
}
/**
@@ -253,7 +280,7 @@ func (a PetApi) FindPetsByStatus(status []string) ([]Pet, *APIResponse, error) {
*/
func (a PetApi) FindPetsByTags(tags []string) ([]Pet, *APIResponse, error) {
var localVarHttpMethod = "Get"
var localVarHttpMethod = strings.ToUpper("Get")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/pet/findByTags"
@@ -304,11 +331,20 @@ func (a PetApi) FindPetsByTags(tags []string) ([]Pet, *APIResponse, error) {
var successPayload = new([]Pet)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return *successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "FindPetsByTags", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
if err != nil {
return *successPayload, localVarAPIResponse, err
}
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return *successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
return *successPayload, localVarAPIResponse, err
}
/**
@@ -320,7 +356,7 @@ func (a PetApi) FindPetsByTags(tags []string) ([]Pet, *APIResponse, error) {
*/
func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) {
var localVarHttpMethod = "Get"
var localVarHttpMethod = strings.ToUpper("Get")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
@@ -362,11 +398,20 @@ func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) {
var successPayload = new(Pet)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "GetPetById", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
if err != nil {
return successPayload, localVarAPIResponse, err
}
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
return successPayload, localVarAPIResponse, err
}
/**
@@ -378,7 +423,7 @@ func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) {
*/
func (a PetApi) UpdatePet(body Pet) (*APIResponse, error) {
var localVarHttpMethod = "Put"
var localVarHttpMethod = strings.ToUpper("Put")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/pet"
@@ -423,11 +468,20 @@ func (a PetApi) UpdatePet(body Pet) (*APIResponse, error) {
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "UpdatePet", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
return NewAPIResponse(localVarHttpResponse.RawResponse), err
if err != nil {
return localVarAPIResponse, err
}
return localVarAPIResponse, err
}
/**
@@ -441,7 +495,7 @@ func (a PetApi) UpdatePet(body Pet) (*APIResponse, error) {
*/
func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (*APIResponse, error) {
var localVarHttpMethod = "Post"
var localVarHttpMethod = strings.ToUpper("Post")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
@@ -487,11 +541,20 @@ func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (*API
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "UpdatePetWithForm", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
return NewAPIResponse(localVarHttpResponse.RawResponse), err
if err != nil {
return localVarAPIResponse, err
}
return localVarAPIResponse, err
}
/**
@@ -505,7 +568,7 @@ func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (*API
*/
func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File) (*ModelApiResponse, *APIResponse, error) {
var localVarHttpMethod = "Post"
var localVarHttpMethod = strings.ToUpper("Post")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/pet/{petId}/uploadImage"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
@@ -552,10 +615,19 @@ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File
var successPayload = new(ModelApiResponse)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "UploadFile", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
if err != nil {
return successPayload, localVarAPIResponse, err
}
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
return successPayload, localVarAPIResponse, err
}

View File

@@ -0,0 +1,30 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type ReadOnlyFirst struct {
Bar string `json:"bar,omitempty"`
Baz string `json:"baz,omitempty"`
}

View File

@@ -0,0 +1,28 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package petstore
type SpecialModelName struct {
SpecialPropertyName int64 `json:"$special[property.name],omitempty"`
}

View File

@@ -24,9 +24,9 @@ package petstore
import (
"net/url"
"strings"
"encoding/json"
"fmt"
"strings"
)
type StoreApi struct {
@@ -58,7 +58,7 @@ func NewStoreApiWithBasePath(basePath string) *StoreApi {
*/
func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error) {
var localVarHttpMethod = "Delete"
var localVarHttpMethod = strings.ToUpper("Delete")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/store/order/{orderId}"
localVarPath = strings.Replace(localVarPath, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1)
@@ -97,11 +97,20 @@ func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error) {
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "DeleteOrder", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
return NewAPIResponse(localVarHttpResponse.RawResponse), err
if err != nil {
return localVarAPIResponse, err
}
return localVarAPIResponse, err
}
/**
@@ -112,7 +121,7 @@ func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error) {
*/
func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) {
var localVarHttpMethod = "Get"
var localVarHttpMethod = strings.ToUpper("Get")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/store/inventory"
@@ -152,11 +161,20 @@ func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) {
var successPayload = new(map[string]int32)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "GetInventory", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
if err != nil {
return successPayload, localVarAPIResponse, err
}
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
return successPayload, localVarAPIResponse, err
}
/**
@@ -168,7 +186,7 @@ func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) {
*/
func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) {
var localVarHttpMethod = "Get"
var localVarHttpMethod = strings.ToUpper("Get")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/store/order/{orderId}"
localVarPath = strings.Replace(localVarPath, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1)
@@ -207,11 +225,20 @@ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) {
var successPayload = new(Order)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "GetOrderById", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
if err != nil {
return successPayload, localVarAPIResponse, err
}
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
return successPayload, localVarAPIResponse, err
}
/**
@@ -223,7 +250,7 @@ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) {
*/
func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error) {
var localVarHttpMethod = "Post"
var localVarHttpMethod = strings.ToUpper("Post")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/store/order"
@@ -263,10 +290,19 @@ func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error) {
var successPayload = new(Order)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "PlaceOrder", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
if err != nil {
return successPayload, localVarAPIResponse, err
}
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
return successPayload, localVarAPIResponse, err
}

View File

@@ -24,9 +24,9 @@ package petstore
import (
"net/url"
"strings"
"encoding/json"
"fmt"
"strings"
)
type UserApi struct {
@@ -58,7 +58,7 @@ func NewUserApiWithBasePath(basePath string) *UserApi {
*/
func (a UserApi) CreateUser(body User) (*APIResponse, error) {
var localVarHttpMethod = "Post"
var localVarHttpMethod = strings.ToUpper("Post")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/user"
@@ -98,11 +98,20 @@ func (a UserApi) CreateUser(body User) (*APIResponse, error) {
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "CreateUser", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
return NewAPIResponse(localVarHttpResponse.RawResponse), err
if err != nil {
return localVarAPIResponse, err
}
return localVarAPIResponse, err
}
/**
@@ -114,7 +123,7 @@ func (a UserApi) CreateUser(body User) (*APIResponse, error) {
*/
func (a UserApi) CreateUsersWithArrayInput(body []User) (*APIResponse, error) {
var localVarHttpMethod = "Post"
var localVarHttpMethod = strings.ToUpper("Post")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/user/createWithArray"
@@ -154,11 +163,20 @@ func (a UserApi) CreateUsersWithArrayInput(body []User) (*APIResponse, error) {
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "CreateUsersWithArrayInput", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
return NewAPIResponse(localVarHttpResponse.RawResponse), err
if err != nil {
return localVarAPIResponse, err
}
return localVarAPIResponse, err
}
/**
@@ -170,7 +188,7 @@ func (a UserApi) CreateUsersWithArrayInput(body []User) (*APIResponse, error) {
*/
func (a UserApi) CreateUsersWithListInput(body []User) (*APIResponse, error) {
var localVarHttpMethod = "Post"
var localVarHttpMethod = strings.ToUpper("Post")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/user/createWithList"
@@ -210,11 +228,20 @@ func (a UserApi) CreateUsersWithListInput(body []User) (*APIResponse, error) {
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "CreateUsersWithListInput", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
return NewAPIResponse(localVarHttpResponse.RawResponse), err
if err != nil {
return localVarAPIResponse, err
}
return localVarAPIResponse, err
}
/**
@@ -226,7 +253,7 @@ func (a UserApi) CreateUsersWithListInput(body []User) (*APIResponse, error) {
*/
func (a UserApi) DeleteUser(username string) (*APIResponse, error) {
var localVarHttpMethod = "Delete"
var localVarHttpMethod = strings.ToUpper("Delete")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
@@ -265,11 +292,20 @@ func (a UserApi) DeleteUser(username string) (*APIResponse, error) {
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "DeleteUser", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
return NewAPIResponse(localVarHttpResponse.RawResponse), err
if err != nil {
return localVarAPIResponse, err
}
return localVarAPIResponse, err
}
/**
@@ -281,7 +317,7 @@ func (a UserApi) DeleteUser(username string) (*APIResponse, error) {
*/
func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) {
var localVarHttpMethod = "Get"
var localVarHttpMethod = strings.ToUpper("Get")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
@@ -320,11 +356,20 @@ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) {
var successPayload = new(User)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "GetUserByName", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
if err != nil {
return successPayload, localVarAPIResponse, err
}
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
return successPayload, localVarAPIResponse, err
}
/**
@@ -337,7 +382,7 @@ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) {
*/
func (a UserApi) LoginUser(username string, password string) (*string, *APIResponse, error) {
var localVarHttpMethod = "Get"
var localVarHttpMethod = strings.ToUpper("Get")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/user/login"
@@ -377,11 +422,20 @@ func (a UserApi) LoginUser(username string, password string) (*string, *APIRespo
var successPayload = new(string)
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "LoginUser", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
if err != nil {
return successPayload, localVarAPIResponse, err
}
err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err
return successPayload, localVarAPIResponse, err
}
/**
@@ -392,7 +446,7 @@ func (a UserApi) LoginUser(username string, password string) (*string, *APIRespo
*/
func (a UserApi) LogoutUser() (*APIResponse, error) {
var localVarHttpMethod = "Get"
var localVarHttpMethod = strings.ToUpper("Get")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/user/logout"
@@ -430,11 +484,20 @@ func (a UserApi) LogoutUser() (*APIResponse, error) {
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "LogoutUser", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
return NewAPIResponse(localVarHttpResponse.RawResponse), err
if err != nil {
return localVarAPIResponse, err
}
return localVarAPIResponse, err
}
/**
@@ -447,7 +510,7 @@ func (a UserApi) LogoutUser() (*APIResponse, error) {
*/
func (a UserApi) UpdateUser(username string, body User) (*APIResponse, error) {
var localVarHttpMethod = "Put"
var localVarHttpMethod = strings.ToUpper("Put")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
@@ -488,10 +551,19 @@ func (a UserApi) UpdateUser(username string, body User) (*APIResponse, error) {
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return NewAPIResponse(localVarHttpResponse.RawResponse), err
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "UpdateUser", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
return NewAPIResponse(localVarHttpResponse.RawResponse), err
if err != nil {
return localVarAPIResponse, err
}
return localVarAPIResponse, err
}