forked from loafle/openapi-generator-original
Run bin/openapi3/go-petstore.sh
This commit is contained in:
parent
f498681c68
commit
376e1bacac
24
samples/openapi3/client/petstore/go/go-petstore/.gitignore
vendored
Normal file
24
samples/openapi3/client/petstore/go/go-petstore/.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Folders
|
||||||
|
_obj
|
||||||
|
_test
|
||||||
|
|
||||||
|
# Architecture specific extensions/prefixes
|
||||||
|
*.[568vq]
|
||||||
|
[568vq].out
|
||||||
|
|
||||||
|
*.cgo1.go
|
||||||
|
*.cgo2.c
|
||||||
|
_cgo_defun.c
|
||||||
|
_cgo_gotypes.go
|
||||||
|
_cgo_export.*
|
||||||
|
|
||||||
|
_testmain.go
|
||||||
|
|
||||||
|
*.exe
|
||||||
|
*.test
|
||||||
|
*.prof
|
@ -0,0 +1,23 @@
|
|||||||
|
# OpenAPI Generator Ignore
|
||||||
|
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||||
|
|
||||||
|
# Use this file to prevent files from being overwritten by the generator.
|
||||||
|
# The patterns follow closely to .gitignore or .dockerignore.
|
||||||
|
|
||||||
|
# As an example, the C# client generator defines ApiClient.cs.
|
||||||
|
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||||
|
#ApiClient.cs
|
||||||
|
|
||||||
|
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||||
|
#foo/*/qux
|
||||||
|
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||||
|
#foo/**/qux
|
||||||
|
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can also negate patterns with an exclamation (!).
|
||||||
|
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||||
|
#docs/*.md
|
||||||
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
|
#!docs/README.md
|
@ -0,0 +1 @@
|
|||||||
|
4.0.0-SNAPSHOT
|
@ -0,0 +1,8 @@
|
|||||||
|
language: go
|
||||||
|
|
||||||
|
install:
|
||||||
|
- go get -d -v .
|
||||||
|
|
||||||
|
script:
|
||||||
|
- go build -v ./
|
||||||
|
|
182
samples/openapi3/client/petstore/go/go-petstore/README.md
Normal file
182
samples/openapi3/client/petstore/go/go-petstore/README.md
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
# Go API client for 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: \" \\
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
|
||||||
|
|
||||||
|
- API version: 1.0.0
|
||||||
|
- Package version: 1.0.0
|
||||||
|
- Build package: org.openapitools.codegen.languages.GoClientCodegen
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Install the following dependencies:
|
||||||
|
```
|
||||||
|
go get github.com/stretchr/testify/assert
|
||||||
|
go get golang.org/x/oauth2
|
||||||
|
go get golang.org/x/net/context
|
||||||
|
go get github.com/antihax/optional
|
||||||
|
```
|
||||||
|
|
||||||
|
Put the package under your project folder and add the following in import:
|
||||||
|
```golang
|
||||||
|
import "./petstore"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||||
|
|
||||||
|
Class | Method | HTTP request | Description
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
*AnotherFakeApi* | [**Call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **Patch** /another-fake/dummy | To test special tags
|
||||||
|
*DefaultApi* | [**FooGet**](docs/DefaultApi.md#fooget) | **Get** /foo |
|
||||||
|
*FakeApi* | [**FakeHealthGet**](docs/FakeApi.md#fakehealthget) | **Get** /fake/health | Health check endpoint
|
||||||
|
*FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **Post** /fake/outer/boolean |
|
||||||
|
*FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **Post** /fake/outer/composite |
|
||||||
|
*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **Post** /fake/outer/number |
|
||||||
|
*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **Post** /fake/outer/string |
|
||||||
|
*FakeApi* | [**TestBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **Put** /fake/body-with-file-schema |
|
||||||
|
*FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **Put** /fake/body-with-query-params |
|
||||||
|
*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **Patch** /fake | To test \"client\" model
|
||||||
|
*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
|
*FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **Get** /fake | To test enum parameters
|
||||||
|
*FakeApi* | [**TestGroupParameters**](docs/FakeApi.md#testgroupparameters) | **Delete** /fake | Fake endpoint to test group parameters (optional)
|
||||||
|
*FakeApi* | [**TestInlineAdditionalProperties**](docs/FakeApi.md#testinlineadditionalproperties) | **Post** /fake/inline-additionalProperties | test inline additionalProperties
|
||||||
|
*FakeApi* | [**TestJsonFormData**](docs/FakeApi.md#testjsonformdata) | **Get** /fake/jsonFormData | test json serialization of form data
|
||||||
|
*FakeClassnameTags123Api* | [**TestClassname**](docs/FakeClassnameTags123Api.md#testclassname) | **Patch** /fake_classname_test | To test class name in snake case
|
||||||
|
*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **Post** /pet | Add a new pet to the store
|
||||||
|
*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **Delete** /pet/{petId} | Deletes a pet
|
||||||
|
*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **Get** /pet/findByStatus | Finds Pets by status
|
||||||
|
*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **Get** /pet/findByTags | Finds Pets by tags
|
||||||
|
*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **Get** /pet/{petId} | Find pet by ID
|
||||||
|
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **Put** /pet | Update an existing pet
|
||||||
|
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **Post** /pet/{petId} | Updates a pet in the store with form data
|
||||||
|
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **Post** /pet/{petId}/uploadImage | uploads an image
|
||||||
|
*PetApi* | [**UploadFileWithRequiredFile**](docs/PetApi.md#uploadfilewithrequiredfile) | **Post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
|
||||||
|
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **Delete** /store/order/{order_id} | Delete purchase order by ID
|
||||||
|
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **Get** /store/inventory | Returns pet inventories by status
|
||||||
|
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **Get** /store/order/{order_id} | Find purchase order by ID
|
||||||
|
*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **Post** /store/order | Place an order for a pet
|
||||||
|
*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **Post** /user | Create user
|
||||||
|
*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **Post** /user/createWithArray | Creates list of users with given input array
|
||||||
|
*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **Post** /user/createWithList | Creates list of users with given input array
|
||||||
|
*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **Delete** /user/{username} | Delete user
|
||||||
|
*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **Get** /user/{username} | Get user by user name
|
||||||
|
*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **Get** /user/login | Logs user into the system
|
||||||
|
*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **Get** /user/logout | Logs out current logged in user session
|
||||||
|
*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **Put** /user/{username} | Updated user
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation For Models
|
||||||
|
|
||||||
|
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||||
|
- [Animal](docs/Animal.md)
|
||||||
|
- [ApiResponse](docs/ApiResponse.md)
|
||||||
|
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||||
|
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||||
|
- [ArrayTest](docs/ArrayTest.md)
|
||||||
|
- [Capitalization](docs/Capitalization.md)
|
||||||
|
- [Cat](docs/Cat.md)
|
||||||
|
- [Category](docs/Category.md)
|
||||||
|
- [ClassModel](docs/ClassModel.md)
|
||||||
|
- [Client](docs/Client.md)
|
||||||
|
- [Dog](docs/Dog.md)
|
||||||
|
- [EnumArrays](docs/EnumArrays.md)
|
||||||
|
- [EnumClass](docs/EnumClass.md)
|
||||||
|
- [EnumTest](docs/EnumTest.md)
|
||||||
|
- [File](docs/File.md)
|
||||||
|
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
|
||||||
|
- [Foo](docs/Foo.md)
|
||||||
|
- [FormatTest](docs/FormatTest.md)
|
||||||
|
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
|
||||||
|
- [HealthCheckResult](docs/HealthCheckResult.md)
|
||||||
|
- [InlineObject](docs/InlineObject.md)
|
||||||
|
- [InlineObject1](docs/InlineObject1.md)
|
||||||
|
- [InlineObject2](docs/InlineObject2.md)
|
||||||
|
- [InlineObject3](docs/InlineObject3.md)
|
||||||
|
- [InlineObject4](docs/InlineObject4.md)
|
||||||
|
- [InlineObject5](docs/InlineObject5.md)
|
||||||
|
- [InlineResponseDefault](docs/InlineResponseDefault.md)
|
||||||
|
- [List](docs/List.md)
|
||||||
|
- [MapTest](docs/MapTest.md)
|
||||||
|
- [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||||
|
- [Model200Response](docs/Model200Response.md)
|
||||||
|
- [Name](docs/Name.md)
|
||||||
|
- [NumberOnly](docs/NumberOnly.md)
|
||||||
|
- [Order](docs/Order.md)
|
||||||
|
- [OuterComposite](docs/OuterComposite.md)
|
||||||
|
- [OuterEnum](docs/OuterEnum.md)
|
||||||
|
- [Pet](docs/Pet.md)
|
||||||
|
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||||
|
- [Return](docs/Return.md)
|
||||||
|
- [SpecialModelName](docs/SpecialModelName.md)
|
||||||
|
- [Tag](docs/Tag.md)
|
||||||
|
- [User](docs/User.md)
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation For Authorization
|
||||||
|
|
||||||
|
## api_key
|
||||||
|
- **Type**: API key
|
||||||
|
|
||||||
|
Example
|
||||||
|
```golang
|
||||||
|
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
|
||||||
|
Key: "APIKEY",
|
||||||
|
Prefix: "Bearer", // Omit if not necessary.
|
||||||
|
})
|
||||||
|
r, err := client.Service.Operation(auth, args)
|
||||||
|
```
|
||||||
|
## api_key_query
|
||||||
|
- **Type**: API key
|
||||||
|
|
||||||
|
Example
|
||||||
|
```golang
|
||||||
|
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
|
||||||
|
Key: "APIKEY",
|
||||||
|
Prefix: "Bearer", // Omit if not necessary.
|
||||||
|
})
|
||||||
|
r, err := client.Service.Operation(auth, args)
|
||||||
|
```
|
||||||
|
## http_basic_test
|
||||||
|
- **Type**: HTTP basic authentication
|
||||||
|
|
||||||
|
Example
|
||||||
|
```golang
|
||||||
|
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
|
||||||
|
UserName: "username",
|
||||||
|
Password: "password",
|
||||||
|
})
|
||||||
|
r, err := client.Service.Operation(auth, args)
|
||||||
|
```
|
||||||
|
## petstore_auth
|
||||||
|
- **Type**: OAuth
|
||||||
|
- **Flow**: implicit
|
||||||
|
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||||
|
- **Scopes**:
|
||||||
|
- **write:pets**: modify pets in your account
|
||||||
|
- **read:pets**: read your pets
|
||||||
|
|
||||||
|
Example
|
||||||
|
```golang
|
||||||
|
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
|
||||||
|
r, err := client.Service.Operation(auth, args)
|
||||||
|
```
|
||||||
|
|
||||||
|
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
|
||||||
|
```golang
|
||||||
|
import "golang.org/x/oauth2"
|
||||||
|
|
||||||
|
/* Perform OAuth2 round trip request and obtain a token */
|
||||||
|
|
||||||
|
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
|
||||||
|
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
|
||||||
|
r, err := client.Service.Operation(auth, args)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
|
||||||
|
|
1905
samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml
Normal file
1905
samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Linger please
|
||||||
|
var (
|
||||||
|
_ context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
type AnotherFakeApiService service
|
||||||
|
|
||||||
|
/*
|
||||||
|
AnotherFakeApiService To test special tags
|
||||||
|
To test special tags and operation ID starting with number
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param client client model
|
||||||
|
@return Client
|
||||||
|
*/
|
||||||
|
func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, client Client) (Client, *http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Patch")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue Client
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/another-fake/dummy"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
// body params
|
||||||
|
localVarPostBody = &client
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHttpResponse.StatusCode == 200 {
|
||||||
|
var v Client
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHttpResponse, nil
|
||||||
|
}
|
110
samples/openapi3/client/petstore/go/go-petstore/api_default.go
Normal file
110
samples/openapi3/client/petstore/go/go-petstore/api_default.go
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Linger please
|
||||||
|
var (
|
||||||
|
_ context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
type DefaultApiService service
|
||||||
|
|
||||||
|
/*
|
||||||
|
DefaultApiService
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
@return InlineResponseDefault
|
||||||
|
*/
|
||||||
|
func (a *DefaultApiService) FooGet(ctx context.Context) (InlineResponseDefault, *http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Get")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue InlineResponseDefault
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/foo"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHttpResponse.StatusCode == 0 {
|
||||||
|
var v InlineResponseDefault
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHttpResponse, nil
|
||||||
|
}
|
1222
samples/openapi3/client/petstore/go/go-petstore/api_fake.go
Normal file
1222
samples/openapi3/client/petstore/go/go-petstore/api_fake.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Linger please
|
||||||
|
var (
|
||||||
|
_ context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
type FakeClassnameTags123ApiService service
|
||||||
|
|
||||||
|
/*
|
||||||
|
FakeClassnameTags123ApiService To test class name in snake case
|
||||||
|
To test class name in snake case
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param client client model
|
||||||
|
@return Client
|
||||||
|
*/
|
||||||
|
func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, client Client) (Client, *http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Patch")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue Client
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/fake_classname_test"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
// body params
|
||||||
|
localVarPostBody = &client
|
||||||
|
if ctx != nil {
|
||||||
|
// API Key Authentication
|
||||||
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||||||
|
var key string
|
||||||
|
if auth.Prefix != "" {
|
||||||
|
key = auth.Prefix + " " + auth.Key
|
||||||
|
} else {
|
||||||
|
key = auth.Key
|
||||||
|
}
|
||||||
|
localVarQueryParams.Add("api_key_query", key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHttpResponse.StatusCode == 200 {
|
||||||
|
var v Client
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHttpResponse, nil
|
||||||
|
}
|
816
samples/openapi3/client/petstore/go/go-petstore/api_pet.go
Normal file
816
samples/openapi3/client/petstore/go/go-petstore/api_pet.go
Normal file
@ -0,0 +1,816 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
"fmt"
|
||||||
|
"github.com/antihax/optional"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Linger please
|
||||||
|
var (
|
||||||
|
_ context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
type PetApiService service
|
||||||
|
|
||||||
|
/*
|
||||||
|
PetApiService Add a new pet to the store
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param pet Pet object that needs to be added to the store
|
||||||
|
*/
|
||||||
|
func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Post")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/pet"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{"application/json", "application/xml"}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
// body params
|
||||||
|
localVarPostBody = &pet
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PetApiService Deletes a pet
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param petId Pet id to delete
|
||||||
|
* @param optional nil or *DeletePetOpts - Optional Parameters:
|
||||||
|
* @param "ApiKey" (optional.String) -
|
||||||
|
*/
|
||||||
|
|
||||||
|
type DeletePetOpts struct {
|
||||||
|
ApiKey optional.String
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals *DeletePetOpts) (*http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Delete")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
|
||||||
|
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
if localVarOptionals != nil && localVarOptionals.ApiKey.IsSet() {
|
||||||
|
localVarHeaderParams["api_key"] = parameterToString(localVarOptionals.ApiKey.Value(), "")
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PetApiService Finds Pets by status
|
||||||
|
Multiple status values can be provided with comma separated strings
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param status Status values that need to be considered for filter
|
||||||
|
@return []Pet
|
||||||
|
*/
|
||||||
|
func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Get")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue []Pet
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/pet/findByStatus"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
localVarQueryParams.Add("status", parameterToString(status, "csv"))
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHttpResponse.StatusCode == 200 {
|
||||||
|
var v []Pet
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PetApiService Finds Pets by tags
|
||||||
|
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param tags Tags to filter by
|
||||||
|
@return []Pet
|
||||||
|
*/
|
||||||
|
func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Get")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue []Pet
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/pet/findByTags"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
localVarQueryParams.Add("tags", parameterToString(tags, "csv"))
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHttpResponse.StatusCode == 200 {
|
||||||
|
var v []Pet
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PetApiService Find pet by ID
|
||||||
|
Returns a single pet
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param petId ID of pet to return
|
||||||
|
@return Pet
|
||||||
|
*/
|
||||||
|
func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Get")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue Pet
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
|
||||||
|
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
if ctx != nil {
|
||||||
|
// API Key Authentication
|
||||||
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||||||
|
var key string
|
||||||
|
if auth.Prefix != "" {
|
||||||
|
key = auth.Prefix + " " + auth.Key
|
||||||
|
} else {
|
||||||
|
key = auth.Key
|
||||||
|
}
|
||||||
|
localVarHeaderParams["api_key"] = key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHttpResponse.StatusCode == 200 {
|
||||||
|
var v Pet
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PetApiService Update an existing pet
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param pet Pet object that needs to be added to the store
|
||||||
|
*/
|
||||||
|
func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Put")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/pet"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{"application/json", "application/xml"}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
// body params
|
||||||
|
localVarPostBody = &pet
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PetApiService Updates a pet in the store with form data
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param petId ID of pet that needs to be updated
|
||||||
|
* @param optional nil or *UpdatePetWithFormOpts - Optional Parameters:
|
||||||
|
* @param "Name" (optional.String) - Updated name of the pet
|
||||||
|
* @param "Status" (optional.String) - Updated status of the pet
|
||||||
|
*/
|
||||||
|
|
||||||
|
type UpdatePetWithFormOpts struct {
|
||||||
|
Name optional.String
|
||||||
|
Status optional.String
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Post")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
|
||||||
|
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
if localVarOptionals != nil && localVarOptionals.Name.IsSet() {
|
||||||
|
localVarFormParams.Add("name", parameterToString(localVarOptionals.Name.Value(), ""))
|
||||||
|
}
|
||||||
|
if localVarOptionals != nil && localVarOptionals.Status.IsSet() {
|
||||||
|
localVarFormParams.Add("status", parameterToString(localVarOptionals.Status.Value(), ""))
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PetApiService uploads an image
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param petId ID of pet to update
|
||||||
|
* @param optional nil or *UploadFileOpts - Optional Parameters:
|
||||||
|
* @param "AdditionalMetadata" (optional.String) - Additional data to pass to server
|
||||||
|
* @param "File" (optional.Interface of *os.File) - file to upload
|
||||||
|
@return ApiResponse
|
||||||
|
*/
|
||||||
|
|
||||||
|
type UploadFileOpts struct {
|
||||||
|
AdditionalMetadata optional.String
|
||||||
|
File optional.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Post")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue ApiResponse
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/pet/{petId}/uploadImage"
|
||||||
|
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{"multipart/form-data"}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() {
|
||||||
|
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), ""))
|
||||||
|
}
|
||||||
|
localVarFormFileName = "file"
|
||||||
|
var localVarFile *os.File
|
||||||
|
if localVarOptionals != nil && localVarOptionals.File.IsSet() {
|
||||||
|
localVarFileOk := false
|
||||||
|
localVarFile, localVarFileOk = localVarOptionals.File.Value().(*os.File)
|
||||||
|
if !localVarFileOk {
|
||||||
|
return localVarReturnValue, nil, reportError("file should be *os.File")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if localVarFile != nil {
|
||||||
|
fbs, _ := ioutil.ReadAll(localVarFile)
|
||||||
|
localVarFileBytes = fbs
|
||||||
|
localVarFileName = localVarFile.Name()
|
||||||
|
localVarFile.Close()
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHttpResponse.StatusCode == 200 {
|
||||||
|
var v ApiResponse
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PetApiService uploads an image (required)
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param petId ID of pet to update
|
||||||
|
* @param requiredFile file to upload
|
||||||
|
* @param optional nil or *UploadFileWithRequiredFileOpts - Optional Parameters:
|
||||||
|
* @param "AdditionalMetadata" (optional.String) - Additional data to pass to server
|
||||||
|
@return ApiResponse
|
||||||
|
*/
|
||||||
|
|
||||||
|
type UploadFileWithRequiredFileOpts struct {
|
||||||
|
AdditionalMetadata optional.String
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Post")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue ApiResponse
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/fake/{petId}/uploadImageWithRequiredFile"
|
||||||
|
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{"multipart/form-data"}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() {
|
||||||
|
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), ""))
|
||||||
|
}
|
||||||
|
localVarFormFileName = "requiredFile"
|
||||||
|
localVarFile := requiredFile
|
||||||
|
if localVarFile != nil {
|
||||||
|
fbs, _ := ioutil.ReadAll(localVarFile)
|
||||||
|
localVarFileBytes = fbs
|
||||||
|
localVarFileName = localVarFile.Name()
|
||||||
|
localVarFile.Close()
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHttpResponse.StatusCode == 200 {
|
||||||
|
var v ApiResponse
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHttpResponse, nil
|
||||||
|
}
|
374
samples/openapi3/client/petstore/go/go-petstore/api_store.go
Normal file
374
samples/openapi3/client/petstore/go/go-petstore/api_store.go
Normal file
@ -0,0 +1,374 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Linger please
|
||||||
|
var (
|
||||||
|
_ context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
type StoreApiService service
|
||||||
|
|
||||||
|
/*
|
||||||
|
StoreApiService Delete purchase order by ID
|
||||||
|
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param orderId ID of the order that needs to be deleted
|
||||||
|
*/
|
||||||
|
func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Delete")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}"
|
||||||
|
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1)
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
StoreApiService Returns pet inventories by status
|
||||||
|
Returns a map of status codes to quantities
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
@return map[string]int32
|
||||||
|
*/
|
||||||
|
func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Get")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue map[string]int32
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/store/inventory"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
if ctx != nil {
|
||||||
|
// API Key Authentication
|
||||||
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||||||
|
var key string
|
||||||
|
if auth.Prefix != "" {
|
||||||
|
key = auth.Prefix + " " + auth.Key
|
||||||
|
} else {
|
||||||
|
key = auth.Key
|
||||||
|
}
|
||||||
|
localVarHeaderParams["api_key"] = key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHttpResponse.StatusCode == 200 {
|
||||||
|
var v map[string]int32
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
StoreApiService Find purchase order by ID
|
||||||
|
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param orderId ID of pet that needs to be fetched
|
||||||
|
@return Order
|
||||||
|
*/
|
||||||
|
func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Get")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue Order
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}"
|
||||||
|
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1)
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
if orderId < 1 {
|
||||||
|
return localVarReturnValue, nil, reportError("orderId must be greater than 1")
|
||||||
|
}
|
||||||
|
if orderId > 5 {
|
||||||
|
return localVarReturnValue, nil, reportError("orderId must be less than 5")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHttpResponse.StatusCode == 200 {
|
||||||
|
var v Order
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
StoreApiService Place an order for a pet
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param order order placed for purchasing the pet
|
||||||
|
@return Order
|
||||||
|
*/
|
||||||
|
func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Post")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue Order
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/store/order"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
// body params
|
||||||
|
localVarPostBody = &order
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHttpResponse.StatusCode == 200 {
|
||||||
|
var v Order
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHttpResponse, nil
|
||||||
|
}
|
605
samples/openapi3/client/petstore/go/go-petstore/api_user.go
Normal file
605
samples/openapi3/client/petstore/go/go-petstore/api_user.go
Normal file
@ -0,0 +1,605 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Linger please
|
||||||
|
var (
|
||||||
|
_ context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
type UserApiService service
|
||||||
|
|
||||||
|
/*
|
||||||
|
UserApiService Create user
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param user Created user object
|
||||||
|
*/
|
||||||
|
func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Post")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/user"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
// body params
|
||||||
|
localVarPostBody = &user
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
UserApiService Creates list of users with given input array
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param user List of user object
|
||||||
|
*/
|
||||||
|
func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []User) (*http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Post")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/user/createWithArray"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
// body params
|
||||||
|
localVarPostBody = &user
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
UserApiService Creates list of users with given input array
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param user List of user object
|
||||||
|
*/
|
||||||
|
func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []User) (*http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Post")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/user/createWithList"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
// body params
|
||||||
|
localVarPostBody = &user
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
UserApiService Delete user
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param username The name that needs to be deleted
|
||||||
|
*/
|
||||||
|
func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Delete")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/user/{username}"
|
||||||
|
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
UserApiService Get user by user name
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
|
@return User
|
||||||
|
*/
|
||||||
|
func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Get")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue User
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/user/{username}"
|
||||||
|
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHttpResponse.StatusCode == 200 {
|
||||||
|
var v User
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
UserApiService Logs user into the system
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param username The user name for login
|
||||||
|
* @param password The password for login in clear text
|
||||||
|
@return string
|
||||||
|
*/
|
||||||
|
func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Get")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
localVarReturnValue string
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/user/login"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
localVarQueryParams.Add("username", parameterToString(username, ""))
|
||||||
|
localVarQueryParams.Add("password", parameterToString(password, ""))
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
if localVarHttpResponse.StatusCode == 200 {
|
||||||
|
var v string
|
||||||
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr.error = err.Error()
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
newErr.model = v
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
UserApiService Logs out current logged in user session
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
*/
|
||||||
|
func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Get")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/user/logout"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHttpResponse, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
UserApiService Updated user
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
* @param username name that need to be deleted
|
||||||
|
* @param user Updated user object
|
||||||
|
*/
|
||||||
|
func (a *UserApiService) UpdateUser(ctx context.Context, username string, user User) (*http.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHttpMethod = strings.ToUpper("Put")
|
||||||
|
localVarPostBody interface{}
|
||||||
|
localVarFormFileName string
|
||||||
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
localVarPath := a.client.cfg.BasePath + "/user/{username}"
|
||||||
|
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := url.Values{}
|
||||||
|
localVarFormParams := url.Values{}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
localVarHttpContentTypes := []string{"application/json"}
|
||||||
|
|
||||||
|
// set Content-Type header
|
||||||
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||||
|
if localVarHttpContentType != "" {
|
||||||
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
localVarHttpHeaderAccepts := []string{}
|
||||||
|
|
||||||
|
// set Accept header
|
||||||
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
|
if localVarHttpHeaderAccept != "" {
|
||||||
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||||
|
}
|
||||||
|
// body params
|
||||||
|
localVarPostBody = &user
|
||||||
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHttpResponse, err := a.client.callAPI(r)
|
||||||
|
if err != nil || localVarHttpResponse == nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||||
|
localVarHttpResponse.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
return localVarHttpResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHttpResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHttpResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarHttpResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarHttpResponse, nil
|
||||||
|
}
|
496
samples/openapi3/client/petstore/go/go-petstore/client.go
Normal file
496
samples/openapi3/client/petstore/go/go-petstore/client.go
Normal file
@ -0,0 +1,496 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"encoding/xml"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"mime/multipart"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
|
"regexp"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
jsonCheck = regexp.MustCompile("(?i:[application|text]/json)")
|
||||||
|
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
|
||||||
|
)
|
||||||
|
|
||||||
|
// APIClient manages communication with the OpenAPI Petstore API v1.0.0
|
||||||
|
// In most cases there should be only one, shared, APIClient.
|
||||||
|
type APIClient struct {
|
||||||
|
cfg *Configuration
|
||||||
|
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||||
|
|
||||||
|
// API Services
|
||||||
|
|
||||||
|
AnotherFakeApi *AnotherFakeApiService
|
||||||
|
|
||||||
|
DefaultApi *DefaultApiService
|
||||||
|
|
||||||
|
FakeApi *FakeApiService
|
||||||
|
|
||||||
|
FakeClassnameTags123Api *FakeClassnameTags123ApiService
|
||||||
|
|
||||||
|
PetApi *PetApiService
|
||||||
|
|
||||||
|
StoreApi *StoreApiService
|
||||||
|
|
||||||
|
UserApi *UserApiService
|
||||||
|
}
|
||||||
|
|
||||||
|
type service struct {
|
||||||
|
client *APIClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
|
||||||
|
// optionally a custom http.Client to allow for advanced features such as caching.
|
||||||
|
func NewAPIClient(cfg *Configuration) *APIClient {
|
||||||
|
if cfg.HTTPClient == nil {
|
||||||
|
cfg.HTTPClient = http.DefaultClient
|
||||||
|
}
|
||||||
|
|
||||||
|
c := &APIClient{}
|
||||||
|
c.cfg = cfg
|
||||||
|
c.common.client = c
|
||||||
|
|
||||||
|
// API Services
|
||||||
|
c.AnotherFakeApi = (*AnotherFakeApiService)(&c.common)
|
||||||
|
c.DefaultApi = (*DefaultApiService)(&c.common)
|
||||||
|
c.FakeApi = (*FakeApiService)(&c.common)
|
||||||
|
c.FakeClassnameTags123Api = (*FakeClassnameTags123ApiService)(&c.common)
|
||||||
|
c.PetApi = (*PetApiService)(&c.common)
|
||||||
|
c.StoreApi = (*StoreApiService)(&c.common)
|
||||||
|
c.UserApi = (*UserApiService)(&c.common)
|
||||||
|
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
func atoi(in string) (int, error) {
|
||||||
|
return strconv.Atoi(in)
|
||||||
|
}
|
||||||
|
|
||||||
|
// selectHeaderContentType select a content type from the available list.
|
||||||
|
func selectHeaderContentType(contentTypes []string) string {
|
||||||
|
if len(contentTypes) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if contains(contentTypes, "application/json") {
|
||||||
|
return "application/json"
|
||||||
|
}
|
||||||
|
return contentTypes[0] // use the first content type specified in 'consumes'
|
||||||
|
}
|
||||||
|
|
||||||
|
// selectHeaderAccept join all accept types and return
|
||||||
|
func selectHeaderAccept(accepts []string) string {
|
||||||
|
if len(accepts) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if contains(accepts, "application/json") {
|
||||||
|
return "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.Join(accepts, ",")
|
||||||
|
}
|
||||||
|
|
||||||
|
// contains is a case insenstive match, finding needle in a haystack
|
||||||
|
func contains(haystack []string, needle string) bool {
|
||||||
|
for _, a := range haystack {
|
||||||
|
if strings.ToLower(a) == strings.ToLower(needle) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify optional parameters are of the correct type.
|
||||||
|
func typeCheckParameter(obj interface{}, expected string, name string) error {
|
||||||
|
// Make sure there is an object.
|
||||||
|
if obj == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the type is as expected.
|
||||||
|
if reflect.TypeOf(obj).String() != expected {
|
||||||
|
return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
|
||||||
|
func parameterToString(obj interface{}, collectionFormat string) string {
|
||||||
|
var delimiter string
|
||||||
|
|
||||||
|
switch collectionFormat {
|
||||||
|
case "pipes":
|
||||||
|
delimiter = "|"
|
||||||
|
case "ssv":
|
||||||
|
delimiter = " "
|
||||||
|
case "tsv":
|
||||||
|
delimiter = "\t"
|
||||||
|
case "csv":
|
||||||
|
delimiter = ","
|
||||||
|
}
|
||||||
|
|
||||||
|
if reflect.TypeOf(obj).Kind() == reflect.Slice {
|
||||||
|
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
|
||||||
|
} else if t, ok := obj.(time.Time); ok {
|
||||||
|
return t.Format(time.RFC3339)
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt.Sprintf("%v", obj)
|
||||||
|
}
|
||||||
|
|
||||||
|
// callAPI do the request.
|
||||||
|
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
|
||||||
|
return c.cfg.HTTPClient.Do(request)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change base path to allow switching to mocks
|
||||||
|
func (c *APIClient) ChangeBasePath(path string) {
|
||||||
|
c.cfg.BasePath = path
|
||||||
|
}
|
||||||
|
|
||||||
|
// prepareRequest build the request
|
||||||
|
func (c *APIClient) prepareRequest(
|
||||||
|
ctx context.Context,
|
||||||
|
path string, method string,
|
||||||
|
postBody interface{},
|
||||||
|
headerParams map[string]string,
|
||||||
|
queryParams url.Values,
|
||||||
|
formParams url.Values,
|
||||||
|
formFileName string,
|
||||||
|
fileName string,
|
||||||
|
fileBytes []byte) (localVarRequest *http.Request, err error) {
|
||||||
|
|
||||||
|
var body *bytes.Buffer
|
||||||
|
|
||||||
|
// Detect postBody type and post.
|
||||||
|
if postBody != nil {
|
||||||
|
contentType := headerParams["Content-Type"]
|
||||||
|
if contentType == "" {
|
||||||
|
contentType = detectContentType(postBody)
|
||||||
|
headerParams["Content-Type"] = contentType
|
||||||
|
}
|
||||||
|
|
||||||
|
body, err = setBody(postBody, contentType)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// add form parameters and file if available.
|
||||||
|
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
|
||||||
|
if body != nil {
|
||||||
|
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
||||||
|
}
|
||||||
|
body = &bytes.Buffer{}
|
||||||
|
w := multipart.NewWriter(body)
|
||||||
|
|
||||||
|
for k, v := range formParams {
|
||||||
|
for _, iv := range v {
|
||||||
|
if strings.HasPrefix(k, "@") { // file
|
||||||
|
err = addFile(w, k[1:], iv)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
} else { // form value
|
||||||
|
w.WriteField(k, iv)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(fileBytes) > 0 && fileName != "" {
|
||||||
|
w.Boundary()
|
||||||
|
//_, fileNm := filepath.Split(fileName)
|
||||||
|
part, err := w.CreateFormFile(formFileName, filepath.Base(fileName))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_, err = part.Write(fileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// Set the Boundary in the Content-Type
|
||||||
|
headerParams["Content-Type"] = w.FormDataContentType()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set Content-Length
|
||||||
|
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
||||||
|
w.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 {
|
||||||
|
if body != nil {
|
||||||
|
return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.")
|
||||||
|
}
|
||||||
|
body = &bytes.Buffer{}
|
||||||
|
body.WriteString(formParams.Encode())
|
||||||
|
// Set Content-Length
|
||||||
|
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup path and query parameters
|
||||||
|
url, err := url.Parse(path)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adding Query Param
|
||||||
|
query := url.Query()
|
||||||
|
for k, v := range queryParams {
|
||||||
|
for _, iv := range v {
|
||||||
|
query.Add(k, iv)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encode the parameters.
|
||||||
|
url.RawQuery = query.Encode()
|
||||||
|
|
||||||
|
// Generate a new request
|
||||||
|
if body != nil {
|
||||||
|
localVarRequest, err = http.NewRequest(method, url.String(), body)
|
||||||
|
} else {
|
||||||
|
localVarRequest, err = http.NewRequest(method, url.String(), nil)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// add header parameters, if any
|
||||||
|
if len(headerParams) > 0 {
|
||||||
|
headers := http.Header{}
|
||||||
|
for h, v := range headerParams {
|
||||||
|
headers.Set(h, v)
|
||||||
|
}
|
||||||
|
localVarRequest.Header = headers
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override request host, if applicable
|
||||||
|
if c.cfg.Host != "" {
|
||||||
|
localVarRequest.Host = c.cfg.Host
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the user agent to the request.
|
||||||
|
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
||||||
|
|
||||||
|
if ctx != nil {
|
||||||
|
// add context to the request
|
||||||
|
localVarRequest = localVarRequest.WithContext(ctx)
|
||||||
|
|
||||||
|
// Walk through any authentication.
|
||||||
|
|
||||||
|
// OAuth2 authentication
|
||||||
|
if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {
|
||||||
|
// We were able to grab an oauth2 token from the context
|
||||||
|
var latestToken *oauth2.Token
|
||||||
|
if latestToken, err = tok.Token(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
latestToken.SetAuthHeader(localVarRequest)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Basic HTTP Authentication
|
||||||
|
if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {
|
||||||
|
localVarRequest.SetBasicAuth(auth.UserName, auth.Password)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AccessToken Authentication
|
||||||
|
if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
|
||||||
|
localVarRequest.Header.Add("Authorization", "Bearer "+auth)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for header, value := range c.cfg.DefaultHeader {
|
||||||
|
localVarRequest.Header.Add(header, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarRequest, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||||
|
if strings.Contains(contentType, "application/xml") {
|
||||||
|
if err = xml.Unmarshal(b, v); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
} else if strings.Contains(contentType, "application/json") {
|
||||||
|
if err = json.Unmarshal(b, v); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return errors.New("undefined response type")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a file to the multipart request
|
||||||
|
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||||
|
file, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
part, err := w.CreateFormFile(fieldName, filepath.Base(path))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = io.Copy(part, file)
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prevent trying to import "fmt"
|
||||||
|
func reportError(format string, a ...interface{}) error {
|
||||||
|
return fmt.Errorf(format, a...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set request body from an interface{}
|
||||||
|
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
|
||||||
|
if bodyBuf == nil {
|
||||||
|
bodyBuf = &bytes.Buffer{}
|
||||||
|
}
|
||||||
|
|
||||||
|
if reader, ok := body.(io.Reader); ok {
|
||||||
|
_, err = bodyBuf.ReadFrom(reader)
|
||||||
|
} else if b, ok := body.([]byte); ok {
|
||||||
|
_, err = bodyBuf.Write(b)
|
||||||
|
} else if s, ok := body.(string); ok {
|
||||||
|
_, err = bodyBuf.WriteString(s)
|
||||||
|
} else if s, ok := body.(*string); ok {
|
||||||
|
_, err = bodyBuf.WriteString(*s)
|
||||||
|
} else if jsonCheck.MatchString(contentType) {
|
||||||
|
err = json.NewEncoder(bodyBuf).Encode(body)
|
||||||
|
} else if xmlCheck.MatchString(contentType) {
|
||||||
|
xml.NewEncoder(bodyBuf).Encode(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if bodyBuf.Len() == 0 {
|
||||||
|
err = fmt.Errorf("Invalid body type %s\n", contentType)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return bodyBuf, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// detectContentType method is used to figure out `Request.Body` content type for request header
|
||||||
|
func detectContentType(body interface{}) string {
|
||||||
|
contentType := "text/plain; charset=utf-8"
|
||||||
|
kind := reflect.TypeOf(body).Kind()
|
||||||
|
|
||||||
|
switch kind {
|
||||||
|
case reflect.Struct, reflect.Map, reflect.Ptr:
|
||||||
|
contentType = "application/json; charset=utf-8"
|
||||||
|
case reflect.String:
|
||||||
|
contentType = "text/plain; charset=utf-8"
|
||||||
|
default:
|
||||||
|
if b, ok := body.([]byte); ok {
|
||||||
|
contentType = http.DetectContentType(b)
|
||||||
|
} else if kind == reflect.Slice {
|
||||||
|
contentType = "application/json; charset=utf-8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return contentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
||||||
|
type cacheControl map[string]string
|
||||||
|
|
||||||
|
func parseCacheControl(headers http.Header) cacheControl {
|
||||||
|
cc := cacheControl{}
|
||||||
|
ccHeader := headers.Get("Cache-Control")
|
||||||
|
for _, part := range strings.Split(ccHeader, ",") {
|
||||||
|
part = strings.Trim(part, " ")
|
||||||
|
if part == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if strings.ContainsRune(part, '=') {
|
||||||
|
keyval := strings.Split(part, "=")
|
||||||
|
cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
|
||||||
|
} else {
|
||||||
|
cc[part] = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cc
|
||||||
|
}
|
||||||
|
|
||||||
|
// CacheExpires helper function to determine remaining time before repeating a request.
|
||||||
|
func CacheExpires(r *http.Response) time.Time {
|
||||||
|
// Figure out when the cache expires.
|
||||||
|
var expires time.Time
|
||||||
|
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
||||||
|
if err != nil {
|
||||||
|
return time.Now()
|
||||||
|
}
|
||||||
|
respCacheControl := parseCacheControl(r.Header)
|
||||||
|
|
||||||
|
if maxAge, ok := respCacheControl["max-age"]; ok {
|
||||||
|
lifetime, err := time.ParseDuration(maxAge + "s")
|
||||||
|
if err != nil {
|
||||||
|
expires = now
|
||||||
|
} else {
|
||||||
|
expires = now.Add(lifetime)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
expiresHeader := r.Header.Get("Expires")
|
||||||
|
if expiresHeader != "" {
|
||||||
|
expires, err = time.Parse(time.RFC1123, expiresHeader)
|
||||||
|
if err != nil {
|
||||||
|
expires = now
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return expires
|
||||||
|
}
|
||||||
|
|
||||||
|
func strlen(s string) int {
|
||||||
|
return utf8.RuneCountInString(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GenericOpenAPIError Provides access to the body, error and model on returned errors.
|
||||||
|
type GenericOpenAPIError struct {
|
||||||
|
body []byte
|
||||||
|
error string
|
||||||
|
model interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error returns non-empty string if there was an error.
|
||||||
|
func (e GenericOpenAPIError) Error() string {
|
||||||
|
return e.error
|
||||||
|
}
|
||||||
|
|
||||||
|
// Body returns the raw bytes of the response
|
||||||
|
func (e GenericOpenAPIError) Body() []byte {
|
||||||
|
return e.body
|
||||||
|
}
|
||||||
|
|
||||||
|
// Model returns the unpacked model of the error
|
||||||
|
func (e GenericOpenAPIError) Model() interface{} {
|
||||||
|
return e.model
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// contextKeys are used to identify the type of value in the context.
|
||||||
|
// Since these are string, it is possible to get a short description of the
|
||||||
|
// context key for logging and debugging using key.String().
|
||||||
|
|
||||||
|
type contextKey string
|
||||||
|
|
||||||
|
func (c contextKey) String() string {
|
||||||
|
return "auth " + string(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
|
||||||
|
ContextOAuth2 = contextKey("token")
|
||||||
|
|
||||||
|
// ContextBasicAuth takes BasicAuth as authentication for the request.
|
||||||
|
ContextBasicAuth = contextKey("basic")
|
||||||
|
|
||||||
|
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
|
||||||
|
ContextAccessToken = contextKey("accesstoken")
|
||||||
|
|
||||||
|
// ContextAPIKey takes an APIKey as authentication for the request
|
||||||
|
ContextAPIKey = contextKey("apikey")
|
||||||
|
)
|
||||||
|
|
||||||
|
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
|
||||||
|
type BasicAuth struct {
|
||||||
|
UserName string `json:"userName,omitempty"`
|
||||||
|
Password string `json:"password,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
|
||||||
|
type APIKey struct {
|
||||||
|
Key string
|
||||||
|
Prefix string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Configuration struct {
|
||||||
|
BasePath string `json:"basePath,omitempty"`
|
||||||
|
Host string `json:"host,omitempty"`
|
||||||
|
Scheme string `json:"scheme,omitempty"`
|
||||||
|
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||||
|
UserAgent string `json:"userAgent,omitempty"`
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewConfiguration() *Configuration {
|
||||||
|
cfg := &Configuration{
|
||||||
|
BasePath: "http://petstore.swagger.io:80/v2",
|
||||||
|
DefaultHeader: make(map[string]string),
|
||||||
|
UserAgent: "OpenAPI-Generator/1.0.0/go",
|
||||||
|
}
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Configuration) AddDefaultHeader(key string, value string) {
|
||||||
|
c.DefaultHeader[key] = value
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
# AdditionalPropertiesClass
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**MapProperty** | **map[string]string** | | [optional]
|
||||||
|
**MapOfMapProperty** | [**map[string]map[string]string**](map.md) | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
# Animal
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**ClassName** | **string** | |
|
||||||
|
**Color** | **string** | | [optional] [default to red]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
# \AnotherFakeApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**Call123TestSpecialTags**](AnotherFakeApi.md#Call123TestSpecialTags) | **Patch** /another-fake/dummy | To test special tags
|
||||||
|
|
||||||
|
|
||||||
|
# **Call123TestSpecialTags**
|
||||||
|
> Client Call123TestSpecialTags(ctx, client)
|
||||||
|
To test special tags
|
||||||
|
|
||||||
|
To test special tags and operation ID starting with number
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**client** | [**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)
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
# ApiResponse
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Code** | **int32** | | [optional]
|
||||||
|
**Type** | **string** | | [optional]
|
||||||
|
**Message** | **string** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
# ArrayOfArrayOfNumberOnly
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**ArrayArrayNumber** | [**[][]float32**](array.md) | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
# ArrayOfNumberOnly
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**ArrayNumber** | **[]float32** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
# ArrayTest
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**ArrayOfString** | **[]string** | | [optional]
|
||||||
|
**ArrayArrayOfInteger** | [**[][]int64**](array.md) | | [optional]
|
||||||
|
**ArrayArrayOfModel** | [**[][]ReadOnlyFirst**](array.md) | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
# Capitalization
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**SmallCamel** | **string** | | [optional]
|
||||||
|
**CapitalCamel** | **string** | | [optional]
|
||||||
|
**SmallSnake** | **string** | | [optional]
|
||||||
|
**CapitalSnake** | **string** | | [optional]
|
||||||
|
**SCAETHFlowPoints** | **string** | | [optional]
|
||||||
|
**ATT_NAME** | **string** | Name of the pet | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
12
samples/openapi3/client/petstore/go/go-petstore/docs/Cat.md
Normal file
12
samples/openapi3/client/petstore/go/go-petstore/docs/Cat.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Cat
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**ClassName** | **string** | |
|
||||||
|
**Color** | **string** | | [optional] [default to red]
|
||||||
|
**Declawed** | **bool** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
# Category
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Id** | **int64** | | [optional]
|
||||||
|
**Name** | **string** | | [default to default-name]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
# ClassModel
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Class** | **string** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
# Client
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Client** | **string** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
# \DefaultApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**FooGet**](DefaultApi.md#FooGet) | **Get** /foo |
|
||||||
|
|
||||||
|
|
||||||
|
# **FooGet**
|
||||||
|
> InlineResponseDefault FooGet(ctx, )
|
||||||
|
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**InlineResponseDefault**](inline_response_default.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **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)
|
||||||
|
|
12
samples/openapi3/client/petstore/go/go-petstore/docs/Dog.md
Normal file
12
samples/openapi3/client/petstore/go/go-petstore/docs/Dog.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Dog
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**ClassName** | **string** | |
|
||||||
|
**Color** | **string** | | [optional] [default to red]
|
||||||
|
**Breed** | **string** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
# EnumArrays
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**JustSymbol** | **string** | | [optional]
|
||||||
|
**ArrayEnum** | **[]string** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -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)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
# EnumTest
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**EnumString** | **string** | | [optional]
|
||||||
|
**EnumStringRequired** | **string** | |
|
||||||
|
**EnumInteger** | **int32** | | [optional]
|
||||||
|
**EnumNumber** | **float64** | | [optional]
|
||||||
|
**OuterEnum** | [**OuterEnum**](OuterEnum.md) | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
456
samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md
Normal file
456
samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md
Normal file
@ -0,0 +1,456 @@
|
|||||||
|
# \FakeApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**FakeHealthGet**](FakeApi.md#FakeHealthGet) | **Get** /fake/health | Health check endpoint
|
||||||
|
[**FakeOuterBooleanSerialize**](FakeApi.md#FakeOuterBooleanSerialize) | **Post** /fake/outer/boolean |
|
||||||
|
[**FakeOuterCompositeSerialize**](FakeApi.md#FakeOuterCompositeSerialize) | **Post** /fake/outer/composite |
|
||||||
|
[**FakeOuterNumberSerialize**](FakeApi.md#FakeOuterNumberSerialize) | **Post** /fake/outer/number |
|
||||||
|
[**FakeOuterStringSerialize**](FakeApi.md#FakeOuterStringSerialize) | **Post** /fake/outer/string |
|
||||||
|
[**TestBodyWithFileSchema**](FakeApi.md#TestBodyWithFileSchema) | **Put** /fake/body-with-file-schema |
|
||||||
|
[**TestBodyWithQueryParams**](FakeApi.md#TestBodyWithQueryParams) | **Put** /fake/body-with-query-params |
|
||||||
|
[**TestClientModel**](FakeApi.md#TestClientModel) | **Patch** /fake | To test \"client\" model
|
||||||
|
[**TestEndpointParameters**](FakeApi.md#TestEndpointParameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
|
[**TestEnumParameters**](FakeApi.md#TestEnumParameters) | **Get** /fake | To test enum parameters
|
||||||
|
[**TestGroupParameters**](FakeApi.md#TestGroupParameters) | **Delete** /fake | Fake endpoint to test group parameters (optional)
|
||||||
|
[**TestInlineAdditionalProperties**](FakeApi.md#TestInlineAdditionalProperties) | **Post** /fake/inline-additionalProperties | test inline additionalProperties
|
||||||
|
[**TestJsonFormData**](FakeApi.md#TestJsonFormData) | **Get** /fake/jsonFormData | test json serialization of form data
|
||||||
|
|
||||||
|
|
||||||
|
# **FakeHealthGet**
|
||||||
|
> HealthCheckResult FakeHealthGet(ctx, )
|
||||||
|
Health check endpoint
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**HealthCheckResult**](HealthCheckResult.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **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)
|
||||||
|
|
||||||
|
# **FakeOuterBooleanSerialize**
|
||||||
|
> bool FakeOuterBooleanSerialize(ctx, optional)
|
||||||
|
|
||||||
|
|
||||||
|
Test serialization of outer boolean types
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**optional** | ***FakeOuterBooleanSerializeOpts** | optional parameters | nil if no parameters
|
||||||
|
|
||||||
|
### Optional Parameters
|
||||||
|
Optional parameters are passed through a pointer to a FakeOuterBooleanSerializeOpts struct
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | **optional.Bool**| Input boolean as post body |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**bool**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: */*
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **FakeOuterCompositeSerialize**
|
||||||
|
> OuterComposite FakeOuterCompositeSerialize(ctx, optional)
|
||||||
|
|
||||||
|
|
||||||
|
Test serialization of object with outer number type
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**optional** | ***FakeOuterCompositeSerializeOpts** | optional parameters | nil if no parameters
|
||||||
|
|
||||||
|
### Optional Parameters
|
||||||
|
Optional parameters are passed through a pointer to a FakeOuterCompositeSerializeOpts struct
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**outerComposite** | [**optional.Interface of OuterComposite**](OuterComposite.md)| Input composite as post body |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**OuterComposite**](OuterComposite.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: */*
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **FakeOuterNumberSerialize**
|
||||||
|
> float32 FakeOuterNumberSerialize(ctx, optional)
|
||||||
|
|
||||||
|
|
||||||
|
Test serialization of outer number types
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**optional** | ***FakeOuterNumberSerializeOpts** | optional parameters | nil if no parameters
|
||||||
|
|
||||||
|
### Optional Parameters
|
||||||
|
Optional parameters are passed through a pointer to a FakeOuterNumberSerializeOpts struct
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | **optional.Float32**| Input number as post body |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**float32**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: */*
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **FakeOuterStringSerialize**
|
||||||
|
> string FakeOuterStringSerialize(ctx, optional)
|
||||||
|
|
||||||
|
|
||||||
|
Test serialization of outer string types
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**optional** | ***FakeOuterStringSerializeOpts** | optional parameters | nil if no parameters
|
||||||
|
|
||||||
|
### Optional Parameters
|
||||||
|
Optional parameters are passed through a pointer to a FakeOuterStringSerializeOpts struct
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | **optional.String**| Input string as post body |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**string**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: */*
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **TestBodyWithFileSchema**
|
||||||
|
> TestBodyWithFileSchema(ctx, fileSchemaTestClass)
|
||||||
|
|
||||||
|
|
||||||
|
For this test, the body for this request much reference a schema named `File`.
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **TestBodyWithQueryParams**
|
||||||
|
> TestBodyWithQueryParams(ctx, query, user)
|
||||||
|
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**query** | **string**| |
|
||||||
|
**user** | [**User**](User.md)| |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **TestClientModel**
|
||||||
|
> Client TestClientModel(ctx, client)
|
||||||
|
To test \"client\" model
|
||||||
|
|
||||||
|
To test \"client\" model
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**client** | [**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(ctx, number, double, patternWithoutDelimiter, byte_, optional)
|
||||||
|
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
|
|
||||||
|
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**number** | **float32**| None |
|
||||||
|
**double** | **float64**| None |
|
||||||
|
**patternWithoutDelimiter** | **string**| None |
|
||||||
|
**byte_** | **string**| None |
|
||||||
|
**optional** | ***TestEndpointParametersOpts** | optional parameters | nil if no parameters
|
||||||
|
|
||||||
|
### Optional Parameters
|
||||||
|
Optional parameters are passed through a pointer to a TestEndpointParametersOpts struct
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**integer** | **optional.Int32**| None |
|
||||||
|
**int32_** | **optional.Int32**| None |
|
||||||
|
**int64_** | **optional.Int64**| None |
|
||||||
|
**float** | **optional.Float32**| None |
|
||||||
|
**string_** | **optional.String**| None |
|
||||||
|
**binary** | **optional.Interface of *os.File****optional.*os.File**| None |
|
||||||
|
**date** | **optional.String**| None |
|
||||||
|
**dateTime** | **optional.Time**| None |
|
||||||
|
**password** | **optional.String**| None |
|
||||||
|
**callback** | **optional.String**| None |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[http_basic_test](../README.md#http_basic_test)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/x-www-form-urlencoded
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **TestEnumParameters**
|
||||||
|
> TestEnumParameters(ctx, optional)
|
||||||
|
To test enum parameters
|
||||||
|
|
||||||
|
To test enum parameters
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**optional** | ***TestEnumParametersOpts** | optional parameters | nil if no parameters
|
||||||
|
|
||||||
|
### Optional Parameters
|
||||||
|
Optional parameters are passed through a pointer to a TestEnumParametersOpts struct
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**enumHeaderStringArray** | [**optional.Interface of []string**](string.md)| Header parameter enum test (string array) |
|
||||||
|
**enumHeaderString** | **optional.String**| Header parameter enum test (string) | [default to -efg]
|
||||||
|
**enumQueryStringArray** | [**optional.Interface of []string**](string.md)| Query parameter enum test (string array) |
|
||||||
|
**enumQueryString** | **optional.String**| Query parameter enum test (string) | [default to -efg]
|
||||||
|
**enumQueryInteger** | **optional.Int32**| Query parameter enum test (double) |
|
||||||
|
**enumQueryDouble** | **optional.Float64**| Query parameter enum test (double) |
|
||||||
|
**enumFormStringArray** | [**optional.Interface of []string**](string.md)| Form parameter enum test (string array) | [default to $]
|
||||||
|
**enumFormString** | **optional.String**| Form parameter enum test (string) | [default to -efg]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/x-www-form-urlencoded
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **TestGroupParameters**
|
||||||
|
> TestGroupParameters(ctx, requiredStringGroup, requiredBooleanGroup, requiredInt64Group, optional)
|
||||||
|
Fake endpoint to test group parameters (optional)
|
||||||
|
|
||||||
|
Fake endpoint to test group parameters (optional)
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**requiredStringGroup** | **int32**| Required String in group parameters |
|
||||||
|
**requiredBooleanGroup** | **bool**| Required Boolean in group parameters |
|
||||||
|
**requiredInt64Group** | **int64**| Required Integer in group parameters |
|
||||||
|
**optional** | ***TestGroupParametersOpts** | optional parameters | nil if no parameters
|
||||||
|
|
||||||
|
### Optional Parameters
|
||||||
|
Optional parameters are passed through a pointer to a TestGroupParametersOpts struct
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**stringGroup** | **optional.Int32**| String in group parameters |
|
||||||
|
**booleanGroup** | **optional.Bool**| Boolean in group parameters |
|
||||||
|
**int64Group** | **optional.Int64**| Integer in group parameters |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **TestInlineAdditionalProperties**
|
||||||
|
> TestInlineAdditionalProperties(ctx, requestBody)
|
||||||
|
test inline additionalProperties
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**requestBody** | [**map[string]string**](string.md)| request body |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **TestJsonFormData**
|
||||||
|
> TestJsonFormData(ctx, param, param2)
|
||||||
|
test json serialization of form data
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**param** | **string**| field1 |
|
||||||
|
**param2** | **string**| field2 |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/x-www-form-urlencoded
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
# \FakeClassnameTags123Api
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**TestClassname**](FakeClassnameTags123Api.md#TestClassname) | **Patch** /fake_classname_test | To test class name in snake case
|
||||||
|
|
||||||
|
|
||||||
|
# **TestClassname**
|
||||||
|
> Client TestClassname(ctx, client)
|
||||||
|
To test class name in snake case
|
||||||
|
|
||||||
|
To test class name in snake case
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**client** | [**Client**](Client.md)| client model |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Client**](Client.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[api_key_query](../README.md#api_key_query)
|
||||||
|
|
||||||
|
### 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)
|
||||||
|
|
10
samples/openapi3/client/petstore/go/go-petstore/docs/File.md
Normal file
10
samples/openapi3/client/petstore/go/go-petstore/docs/File.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# File
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**SourceURI** | **string** | Test capitalization | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
# FileSchemaTestClass
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**File** | [**File**](File.md) | | [optional]
|
||||||
|
**Files** | [**[]File**](File.md) | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
10
samples/openapi3/client/petstore/go/go-petstore/docs/Foo.md
Normal file
10
samples/openapi3/client/petstore/go/go-petstore/docs/Foo.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Foo
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Bar** | **string** | | [optional] [default to bar]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
# FormatTest
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Integer** | **int32** | | [optional]
|
||||||
|
**Int32** | **int32** | | [optional]
|
||||||
|
**Int64** | **int64** | | [optional]
|
||||||
|
**Number** | **float32** | |
|
||||||
|
**Float** | **float32** | | [optional]
|
||||||
|
**Double** | **float64** | | [optional]
|
||||||
|
**String** | **string** | | [optional]
|
||||||
|
**Byte** | **string** | |
|
||||||
|
**Binary** | [***os.File**](*os.File.md) | | [optional]
|
||||||
|
**Date** | **string** | |
|
||||||
|
**DateTime** | [**time.Time**](time.Time.md) | | [optional]
|
||||||
|
**Uuid** | **string** | | [optional]
|
||||||
|
**Password** | **string** | |
|
||||||
|
**PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional]
|
||||||
|
**PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
# HasOnlyReadOnly
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Bar** | **string** | | [optional]
|
||||||
|
**Foo** | **string** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
# HealthCheckResult
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**NullableMessage** | Pointer to **string** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
# InlineObject
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Name** | **string** | Updated name of the pet | [optional]
|
||||||
|
**Status** | **string** | Updated status of the pet | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
# InlineObject1
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**AdditionalMetadata** | **string** | Additional data to pass to server | [optional]
|
||||||
|
**File** | [***os.File**](*os.File.md) | file to upload | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
# InlineObject2
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**EnumFormStringArray** | **[]string** | Form parameter enum test (string array) | [optional]
|
||||||
|
**EnumFormString** | **string** | Form parameter enum test (string) | [optional] [default to ENUM_FORM_STRING_EFG]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
|||||||
|
# InlineObject3
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Integer** | **int32** | None | [optional]
|
||||||
|
**Int32** | **int32** | None | [optional]
|
||||||
|
**Int64** | **int64** | None | [optional]
|
||||||
|
**Number** | **float32** | None |
|
||||||
|
**Float** | **float32** | None | [optional]
|
||||||
|
**Double** | **float64** | None |
|
||||||
|
**String** | **string** | None | [optional]
|
||||||
|
**PatternWithoutDelimiter** | **string** | None |
|
||||||
|
**Byte** | **string** | None |
|
||||||
|
**Binary** | [***os.File**](*os.File.md) | None | [optional]
|
||||||
|
**Date** | **string** | None | [optional]
|
||||||
|
**DateTime** | [**time.Time**](time.Time.md) | None | [optional]
|
||||||
|
**Password** | **string** | None | [optional]
|
||||||
|
**Callback** | **string** | None | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
# InlineObject4
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Param** | **string** | field1 |
|
||||||
|
**Param2** | **string** | field2 |
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
# InlineObject5
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**AdditionalMetadata** | **string** | Additional data to pass to server | [optional]
|
||||||
|
**RequiredFile** | [***os.File**](*os.File.md) | file to upload |
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
# InlineResponseDefault
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**String** | [**Foo**](Foo.md) | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
10
samples/openapi3/client/petstore/go/go-petstore/docs/List.md
Normal file
10
samples/openapi3/client/petstore/go/go-petstore/docs/List.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# List
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Var123List** | **string** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
# MapTest
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**MapMapOfString** | [**map[string]map[string]string**](map.md) | | [optional]
|
||||||
|
**MapOfEnumString** | **map[string]string** | | [optional]
|
||||||
|
**DirectMap** | **map[string]bool** | | [optional]
|
||||||
|
**IndirectMap** | **map[string]bool** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
# MixedPropertiesAndAdditionalPropertiesClass
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Uuid** | **string** | | [optional]
|
||||||
|
**DateTime** | [**time.Time**](time.Time.md) | | [optional]
|
||||||
|
**Map** | [**map[string]Animal**](Animal.md) | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
# Model200Response
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Name** | **int32** | | [optional]
|
||||||
|
**Class** | **string** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
13
samples/openapi3/client/petstore/go/go-petstore/docs/Name.md
Normal file
13
samples/openapi3/client/petstore/go/go-petstore/docs/Name.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Name
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Name** | **int32** | |
|
||||||
|
**SnakeCase** | **int32** | | [optional]
|
||||||
|
**Property** | **string** | | [optional]
|
||||||
|
**Var123Number** | **int32** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
# NumberOnly
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**JustNumber** | **float32** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
# Order
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Id** | **int64** | | [optional]
|
||||||
|
**PetId** | **int64** | | [optional]
|
||||||
|
**Quantity** | **int32** | | [optional]
|
||||||
|
**ShipDate** | [**time.Time**](time.Time.md) | | [optional]
|
||||||
|
**Status** | **string** | Order Status | [optional]
|
||||||
|
**Complete** | **bool** | | [optional] [default to false]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
# OuterComposite
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**MyNumber** | **float32** | | [optional]
|
||||||
|
**MyString** | **string** | | [optional]
|
||||||
|
**MyBoolean** | **bool** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
# OuterEnum
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
||||||
|
|
15
samples/openapi3/client/petstore/go/go-petstore/docs/Pet.md
Normal file
15
samples/openapi3/client/petstore/go/go-petstore/docs/Pet.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Pet
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Id** | **int64** | | [optional]
|
||||||
|
**Category** | [**Category**](Category.md) | | [optional]
|
||||||
|
**Name** | **string** | |
|
||||||
|
**PhotoUrls** | **[]string** | |
|
||||||
|
**Tags** | [**[]Tag**](Tag.md) | | [optional]
|
||||||
|
**Status** | **string** | pet status in the store | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
297
samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md
Normal file
297
samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md
Normal file
@ -0,0 +1,297 @@
|
|||||||
|
# \PetApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**AddPet**](PetApi.md#AddPet) | **Post** /pet | Add a new pet to the store
|
||||||
|
[**DeletePet**](PetApi.md#DeletePet) | **Delete** /pet/{petId} | Deletes a pet
|
||||||
|
[**FindPetsByStatus**](PetApi.md#FindPetsByStatus) | **Get** /pet/findByStatus | Finds Pets by status
|
||||||
|
[**FindPetsByTags**](PetApi.md#FindPetsByTags) | **Get** /pet/findByTags | Finds Pets by tags
|
||||||
|
[**GetPetById**](PetApi.md#GetPetById) | **Get** /pet/{petId} | Find pet by ID
|
||||||
|
[**UpdatePet**](PetApi.md#UpdatePet) | **Put** /pet | Update an existing pet
|
||||||
|
[**UpdatePetWithForm**](PetApi.md#UpdatePetWithForm) | **Post** /pet/{petId} | Updates a pet in the store with form data
|
||||||
|
[**UploadFile**](PetApi.md#UploadFile) | **Post** /pet/{petId}/uploadImage | uploads an image
|
||||||
|
[**UploadFileWithRequiredFile**](PetApi.md#UploadFileWithRequiredFile) | **Post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
|
||||||
|
|
||||||
|
|
||||||
|
# **AddPet**
|
||||||
|
> AddPet(ctx, pet)
|
||||||
|
Add a new pet to the store
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[petstore_auth](../README.md#petstore_auth)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json, application/xml
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **DeletePet**
|
||||||
|
> DeletePet(ctx, petId, optional)
|
||||||
|
Deletes a pet
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**petId** | **int64**| Pet id to delete |
|
||||||
|
**optional** | ***DeletePetOpts** | optional parameters | nil if no parameters
|
||||||
|
|
||||||
|
### Optional Parameters
|
||||||
|
Optional parameters are passed through a pointer to a DeletePetOpts struct
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
|
||||||
|
**apiKey** | **optional.String**| |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[petstore_auth](../README.md#petstore_auth)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **FindPetsByStatus**
|
||||||
|
> []Pet FindPetsByStatus(ctx, status)
|
||||||
|
Finds Pets by status
|
||||||
|
|
||||||
|
Multiple status values can be provided with comma separated strings
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**status** | [**[]string**](string.md)| Status values that need to be considered for filter |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**[]Pet**](Pet.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[petstore_auth](../README.md#petstore_auth)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, 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)
|
||||||
|
|
||||||
|
# **FindPetsByTags**
|
||||||
|
> []Pet FindPetsByTags(ctx, tags)
|
||||||
|
Finds Pets by tags
|
||||||
|
|
||||||
|
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**tags** | [**[]string**](string.md)| Tags to filter by |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**[]Pet**](Pet.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[petstore_auth](../README.md#petstore_auth)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, 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)
|
||||||
|
|
||||||
|
# **GetPetById**
|
||||||
|
> Pet GetPetById(ctx, petId)
|
||||||
|
Find pet by ID
|
||||||
|
|
||||||
|
Returns a single pet
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**petId** | **int64**| ID of pet to return |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Pet**](Pet.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[api_key](../README.md#api_key)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, 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)
|
||||||
|
|
||||||
|
# **UpdatePet**
|
||||||
|
> UpdatePet(ctx, pet)
|
||||||
|
Update an existing pet
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[petstore_auth](../README.md#petstore_auth)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json, application/xml
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **UpdatePetWithForm**
|
||||||
|
> UpdatePetWithForm(ctx, petId, optional)
|
||||||
|
Updates a pet in the store with form data
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**petId** | **int64**| ID of pet that needs to be updated |
|
||||||
|
**optional** | ***UpdatePetWithFormOpts** | optional parameters | nil if no parameters
|
||||||
|
|
||||||
|
### Optional Parameters
|
||||||
|
Optional parameters are passed through a pointer to a UpdatePetWithFormOpts struct
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
|
||||||
|
**name** | **optional.String**| Updated name of the pet |
|
||||||
|
**status** | **optional.String**| Updated status of the pet |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[petstore_auth](../README.md#petstore_auth)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/x-www-form-urlencoded
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **UploadFile**
|
||||||
|
> ApiResponse UploadFile(ctx, petId, optional)
|
||||||
|
uploads an image
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**petId** | **int64**| ID of pet to update |
|
||||||
|
**optional** | ***UploadFileOpts** | optional parameters | nil if no parameters
|
||||||
|
|
||||||
|
### Optional Parameters
|
||||||
|
Optional parameters are passed through a pointer to a UploadFileOpts struct
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
|
||||||
|
**additionalMetadata** | **optional.String**| Additional data to pass to server |
|
||||||
|
**file** | **optional.Interface of *os.File****optional.*os.File**| file to upload |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**ApiResponse**](ApiResponse.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[petstore_auth](../README.md#petstore_auth)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: multipart/form-data
|
||||||
|
- **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)
|
||||||
|
|
||||||
|
# **UploadFileWithRequiredFile**
|
||||||
|
> ApiResponse UploadFileWithRequiredFile(ctx, petId, requiredFile, optional)
|
||||||
|
uploads an image (required)
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**petId** | **int64**| ID of pet to update |
|
||||||
|
**requiredFile** | ***os.File*****os.File**| file to upload |
|
||||||
|
**optional** | ***UploadFileWithRequiredFileOpts** | optional parameters | nil if no parameters
|
||||||
|
|
||||||
|
### Optional Parameters
|
||||||
|
Optional parameters are passed through a pointer to a UploadFileWithRequiredFileOpts struct
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
|
||||||
|
|
||||||
|
**additionalMetadata** | **optional.String**| Additional data to pass to server |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**ApiResponse**](ApiResponse.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[petstore_auth](../README.md#petstore_auth)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: multipart/form-data
|
||||||
|
- **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)
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
# ReadOnlyFirst
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Bar** | **string** | | [optional]
|
||||||
|
**Baz** | **string** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
# Return
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Return** | **int32** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
# SpecialModelName
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**SpecialPropertyName** | **int64** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
118
samples/openapi3/client/petstore/go/go-petstore/docs/StoreApi.md
Normal file
118
samples/openapi3/client/petstore/go/go-petstore/docs/StoreApi.md
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
# \StoreApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**DeleteOrder**](StoreApi.md#DeleteOrder) | **Delete** /store/order/{order_id} | Delete purchase order by ID
|
||||||
|
[**GetInventory**](StoreApi.md#GetInventory) | **Get** /store/inventory | Returns pet inventories by status
|
||||||
|
[**GetOrderById**](StoreApi.md#GetOrderById) | **Get** /store/order/{order_id} | Find purchase order by ID
|
||||||
|
[**PlaceOrder**](StoreApi.md#PlaceOrder) | **Post** /store/order | Place an order for a pet
|
||||||
|
|
||||||
|
|
||||||
|
# **DeleteOrder**
|
||||||
|
> DeleteOrder(ctx, orderId)
|
||||||
|
Delete purchase order by ID
|
||||||
|
|
||||||
|
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**orderId** | **string**| ID of the order that needs to be deleted |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **GetInventory**
|
||||||
|
> map[string]int32 GetInventory(ctx, )
|
||||||
|
Returns pet inventories by status
|
||||||
|
|
||||||
|
Returns a map of status codes to quantities
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**map[string]int32**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[api_key](../README.md#api_key)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **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)
|
||||||
|
|
||||||
|
# **GetOrderById**
|
||||||
|
> Order GetOrderById(ctx, orderId)
|
||||||
|
Find purchase order by ID
|
||||||
|
|
||||||
|
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**orderId** | **int64**| ID of pet that needs to be fetched |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Order**](Order.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, 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)
|
||||||
|
|
||||||
|
# **PlaceOrder**
|
||||||
|
> Order PlaceOrder(ctx, order)
|
||||||
|
Place an order for a pet
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Order**](Order.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/xml, 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)
|
||||||
|
|
11
samples/openapi3/client/petstore/go/go-petstore/docs/Tag.md
Normal file
11
samples/openapi3/client/petstore/go/go-petstore/docs/Tag.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Tag
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Id** | **int64** | | [optional]
|
||||||
|
**Name** | **string** | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
17
samples/openapi3/client/petstore/go/go-petstore/docs/User.md
Normal file
17
samples/openapi3/client/petstore/go/go-petstore/docs/User.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# User
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**Id** | **int64** | | [optional]
|
||||||
|
**Username** | **string** | | [optional]
|
||||||
|
**FirstName** | **string** | | [optional]
|
||||||
|
**LastName** | **string** | | [optional]
|
||||||
|
**Email** | **string** | | [optional]
|
||||||
|
**Password** | **string** | | [optional]
|
||||||
|
**Phone** | **string** | | [optional]
|
||||||
|
**UserStatus** | **int32** | User Status | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
228
samples/openapi3/client/petstore/go/go-petstore/docs/UserApi.md
Normal file
228
samples/openapi3/client/petstore/go/go-petstore/docs/UserApi.md
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
# \UserApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**CreateUser**](UserApi.md#CreateUser) | **Post** /user | Create user
|
||||||
|
[**CreateUsersWithArrayInput**](UserApi.md#CreateUsersWithArrayInput) | **Post** /user/createWithArray | Creates list of users with given input array
|
||||||
|
[**CreateUsersWithListInput**](UserApi.md#CreateUsersWithListInput) | **Post** /user/createWithList | Creates list of users with given input array
|
||||||
|
[**DeleteUser**](UserApi.md#DeleteUser) | **Delete** /user/{username} | Delete user
|
||||||
|
[**GetUserByName**](UserApi.md#GetUserByName) | **Get** /user/{username} | Get user by user name
|
||||||
|
[**LoginUser**](UserApi.md#LoginUser) | **Get** /user/login | Logs user into the system
|
||||||
|
[**LogoutUser**](UserApi.md#LogoutUser) | **Get** /user/logout | Logs out current logged in user session
|
||||||
|
[**UpdateUser**](UserApi.md#UpdateUser) | **Put** /user/{username} | Updated user
|
||||||
|
|
||||||
|
|
||||||
|
# **CreateUser**
|
||||||
|
> CreateUser(ctx, user)
|
||||||
|
Create user
|
||||||
|
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**user** | [**User**](User.md)| Created user object |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **CreateUsersWithArrayInput**
|
||||||
|
> CreateUsersWithArrayInput(ctx, user)
|
||||||
|
Creates list of users with given input array
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**user** | [**[]User**](array.md)| List of user object |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **CreateUsersWithListInput**
|
||||||
|
> CreateUsersWithListInput(ctx, user)
|
||||||
|
Creates list of users with given input array
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**user** | [**[]User**](array.md)| List of user object |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **DeleteUser**
|
||||||
|
> DeleteUser(ctx, username)
|
||||||
|
Delete user
|
||||||
|
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**username** | **string**| The name that needs to be deleted |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **GetUserByName**
|
||||||
|
> User GetUserByName(ctx, username)
|
||||||
|
Get user by user name
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**username** | **string**| The name that needs to be fetched. Use user1 for testing. |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**User**](User.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, 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)
|
||||||
|
|
||||||
|
# **LoginUser**
|
||||||
|
> string LoginUser(ctx, username, password)
|
||||||
|
Logs user into the system
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**username** | **string**| The user name for login |
|
||||||
|
**password** | **string**| The password for login in clear text |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**string**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, 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)
|
||||||
|
|
||||||
|
# **LogoutUser**
|
||||||
|
> LogoutUser(ctx, )
|
||||||
|
Logs out current logged in user session
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **UpdateUser**
|
||||||
|
> UpdateUser(ctx, username, user)
|
||||||
|
Updated user
|
||||||
|
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
### Required Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||||
|
**username** | **string**| name that need to be deleted |
|
||||||
|
**user** | [**User**](User.md)| Updated user object |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
52
samples/openapi3/client/petstore/go/go-petstore/git_push.sh
Normal file
52
samples/openapi3/client/petstore/go/go-petstore/git_push.sh
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
|
#
|
||||||
|
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
||||||
|
|
||||||
|
git_user_id=$1
|
||||||
|
git_repo_id=$2
|
||||||
|
release_note=$3
|
||||||
|
|
||||||
|
if [ "$git_user_id" = "" ]; then
|
||||||
|
git_user_id="GIT_USER_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$git_repo_id" = "" ]; then
|
||||||
|
git_repo_id="GIT_REPO_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$release_note" = "" ]; then
|
||||||
|
release_note="Minor update"
|
||||||
|
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initialize the local directory as a Git repository
|
||||||
|
git init
|
||||||
|
|
||||||
|
# Adds the files in the local repository and stages them for commit.
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||||
|
git commit -m "$release_note"
|
||||||
|
|
||||||
|
# Sets the new remote
|
||||||
|
git_remote=`git remote`
|
||||||
|
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||||
|
|
||||||
|
if [ "$GIT_TOKEN" = "" ]; then
|
||||||
|
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||||
|
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
||||||
|
else
|
||||||
|
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
git pull origin master
|
||||||
|
|
||||||
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
|
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
||||||
|
git push origin master 2>&1 | grep -v 'To https'
|
||||||
|
|
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
// Model for testing model name starting with number
|
||||||
|
type Model200Response struct {
|
||||||
|
Name int32 `json:"name,omitempty"`
|
||||||
|
Class string `json:"class,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type SpecialModelName struct {
|
||||||
|
SpecialPropertyName int64 `json:"$special[property.name],omitempty"`
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
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"`
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type Animal struct {
|
||||||
|
ClassName string `json:"className"`
|
||||||
|
Color string `json:"color,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type ApiResponse struct {
|
||||||
|
Code int32 `json:"code,omitempty"`
|
||||||
|
Type string `json:"type,omitempty"`
|
||||||
|
Message string `json:"message,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type ArrayOfArrayOfNumberOnly struct {
|
||||||
|
ArrayArrayNumber [][]float32 `json:"ArrayArrayNumber,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type ArrayOfNumberOnly struct {
|
||||||
|
ArrayNumber []float32 `json:"ArrayNumber,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
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"`
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type Capitalization struct {
|
||||||
|
SmallCamel string `json:"smallCamel,omitempty"`
|
||||||
|
CapitalCamel string `json:"CapitalCamel,omitempty"`
|
||||||
|
SmallSnake string `json:"small_Snake,omitempty"`
|
||||||
|
CapitalSnake string `json:"Capital_Snake,omitempty"`
|
||||||
|
SCAETHFlowPoints string `json:"SCA_ETH_Flow_Points,omitempty"`
|
||||||
|
// Name of the pet
|
||||||
|
ATT_NAME string `json:"ATT_NAME,omitempty"`
|
||||||
|
}
|
16
samples/openapi3/client/petstore/go/go-petstore/model_cat.go
Normal file
16
samples/openapi3/client/petstore/go/go-petstore/model_cat.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type Cat struct {
|
||||||
|
ClassName string `json:"className"`
|
||||||
|
Color string `json:"color,omitempty"`
|
||||||
|
Declawed bool `json:"declawed,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type Category struct {
|
||||||
|
Id int64 `json:"id,omitempty"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
// Model for testing model with \"_class\" property
|
||||||
|
type ClassModel struct {
|
||||||
|
Class string `json:"_class,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type Client struct {
|
||||||
|
Client string `json:"client,omitempty"`
|
||||||
|
}
|
16
samples/openapi3/client/petstore/go/go-petstore/model_dog.go
Normal file
16
samples/openapi3/client/petstore/go/go-petstore/model_dog.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type Dog struct {
|
||||||
|
ClassName string `json:"className"`
|
||||||
|
Color string `json:"color,omitempty"`
|
||||||
|
Breed string `json:"breed,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type EnumArrays struct {
|
||||||
|
JustSymbol string `json:"just_symbol,omitempty"`
|
||||||
|
ArrayEnum []string `json:"array_enum,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
type EnumClass string
|
||||||
|
|
||||||
|
// List of EnumClass
|
||||||
|
const (
|
||||||
|
ABC EnumClass = "_abc"
|
||||||
|
EFG EnumClass = "-efg"
|
||||||
|
XYZ EnumClass = "(xyz)"
|
||||||
|
)
|
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type EnumTest struct {
|
||||||
|
EnumString string `json:"enum_string,omitempty"`
|
||||||
|
EnumStringRequired string `json:"enum_string_required"`
|
||||||
|
EnumInteger int32 `json:"enum_integer,omitempty"`
|
||||||
|
EnumNumber float64 `json:"enum_number,omitempty"`
|
||||||
|
OuterEnum OuterEnum `json:"outerEnum,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
// Must be named `File` for test.
|
||||||
|
type File struct {
|
||||||
|
// Test capitalization
|
||||||
|
SourceURI string `json:"sourceURI,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type FileSchemaTestClass struct {
|
||||||
|
File File `json:"file,omitempty"`
|
||||||
|
Files []File `json:"files,omitempty"`
|
||||||
|
}
|
14
samples/openapi3/client/petstore/go/go-petstore/model_foo.go
Normal file
14
samples/openapi3/client/petstore/go/go-petstore/model_foo.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type Foo struct {
|
||||||
|
Bar string `json:"bar,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FormatTest struct {
|
||||||
|
Integer int32 `json:"integer,omitempty"`
|
||||||
|
Int32 int32 `json:"int32,omitempty"`
|
||||||
|
Int64 int64 `json:"int64,omitempty"`
|
||||||
|
Number float32 `json:"number"`
|
||||||
|
Float float32 `json:"float,omitempty"`
|
||||||
|
Double float64 `json:"double,omitempty"`
|
||||||
|
String string `json:"string,omitempty"`
|
||||||
|
Byte string `json:"byte"`
|
||||||
|
Binary *os.File `json:"binary,omitempty"`
|
||||||
|
Date string `json:"date"`
|
||||||
|
DateTime time.Time `json:"dateTime,omitempty"`
|
||||||
|
Uuid string `json:"uuid,omitempty"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
// A string that is a 10 digit number. Can have leading zeros.
|
||||||
|
PatternWithDigits string `json:"pattern_with_digits,omitempty"`
|
||||||
|
// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.
|
||||||
|
PatternWithDigitsAndDelimiter string `json:"pattern_with_digits_and_delimiter,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type HasOnlyReadOnly struct {
|
||||||
|
Bar string `json:"bar,omitempty"`
|
||||||
|
Foo string `json:"foo,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
// Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.
|
||||||
|
type HealthCheckResult struct {
|
||||||
|
NullableMessage *string `json:"NullableMessage,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type InlineObject struct {
|
||||||
|
// Updated name of the pet
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
// Updated status of the pet
|
||||||
|
Status string `json:"status,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
type InlineObject1 struct {
|
||||||
|
// Additional data to pass to server
|
||||||
|
AdditionalMetadata string `json:"additionalMetadata,omitempty"`
|
||||||
|
// file to upload
|
||||||
|
File *os.File `json:"file,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type InlineObject2 struct {
|
||||||
|
// Form parameter enum test (string array)
|
||||||
|
EnumFormStringArray []string `json:"enum_form_string_array,omitempty"`
|
||||||
|
// Form parameter enum test (string)
|
||||||
|
EnumFormString string `json:"enum_form_string,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type InlineObject3 struct {
|
||||||
|
// None
|
||||||
|
Integer int32 `json:"integer,omitempty"`
|
||||||
|
// None
|
||||||
|
Int32 int32 `json:"int32,omitempty"`
|
||||||
|
// None
|
||||||
|
Int64 int64 `json:"int64,omitempty"`
|
||||||
|
// None
|
||||||
|
Number float32 `json:"number"`
|
||||||
|
// None
|
||||||
|
Float float32 `json:"float,omitempty"`
|
||||||
|
// None
|
||||||
|
Double float64 `json:"double"`
|
||||||
|
// None
|
||||||
|
String string `json:"string,omitempty"`
|
||||||
|
// None
|
||||||
|
PatternWithoutDelimiter string `json:"pattern_without_delimiter"`
|
||||||
|
// None
|
||||||
|
Byte string `json:"byte"`
|
||||||
|
// None
|
||||||
|
Binary *os.File `json:"binary,omitempty"`
|
||||||
|
// None
|
||||||
|
Date string `json:"date,omitempty"`
|
||||||
|
// None
|
||||||
|
DateTime time.Time `json:"dateTime,omitempty"`
|
||||||
|
// None
|
||||||
|
Password string `json:"password,omitempty"`
|
||||||
|
// None
|
||||||
|
Callback string `json:"callback,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type InlineObject4 struct {
|
||||||
|
// field1
|
||||||
|
Param string `json:"param"`
|
||||||
|
// field2
|
||||||
|
Param2 string `json:"param2"`
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
type InlineObject5 struct {
|
||||||
|
// Additional data to pass to server
|
||||||
|
AdditionalMetadata string `json:"additionalMetadata,omitempty"`
|
||||||
|
// file to upload
|
||||||
|
RequiredFile *os.File `json:"requiredFile"`
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type InlineResponseDefault struct {
|
||||||
|
String Foo `json:"string,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
type List struct {
|
||||||
|
Var123List string `json:"123-list,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
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"`
|
||||||
|
DirectMap map[string]bool `json:"direct_map,omitempty"`
|
||||||
|
IndirectMap map[string]bool `json:"indirect_map,omitempty"`
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
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"`
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* OpenAPI 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: \" \\
|
||||||
|
*
|
||||||
|
* API version: 1.0.0
|
||||||
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package petstore
|
||||||
|
|
||||||
|
// Model for testing model name same as property name
|
||||||
|
type Name struct {
|
||||||
|
Name int32 `json:"name"`
|
||||||
|
SnakeCase int32 `json:"snake_case,omitempty"`
|
||||||
|
Property string `json:"property,omitempty"`
|
||||||
|
Var123Number int32 `json:"123Number,omitempty"`
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user