mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 06:00:52 +00:00
Updating security samples for Go-client. (#5290)
This commit is contained in:
parent
f44949db58
commit
cac803351b
@ -1,14 +1,13 @@
|
|||||||
# Go API client for swagger
|
# Go API client for swagger
|
||||||
|
|
||||||
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
|
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 --
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client.
|
This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client.
|
||||||
|
|
||||||
- API version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r
|
- API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
- Package version: 1.0.0
|
- Package version: 1.0.0
|
||||||
- Build date: 2016-07-12T18:49:24.937+08:00
|
- Build package: io.swagger.codegen.languages.GoClientCodegen
|
||||||
- Build package: class io.swagger.codegen.languages.GoClientCodegen
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
Put the package under your project folder and add the following in import:
|
Put the package under your project folder and add the following in import:
|
||||||
@ -18,11 +17,11 @@ Put the package under your project folder and add the following in import:
|
|||||||
|
|
||||||
## Documentation for API Endpoints
|
## 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 *https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
*FakeApi* | [**TestCodeInjectEndRnNR**](docs/FakeApi.md#testcodeinjectendrnnr) | **Put** /fake | To test code injection *_/ ' \" =end \\r\\n \\n \\r
|
*FakeApi* | [**TestCodeInjectEndRnNR**](docs/FakeApi.md#testcodeinjectendrnnr) | **Put** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
|
|
||||||
|
|
||||||
## Documentation For Models
|
## Documentation For Models
|
||||||
@ -36,7 +35,7 @@ Class | Method | HTTP request | Description
|
|||||||
## api_key
|
## api_key
|
||||||
|
|
||||||
- **Type**: API key
|
- **Type**: API key
|
||||||
- **API key parameter name**: api_key */ ' " =end \r\n \n \r
|
- **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
|
||||||
- **Location**: HTTP header
|
- **Location**: HTTP header
|
||||||
|
|
||||||
## petstore_auth
|
## petstore_auth
|
||||||
@ -45,11 +44,11 @@ Class | Method | HTTP request | Description
|
|||||||
- **Flow**: implicit
|
- **Flow**: implicit
|
||||||
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||||
- **Scopes**:
|
- **Scopes**:
|
||||||
- **write:pets**: modify pets in your account */ ' " =end \r\n \n \r
|
- **write:pets**: modify pets in your account *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
- **read:pets**: read your pets */ ' " =end \r\n \n \r
|
- **read:pets**: read your pets *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
|
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
|
apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
|
|
||||||
|
@ -1,23 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
|
* 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
|
* 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 --
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r
|
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
|
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
* 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 swagger
|
package swagger
|
||||||
@ -29,10 +17,12 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"io/ioutil"
|
||||||
"github.com/go-resty/resty"
|
"github.com/go-resty/resty"
|
||||||
)
|
)
|
||||||
|
|
||||||
type APIClient struct {
|
type APIClient struct {
|
||||||
|
config *Configuration
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *APIClient) SelectHeaderContentType(contentTypes []string) string {
|
func (c *APIClient) SelectHeaderContentType(contentTypes []string) string {
|
||||||
@ -57,9 +47,9 @@ func (c *APIClient) SelectHeaderAccept(accepts []string) string {
|
|||||||
return strings.Join(accepts, ",")
|
return strings.Join(accepts, ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
func contains(source []string, containvalue string) bool {
|
func contains(haystack []string, needle string) bool {
|
||||||
for _, a := range source {
|
for _, a := range haystack {
|
||||||
if strings.ToLower(a) == strings.ToLower(containvalue) {
|
if strings.ToLower(a) == strings.ToLower(needle) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,11 +64,8 @@ func (c *APIClient) CallAPI(path string, method string,
|
|||||||
fileName string,
|
fileName string,
|
||||||
fileBytes []byte) (*resty.Response, error) {
|
fileBytes []byte) (*resty.Response, error) {
|
||||||
|
|
||||||
//set debug flag
|
rClient := c.prepareClient()
|
||||||
configuration := NewConfiguration()
|
request := c.prepareRequest(rClient, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
resty.SetDebug(configuration.GetDebug())
|
|
||||||
|
|
||||||
request := prepareRequest(postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
|
||||||
|
|
||||||
switch strings.ToUpper(method) {
|
switch strings.ToUpper(method) {
|
||||||
case "GET":
|
case "GET":
|
||||||
@ -101,33 +88,59 @@ func (c *APIClient) CallAPI(path string, method string,
|
|||||||
return nil, fmt.Errorf("invalid method %v", method)
|
return nil, fmt.Errorf("invalid method %v", method)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *APIClient) ParameterToString(obj interface{},collectionFormat string) string {
|
func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string {
|
||||||
if reflect.TypeOf(obj).String() == "[]string" {
|
delimiter := ""
|
||||||
switch collectionFormat {
|
switch collectionFormat {
|
||||||
case "pipes":
|
case "pipes":
|
||||||
return strings.Join(obj.([]string), "|")
|
delimiter = "|"
|
||||||
case "ssv":
|
case "ssv":
|
||||||
return strings.Join(obj.([]string), " ")
|
delimiter = " "
|
||||||
case "tsv":
|
case "tsv":
|
||||||
return strings.Join(obj.([]string), "\t")
|
delimiter = "\t"
|
||||||
case "csv" :
|
case "csv":
|
||||||
return strings.Join(obj.([]string), ",")
|
delimiter = ","
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.(string)
|
if reflect.TypeOf(obj).Kind() == reflect.Slice {
|
||||||
|
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt.Sprintf("%v", obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
func prepareRequest(postBody interface{},
|
func (c *APIClient) prepareClient() *resty.Client {
|
||||||
|
|
||||||
|
rClient := resty.New()
|
||||||
|
|
||||||
|
rClient.SetDebug(c.config.Debug)
|
||||||
|
if c.config.Transport != nil {
|
||||||
|
rClient.SetTransport(c.config.Transport)
|
||||||
|
}
|
||||||
|
|
||||||
|
if c.config.Timeout != nil {
|
||||||
|
rClient.SetTimeout(*c.config.Timeout)
|
||||||
|
}
|
||||||
|
rClient.SetLogger(ioutil.Discard)
|
||||||
|
return rClient
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *APIClient) prepareRequest(
|
||||||
|
rClient *resty.Client,
|
||||||
|
postBody interface{},
|
||||||
headerParams map[string]string,
|
headerParams map[string]string,
|
||||||
queryParams url.Values,
|
queryParams url.Values,
|
||||||
formParams map[string]string,
|
formParams map[string]string,
|
||||||
fileName string,
|
fileName string,
|
||||||
fileBytes []byte) *resty.Request {
|
fileBytes []byte) *resty.Request {
|
||||||
|
|
||||||
request := resty.R()
|
|
||||||
|
request := rClient.R()
|
||||||
request.SetBody(postBody)
|
request.SetBody(postBody)
|
||||||
|
|
||||||
|
if c.config.UserAgent != "" {
|
||||||
|
request.SetHeader("User-Agent", c.config.UserAgent)
|
||||||
|
}
|
||||||
|
|
||||||
// add header parameter, if any
|
// add header parameter, if any
|
||||||
if len(headerParams) > 0 {
|
if len(headerParams) > 0 {
|
||||||
request.SetHeaders(headerParams)
|
request.SetHeaders(headerParams)
|
||||||
|
@ -1,23 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
|
* 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
|
* 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 --
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r
|
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
|
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
* 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 swagger
|
package swagger
|
||||||
@ -27,8 +15,20 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type APIResponse struct {
|
type APIResponse struct {
|
||||||
*http.Response
|
*http.Response `json:"-"`
|
||||||
Message string `json:"message,omitempty"`
|
Message string `json:"message,omitempty"`
|
||||||
|
// Operation is the name of the swagger operation.
|
||||||
|
Operation string `json:"operation,omitempty"`
|
||||||
|
// 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 {
|
func NewAPIResponse(r *http.Response) *APIResponse {
|
||||||
|
@ -1,63 +1,57 @@
|
|||||||
/*
|
/*
|
||||||
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
|
* 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
|
* 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 --
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r
|
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
|
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
* 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 swagger
|
package swagger
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type Configuration struct {
|
type Configuration struct {
|
||||||
UserName string `json:"userName,omitempty"`
|
Username string `json:"userName,omitempty"`
|
||||||
Password string `json:"password,omitempty"`
|
Password string `json:"password,omitempty"`
|
||||||
APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"`
|
APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"`
|
||||||
APIKey map[string]string `json:"APIKey,omitempty"`
|
APIKey map[string]string `json:"APIKey,omitempty"`
|
||||||
debug bool `json:"debug,omitempty"`
|
Debug bool `json:"debug,omitempty"`
|
||||||
DebugFile string `json:"debugFile,omitempty"`
|
DebugFile string `json:"debugFile,omitempty"`
|
||||||
OAuthToken string `json:"oAuthToken,omitempty"`
|
OAuthToken string `json:"oAuthToken,omitempty"`
|
||||||
Timeout int `json:"timeout,omitempty"`
|
|
||||||
BasePath string `json:"basePath,omitempty"`
|
BasePath string `json:"basePath,omitempty"`
|
||||||
Host string `json:"host,omitempty"`
|
Host string `json:"host,omitempty"`
|
||||||
Scheme string `json:"scheme,omitempty"`
|
Scheme string `json:"scheme,omitempty"`
|
||||||
AccessToken string `json:"accessToken,omitempty"`
|
AccessToken string `json:"accessToken,omitempty"`
|
||||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||||
UserAgent string `json:"userAgent,omitempty"`
|
UserAgent string `json:"userAgent,omitempty"`
|
||||||
APIClient APIClient `json:"APIClient,omitempty"`
|
APIClient *APIClient
|
||||||
|
Transport *http.Transport
|
||||||
|
Timeout *time.Duration `json:"timeout,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConfiguration() *Configuration {
|
func NewConfiguration() *Configuration {
|
||||||
return &Configuration{
|
cfg := &Configuration{
|
||||||
BasePath: "https://petstore.swagger.io *_/ ' \" =end \\r\\n \\n \\r/v2 *_/ ' \" =end \\r\\n \\n \\r",
|
BasePath: "https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r",
|
||||||
UserName: "",
|
|
||||||
debug: false,
|
|
||||||
DefaultHeader: make(map[string]string),
|
DefaultHeader: make(map[string]string),
|
||||||
APIKey: make(map[string]string),
|
APIKey: make(map[string]string),
|
||||||
APIKeyPrefix: make(map[string]string),
|
APIKeyPrefix: make(map[string]string),
|
||||||
UserAgent: "Swagger-Codegen/1.0.0/go",
|
UserAgent: "Swagger-Codegen/1.0.0/go",
|
||||||
|
APIClient: &APIClient{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg.APIClient.config = cfg
|
||||||
|
return cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Configuration) GetBasicAuthEncodedString() string {
|
func (c *Configuration) GetBasicAuthEncodedString() string {
|
||||||
return base64.StdEncoding.EncodeToString([]byte(c.UserName + ":" + c.Password))
|
return base64.StdEncoding.EncodeToString([]byte(c.Username + ":" + c.Password))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Configuration) AddDefaultHeader(key string, value string) {
|
func (c *Configuration) AddDefaultHeader(key string, value string) {
|
||||||
@ -71,11 +65,3 @@ func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string {
|
|||||||
|
|
||||||
return c.APIKey[APIKeyIdentifier]
|
return c.APIKey[APIKeyIdentifier]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Configuration) SetDebug(enable bool) {
|
|
||||||
c.debug = enable
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Configuration) GetDebug() bool {
|
|
||||||
return c.debug
|
|
||||||
}
|
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
# \FakeApi
|
# \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 *https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
|
||||||
|
|
||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
[**TestCodeInjectEndRnNR**](FakeApi.md#TestCodeInjectEndRnNR) | **Put** /fake | To test code injection *_/ ' \" =end \\r\\n \\n \\r
|
[**TestCodeInjectEndRnNR**](FakeApi.md#TestCodeInjectEndRnNR) | **Put** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
|
|
||||||
|
|
||||||
# **TestCodeInjectEndRnNR**
|
# **TestCodeInjectEndRnNR**
|
||||||
> TestCodeInjectEndRnNR($testCodeInjectEndRnNR)
|
> TestCodeInjectEndRnNR($testCodeInjectEndRnNR)
|
||||||
|
|
||||||
To test code injection *_/ ' \" =end \\r\\n \\n \\r
|
To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
|
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**testCodeInjectEndRnNR** | **string**| To test code injection *_/ ' \" =end \\r\\n \\n \\r | [optional]
|
**testCodeInjectEndRnNR** | **string**| To test code injection *_/ ' \" =end -- \\r\\n \\n \\r | [optional]
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
@ -29,8 +29,8 @@ No authorization required
|
|||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: application/json, *_/ ' =end
|
- **Content-Type**: application/json, *_/ ' =end --
|
||||||
- **Accept**: application/json, *_/ ' =end
|
- **Accept**: application/json, *_/ ' =end --
|
||||||
|
|
||||||
[[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)
|
[[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)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
## Properties
|
## Properties
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
**Return_** | **int32** | property description *_/ ' \" =end \\r\\n \\n \\r | [optional] [default to null]
|
**Return_** | **int32** | property description *_/ ' \" =end -- \\r\\n \\n \\r | [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)
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
@ -1,42 +1,28 @@
|
|||||||
/*
|
/*
|
||||||
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
|
* 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
|
* 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 --
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r
|
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
|
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
* 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 swagger
|
package swagger
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
"fmt"
|
|
||||||
"errors"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
)
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
type FakeApi struct {
|
type FakeApi struct {
|
||||||
Configuration Configuration
|
Configuration *Configuration
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFakeApi() *FakeApi {
|
func NewFakeApi() *FakeApi {
|
||||||
configuration := NewConfiguration()
|
configuration := NewConfiguration()
|
||||||
return &FakeApi{
|
return &FakeApi{
|
||||||
Configuration: *configuration,
|
Configuration: configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,63 +31,66 @@ func NewFakeApiWithBasePath(basePath string) *FakeApi {
|
|||||||
configuration.BasePath = basePath
|
configuration.BasePath = basePath
|
||||||
|
|
||||||
return &FakeApi{
|
return &FakeApi{
|
||||||
Configuration: *configuration,
|
Configuration: configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To test code injection *_/ ' \" =end \\r\\n \\n \\r
|
* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
*
|
*
|
||||||
* @param testCodeInjectEndRnNR To test code injection *_/ ' \" =end \\r\\n \\n \\r
|
* @param testCodeInjectEndRnNR To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
func (a FakeApi) TestCodeInjectEndRnNR(testCodeInjectEndRnNR string) (*APIResponse, error) {
|
func (a FakeApi) TestCodeInjectEndRnNR(testCodeInjectEndRnNR string) (*APIResponse, error) {
|
||||||
|
|
||||||
var httpMethod = "Put"
|
var localVarHttpMethod = strings.ToUpper("Put")
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
path := a.Configuration.BasePath + "/fake"
|
localVarPath := a.Configuration.BasePath + "/fake"
|
||||||
|
|
||||||
|
|
||||||
headerParams := make(map[string]string)
|
|
||||||
queryParams := url.Values{}
|
|
||||||
formParams := make(map[string]string)
|
|
||||||
var postBody interface{}
|
|
||||||
var fileName string
|
|
||||||
var fileBytes []byte
|
|
||||||
|
|
||||||
|
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
|
// add default headers if any
|
||||||
for key := range a.Configuration.DefaultHeader {
|
for key := range a.Configuration.DefaultHeader {
|
||||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string{ "application/json", "*_/ ' =end ", }
|
localVarHttpContentTypes := []string{ "application/json", "*_/ ' =end -- ", }
|
||||||
|
|
||||||
// set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
if localVarHttpContentType != "" {
|
if localVarHttpContentType != "" {
|
||||||
headerParams["Content-Type"] = localVarHttpContentType
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
}
|
}
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string{
|
localVarHttpHeaderAccepts := []string{
|
||||||
"application/json",
|
"application/json",
|
||||||
"*_/ ' =end ",
|
"*_/ ' =end -- ",
|
||||||
}
|
}
|
||||||
|
|
||||||
// set Accept header
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
if localVarHttpHeaderAccept != "" {
|
if localVarHttpHeaderAccept != "" {
|
||||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
localVarFormParams["testCodeInjectEndRnNR"] = a.Configuration.APIClient.ParameterToString(testCodeInjectEndRnNR, "")
|
||||||
|
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: "TestCodeInjectEndRnNR", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
|
||||||
|
if localVarHttpResponse != nil {
|
||||||
|
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
|
||||||
|
localVarAPIResponse.Payload = localVarHttpResponse.Body()
|
||||||
}
|
}
|
||||||
|
|
||||||
formParams["testCodeInjectEndRnNR"] = testCodeInjectEndRnNR
|
|
||||||
|
|
||||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return NewAPIResponse(httpResponse.RawResponse), err
|
return localVarAPIResponse, err
|
||||||
}
|
}
|
||||||
|
return localVarAPIResponse, err
|
||||||
return NewAPIResponse(httpResponse.RawResponse), err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,30 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r
|
* 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
|
* 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 --
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r
|
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r
|
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
* 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 swagger
|
package swagger
|
||||||
|
|
||||||
// Model for testing reserved words *_/ ' \" =end \\r\\n \\n \\r
|
// Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
type ModelReturn struct {
|
type ModelReturn struct {
|
||||||
|
|
||||||
// property description *_/ ' \" =end \\r\\n \\n \\r
|
// property description *_/ ' \" =end -- \\r\\n \\n \\r
|
||||||
Return_ int32 `json:"return,omitempty"`
|
Return_ int32 `json:"return,omitempty"`
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user