update rust samples

This commit is contained in:
William Cheng 2019-04-22 21:57:31 +08:00
parent fab980cf79
commit f83d09fc01
35 changed files with 555 additions and 163 deletions

View File

@ -3,6 +3,7 @@
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client.
- API version: 1.0.0
@ -10,7 +11,9 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat
- Build package: org.openapitools.codegen.languages.RustClientCodegen
## Installation
Put the package under your project folder and add the following in import:
```
"./petstore_client"
```
@ -47,6 +50,8 @@ Class | Method | HTTP request | Description
- [ApiResponse](docs/ApiResponse.md)
- [Category](docs/Category.md)
- [InlineObject](docs/InlineObject.md)
- [InlineObject1](docs/InlineObject1.md)
- [Order](docs/Order.md)
- [Pet](docs/Pet.md)
- [Tag](docs/Tag.md)
@ -55,18 +60,37 @@ Class | Method | HTTP request | Description
## Documentation For Authorization
## api_key
- **Type**: API key
Example
```
auth := context.WithValue(context.TODO(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
auth := context.WithValue(context.TODO(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
```
## auth_cookie
- **Type**: API key
Example
```
auth := context.WithValue(context.TODO(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
```
## petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
@ -75,22 +99,25 @@ Example
- **read:pets**: read your pets
Example
```
auth := context.WithValue(context.TODO(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
auth := context.WithValue(context.TODO(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)
```
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
```
import "golang.org/x/oauth2"
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)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)
```
## Author

View File

@ -1,6 +1,7 @@
# ApiResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | **i32** | | [optional]

View File

@ -1,6 +1,7 @@
# Category
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]

View File

@ -1,6 +1,7 @@
# InlineObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | Updated name of the pet | [optional]

View File

@ -1,6 +1,7 @@
# InlineObject1
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**additional_metadata** | **String** | Additional data to pass to server | [optional]

View File

@ -1,6 +1,7 @@
# Order
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]

View File

@ -1,6 +1,7 @@
# Pet
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]

View File

@ -14,16 +14,19 @@ Method | HTTP request | Description
[**upload_file**](PetApi.md#upload_file) | **Post** /pet/{petId}/uploadImage | uploads an image
# **add_pet**
> add_pet(ctx, body)
## add_pet
> add_pet(ctx, pet)
Add a new pet to the store
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
@ -35,17 +38,20 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
- **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)
# **delete_pet**
## delete_pet
> delete_pet(ctx, pet_id, optional)
Deletes a pet
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
@ -53,6 +59,7 @@ Name | Type | Description | Notes
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a map[string]interface{}.
Name | Type | Description | Notes
@ -70,12 +77,14 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
- **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)
# **find_pets_by_status**
## find_pets_by_status
> Vec<::models::Pet> find_pets_by_status(ctx, status)
Finds Pets by status
@ -83,6 +92,7 @@ Multiple status values can be provided with comma separated strings
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
@ -98,23 +108,36 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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)
# **find_pets_by_tags**
> Vec<::models::Pet> find_pets_by_tags(ctx, tags)
## find_pets_by_tags
> Vec<::models::Pet> find_pets_by_tags(ctx, tags, optional)
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 containing the authentication | nil if no authentication
**tags** | [**Vec<String>**](String.md)| Tags to filter by |
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a map[string]interface{}.
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**tags** | [**Vec<String>**](String.md)| Tags to filter by |
**max_count** | **i32**| Maximum number of items to return |
### Return type
@ -126,12 +149,14 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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)
# **get_pet_by_id**
## get_pet_by_id
> ::models::Pet get_pet_by_id(ctx, pet_id)
Find pet by ID
@ -139,6 +164,7 @@ Returns a single pet
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
@ -154,21 +180,24 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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)
# **update_pet**
> update_pet(ctx, body)
## update_pet
> update_pet(ctx, pet)
Update an existing pet
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
@ -180,17 +209,20 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
- **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)
# **update_pet_with_form**
## update_pet_with_form
> update_pet_with_form(ctx, pet_id, optional)
Updates a pet in the store with form data
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
@ -198,6 +230,7 @@ Name | Type | Description | Notes
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a map[string]interface{}.
Name | Type | Description | Notes
@ -216,17 +249,20 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: Not defined
- **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)
# **upload_file**
## upload_file
> ::models::ApiResponse upload_file(ctx, pet_id, optional)
uploads an image
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
@ -234,6 +270,7 @@ Name | Type | Description | Notes
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a map[string]interface{}.
Name | Type | Description | Notes
@ -252,8 +289,8 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
- **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)

View File

@ -10,7 +10,9 @@ Method | HTTP request | Description
[**place_order**](StoreApi.md#place_order) | **Post** /store/order | Place an order for a pet
# **delete_order**
## delete_order
> delete_order(order_id)
Delete purchase order by ID
@ -18,6 +20,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**order_id** | **String**| ID of the order that needs to be deleted |
@ -32,18 +35,21 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
- **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)
# **get_inventory**
## get_inventory
> ::std::collections::HashMap<String, i32> get_inventory(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
@ -56,12 +62,14 @@ This endpoint does not need any parameter.
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
- **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)
# **get_order_by_id**
## get_order_by_id
> ::models::Order get_order_by_id(order_id)
Find purchase order by ID
@ -69,6 +77,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**order_id** | **i64**| ID of pet that needs to be fetched |
@ -83,20 +92,23 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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)
# **place_order**
> ::models::Order place_order(body)
## place_order
> ::models::Order place_order(order)
Place an order for a pet
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
### Return type
@ -108,8 +120,8 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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)

View File

@ -1,6 +1,7 @@
# Tag
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]

View File

@ -1,6 +1,7 @@
# User
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]

View File

@ -14,17 +14,21 @@ Method | HTTP request | Description
[**update_user**](UserApi.md#update_user) | **Put** /user/{username} | Updated user
# **create_user**
> create_user(body)
## create_user
> create_user(ctx, user)
Create user
This can only be done by the logged in user.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**User**](User.md)| Created user object |
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
**user** | [**User**](User.md)| Created user object |
### Return type
@ -32,24 +36,28 @@ Name | Type | Description | Notes
### Authorization
No authorization required
[auth_cookie](../README.md#auth_cookie)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
- **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)
# **create_users_with_array_input**
> create_users_with_array_input(body)
## create_users_with_array_input
> create_users_with_array_input(ctx, user)
Creates list of users with given input array
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Vec<::models::User>**](array.md)| List of user object |
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
**user** | [**Vec<::models::User>**](array.md)| List of user object |
### Return type
@ -57,24 +65,28 @@ Name | Type | Description | Notes
### Authorization
No authorization required
[auth_cookie](../README.md#auth_cookie)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
- **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)
# **create_users_with_list_input**
> create_users_with_list_input(body)
## create_users_with_list_input
> create_users_with_list_input(ctx, user)
Creates list of users with given input array
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Vec<::models::User>**](array.md)| List of user object |
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
**user** | [**Vec<::models::User>**](array.md)| List of user object |
### Return type
@ -82,25 +94,29 @@ Name | Type | Description | Notes
### Authorization
No authorization required
[auth_cookie](../README.md#auth_cookie)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
- **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)
# **delete_user**
> delete_user(username)
## delete_user
> delete_user(ctx, username)
Delete user
This can only be done by the logged in user.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
**username** | **String**| The name that needs to be deleted |
### Return type
@ -109,21 +125,24 @@ Name | Type | Description | Notes
### Authorization
No authorization required
[auth_cookie](../README.md#auth_cookie)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
- **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)
# **get_user_by_name**
## get_user_by_name
> ::models::User get_user_by_name(username)
Get user by user name
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
@ -138,17 +157,20 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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)
# **login_user**
## login_user
> String login_user(username, password)
Logs user into the system
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| The user name for login |
@ -164,16 +186,19 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **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)
# **logout_user**
> logout_user()
## logout_user
> logout_user(ctx, )
Logs out current logged in user session
### Required Parameters
This endpoint does not need any parameter.
### Return type
@ -182,27 +207,31 @@ This endpoint does not need any parameter.
### Authorization
No authorization required
[auth_cookie](../README.md#auth_cookie)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
- **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)
# **update_user**
> update_user(username, body)
## update_user
> update_user(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 containing the authentication | nil if no authentication
**username** | **String**| name that need to be deleted |
**body** | [**User**](User.md)| Updated user object |
**user** | [**User**](User.md)| Updated user object |
### Return type
@ -210,12 +239,12 @@ Name | Type | Description | Notes
### Authorization
No authorization required
[auth_cookie](../README.md#auth_cookie)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
- **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)

View File

@ -31,22 +31,22 @@ impl<C: hyper::client::Connect> PetApiClient<C> {
}
pub trait PetApi {
fn add_pet(&self, body: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn add_pet(&self, pet: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn delete_pet(&self, pet_id: i64, api_key: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn find_pets_by_status(&self, status: Vec<String>) -> Box<Future<Item = Vec<::models::Pet>, Error = Error<serde_json::Value>>>;
fn find_pets_by_tags(&self, tags: Vec<String>) -> Box<Future<Item = Vec<::models::Pet>, Error = Error<serde_json::Value>>>;
fn find_pets_by_tags(&self, tags: Vec<String>, max_count: i32) -> Box<Future<Item = Vec<::models::Pet>, Error = Error<serde_json::Value>>>;
fn get_pet_by_id(&self, pet_id: i64) -> Box<Future<Item = ::models::Pet, Error = Error<serde_json::Value>>>;
fn update_pet(&self, body: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn update_pet(&self, pet: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: &std::path::Path) -> Box<Future<Item = ::models::ApiResponse, Error = Error<serde_json::Value>>>;
}
impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
fn add_pet(&self, body: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
fn add_pet(&self, pet: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Post, "/pet".to_string())
.with_auth(__internal_request::Auth::Oauth)
.with_body_param(body)
.with_body_param(pet)
.returns_nothing()
.execute(self.configuration.borrow())
}
@ -67,10 +67,11 @@ impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
.execute(self.configuration.borrow())
}
fn find_pets_by_tags(&self, tags: Vec<String>) -> Box<Future<Item = Vec<::models::Pet>, Error = Error<serde_json::Value>>> {
fn find_pets_by_tags(&self, tags: Vec<String>, max_count: i32) -> Box<Future<Item = Vec<::models::Pet>, Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Get, "/pet/findByTags".to_string())
.with_auth(__internal_request::Auth::Oauth)
.with_query_param("tags".to_string(), tags.join(",").to_string())
.with_query_param("maxCount".to_string(), max_count.to_string())
.execute(self.configuration.borrow())
}
@ -85,10 +86,10 @@ impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
.execute(self.configuration.borrow())
}
fn update_pet(&self, body: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
fn update_pet(&self, pet: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Put, "/pet".to_string())
.with_auth(__internal_request::Auth::Oauth)
.with_body_param(body)
.with_body_param(pet)
.returns_nothing()
.execute(self.configuration.borrow())
}

View File

@ -34,7 +34,7 @@ pub trait StoreApi {
fn delete_order(&self, order_id: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn get_inventory(&self, ) -> Box<Future<Item = ::std::collections::HashMap<String, i32>, Error = Error<serde_json::Value>>>;
fn get_order_by_id(&self, order_id: i64) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>>;
fn place_order(&self, body: ::models::Order) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>>;
fn place_order(&self, order: ::models::Order) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>>;
}
@ -62,9 +62,9 @@ impl<C: hyper::client::Connect>StoreApi for StoreApiClient<C> {
.execute(self.configuration.borrow())
}
fn place_order(&self, body: ::models::Order) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>> {
fn place_order(&self, order: ::models::Order) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Post, "/store/order".to_string())
.with_body_param(body)
.with_body_param(order)
.execute(self.configuration.borrow())
}

View File

@ -31,41 +31,61 @@ impl<C: hyper::client::Connect> UserApiClient<C> {
}
pub trait UserApi {
fn create_user(&self, body: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn create_users_with_array_input(&self, body: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn create_users_with_list_input(&self, body: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn create_user(&self, user: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn create_users_with_array_input(&self, user: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn create_users_with_list_input(&self, user: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn delete_user(&self, username: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn get_user_by_name(&self, username: &str) -> Box<Future<Item = ::models::User, Error = Error<serde_json::Value>>>;
fn login_user(&self, username: &str, password: &str) -> Box<Future<Item = String, Error = Error<serde_json::Value>>>;
fn logout_user(&self, ) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn update_user(&self, username: &str, body: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn update_user(&self, username: &str, user: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
}
impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
fn create_user(&self, body: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
fn create_user(&self, user: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Post, "/user".to_string())
.with_body_param(body)
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: false,
in_query: false,
param_name: "AUTH_KEY".to_owned(),
}))
.with_body_param(user)
.returns_nothing()
.execute(self.configuration.borrow())
}
fn create_users_with_array_input(&self, body: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
fn create_users_with_array_input(&self, user: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Post, "/user/createWithArray".to_string())
.with_body_param(body)
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: false,
in_query: false,
param_name: "AUTH_KEY".to_owned(),
}))
.with_body_param(user)
.returns_nothing()
.execute(self.configuration.borrow())
}
fn create_users_with_list_input(&self, body: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
fn create_users_with_list_input(&self, user: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Post, "/user/createWithList".to_string())
.with_body_param(body)
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: false,
in_query: false,
param_name: "AUTH_KEY".to_owned(),
}))
.with_body_param(user)
.returns_nothing()
.execute(self.configuration.borrow())
}
fn delete_user(&self, username: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Delete, "/user/{username}".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: false,
in_query: false,
param_name: "AUTH_KEY".to_owned(),
}))
.with_path_param("username".to_string(), username.to_string())
.returns_nothing()
.execute(self.configuration.borrow())
@ -86,14 +106,24 @@ impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
fn logout_user(&self, ) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Get, "/user/logout".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: false,
in_query: false,
param_name: "AUTH_KEY".to_owned(),
}))
.returns_nothing()
.execute(self.configuration.borrow())
}
fn update_user(&self, username: &str, body: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
fn update_user(&self, username: &str, user: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Put, "/user/{username}".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: false,
in_query: false,
param_name: "AUTH_KEY".to_owned(),
}))
.with_path_param("username".to_string(), username.to_string())
.with_body_param(body)
.with_body_param(user)
.returns_nothing()
.execute(self.configuration.borrow())
}

View File

@ -2,6 +2,10 @@ mod api_response;
pub use self::api_response::ApiResponse;
mod category;
pub use self::category::Category;
mod inline_object;
pub use self::inline_object::InlineObject;
mod inline_object_1;
pub use self::inline_object_1::InlineObject1;
mod order;
pub use self::order::Order;
mod pet;

View File

@ -122,9 +122,11 @@ Method | HTTP request | Description
## Documentation For Models
- [AnotherXmlArray](docs/AnotherXmlArray.md)
- [AnotherXmlInner](docs/AnotherXmlInner.md)
- [AnotherXmlObject](docs/AnotherXmlObject.md)
- [DuplicateXmlObject](docs/DuplicateXmlObject.md)
- [XmlArray](docs/XmlArray.md)
- [XmlInner](docs/XmlInner.md)
- [XmlObject](docs/XmlObject.md)

View File

@ -96,12 +96,7 @@ components:
inner_string:
type: string
inner_array:
items:
$ref: '#/components/schemas/xml_inner'
type: array
xml:
name: CamelXmlArray
wrapped: true
$ref: '#/components/schemas/xml_array'
required:
- inner_array
type: object

View File

@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**inner_string** | **String** | | [optional] [default to None]
**inner_array** | **Vec<models::XmlInner>** | |
**inner_array** | [***models::XmlArray**](xml_array.md) | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -88,12 +88,12 @@ fn main() {
},
Some("XmlOtherPut") => {
let result = core.run(client.xml_other_put(Some(&Vec::new())));
let result = core.run(client.xml_other_put(None));
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("XmlPost") => {
let result = core.run(client.xml_post(Some(&Vec::new())));
let result = core.run(client.xml_post(None));
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},

View File

@ -47,14 +47,14 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString>{
}
fn xml_other_put(&self, string: Option<&Vec<models::AnotherXmlInner>>, context: &C) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>> {
fn xml_other_put(&self, string: Option<models::AnotherXmlArray>, context: &C) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>> {
let context = context.clone();
println!("xml_other_put({:?}) - X-Span-ID: {:?}", string, context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
/// Post an array
fn xml_post(&self, string: Option<&Vec<models::XmlInner>>, context: &C) -> Box<Future<Item=XmlPostResponse, Error=ApiError>> {
fn xml_post(&self, string: Option<models::XmlArray>, context: &C) -> Box<Future<Item=XmlPostResponse, Error=ApiError>> {
let context = context.clone();
println!("xml_post({:?}) - X-Span-ID: {:?}", string, context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))

View File

@ -412,7 +412,7 @@ if let Some(body) = body {
}
fn xml_other_put(&self, param_string: Option<&Vec<models::AnotherXmlInner>>, context: &C) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>> {
fn xml_other_put(&self, param_string: Option<models::AnotherXmlArray>, context: &C) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>> {
let mut uri = format!(
"{}/xml_other",
self.base_path
@ -492,7 +492,7 @@ if let Some(body) = body {
}
fn xml_post(&self, param_string: Option<&Vec<models::XmlInner>>, context: &C) -> Box<Future<Item=XmlPostResponse, Error=ApiError>> {
fn xml_post(&self, param_string: Option<models::XmlArray>, context: &C) -> Box<Future<Item=XmlPostResponse, Error=ApiError>> {
let mut uri = format!(
"{}/xml",
self.base_path

View File

@ -90,10 +90,10 @@ pub trait Api<C> {
fn xml_other_post(&self, another_xml_object: Option<models::AnotherXmlObject>, context: &C) -> Box<Future<Item=XmlOtherPostResponse, Error=ApiError>>;
fn xml_other_put(&self, string: Option<&Vec<models::AnotherXmlInner>>, context: &C) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>>;
fn xml_other_put(&self, string: Option<models::AnotherXmlArray>, context: &C) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>>;
/// Post an array
fn xml_post(&self, string: Option<&Vec<models::XmlInner>>, context: &C) -> Box<Future<Item=XmlPostResponse, Error=ApiError>>;
fn xml_post(&self, string: Option<models::XmlArray>, context: &C) -> Box<Future<Item=XmlPostResponse, Error=ApiError>>;
fn xml_put(&self, xml_object: Option<models::XmlObject>, context: &C) -> Box<Future<Item=XmlPutResponse, Error=ApiError>>;
@ -110,10 +110,10 @@ pub trait ApiNoContext {
fn xml_other_post(&self, another_xml_object: Option<models::AnotherXmlObject>) -> Box<Future<Item=XmlOtherPostResponse, Error=ApiError>>;
fn xml_other_put(&self, string: Option<&Vec<models::AnotherXmlInner>>) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>>;
fn xml_other_put(&self, string: Option<models::AnotherXmlArray>) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>>;
/// Post an array
fn xml_post(&self, string: Option<&Vec<models::XmlInner>>) -> Box<Future<Item=XmlPostResponse, Error=ApiError>>;
fn xml_post(&self, string: Option<models::XmlArray>) -> Box<Future<Item=XmlPostResponse, Error=ApiError>>;
fn xml_put(&self, xml_object: Option<models::XmlObject>) -> Box<Future<Item=XmlPutResponse, Error=ApiError>>;
@ -145,12 +145,12 @@ impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C> {
}
fn xml_other_put(&self, string: Option<&Vec<models::AnotherXmlInner>>) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>> {
fn xml_other_put(&self, string: Option<models::AnotherXmlArray>) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>> {
self.api().xml_other_put(string, &self.context())
}
/// Post an array
fn xml_post(&self, string: Option<&Vec<models::XmlInner>>) -> Box<Future<Item=XmlPostResponse, Error=ApiError>> {
fn xml_post(&self, string: Option<models::XmlArray>) -> Box<Future<Item=XmlPostResponse, Error=ApiError>> {
self.api().xml_post(string, &self.context())
}

View File

@ -10,6 +10,86 @@ use models;
use swagger;
// Utility function for wrapping list elements when serializing xml
#[allow(non_snake_case)]
fn wrap_in_snake_another_xml_inner<S>(item: &Vec<String>, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serde_xml_rs::wrap_primitives(item, serializer, "snake_another_xml_inner")
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AnotherXmlArray(#[serde(serialize_with = "wrap_in_snake_another_xml_inner")]Vec<String>);
impl ::std::convert::From<Vec<String>> for AnotherXmlArray {
fn from(x: Vec<String>) -> Self {
AnotherXmlArray(x)
}
}
impl ::std::convert::From<AnotherXmlArray> for Vec<String> {
fn from(x: AnotherXmlArray) -> Self {
x.0
}
}
impl ::std::iter::FromIterator<String> for AnotherXmlArray {
fn from_iter<U: IntoIterator<Item=String>>(u: U) -> Self {
AnotherXmlArray(Vec::<String>::from_iter(u))
}
}
impl ::std::iter::IntoIterator for AnotherXmlArray {
type Item = String;
type IntoIter = ::std::vec::IntoIter<String>;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}
impl<'a> ::std::iter::IntoIterator for &'a AnotherXmlArray {
type Item = &'a String;
type IntoIter = ::std::slice::Iter<'a, String>;
fn into_iter(self) -> Self::IntoIter {
(&self.0).into_iter()
}
}
impl<'a> ::std::iter::IntoIterator for &'a mut AnotherXmlArray {
type Item = &'a mut String;
type IntoIter = ::std::slice::IterMut<'a, String>;
fn into_iter(self) -> Self::IntoIter {
(&mut self.0).into_iter()
}
}
impl ::std::ops::Deref for AnotherXmlArray {
type Target = Vec<String>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl ::std::ops::DerefMut for AnotherXmlArray {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl AnotherXmlArray {
/// Helper function to allow us to convert this model to an XML string.
/// Will panic if serialisation fails.
#[allow(dead_code)]
pub(crate) fn to_xml(&self) -> String {
serde_xml_rs::to_string(&self).expect("impossible to fail to serialize")
}
}
#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize, Deserialize)]
#[serde(rename = "snake_another_xml_inner")]
pub struct AnotherXmlInner(String);
@ -94,12 +174,13 @@ pub struct DuplicateXmlObject {
pub inner_string: Option<String>,
#[serde(rename = "inner_array")]
pub inner_array: Vec<models::XmlInner>,
#[serde(serialize_with = "wrap_in_camelXmlInner")]
pub inner_array: models::XmlArray,
}
impl DuplicateXmlObject {
pub fn new(inner_array: Vec<models::XmlInner>, ) -> DuplicateXmlObject {
pub fn new(inner_array: models::XmlArray, ) -> DuplicateXmlObject {
DuplicateXmlObject {
inner_string: None,
inner_array: inner_array,
@ -125,6 +206,86 @@ impl DuplicateXmlObject {
}
}
// Utility function for wrapping list elements when serializing xml
#[allow(non_snake_case)]
fn wrap_in_camelXmlInner<S>(item: &Vec<String>, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serde_xml_rs::wrap_primitives(item, serializer, "camelXmlInner")
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct XmlArray(#[serde(serialize_with = "wrap_in_camelXmlInner")]Vec<String>);
impl ::std::convert::From<Vec<String>> for XmlArray {
fn from(x: Vec<String>) -> Self {
XmlArray(x)
}
}
impl ::std::convert::From<XmlArray> for Vec<String> {
fn from(x: XmlArray) -> Self {
x.0
}
}
impl ::std::iter::FromIterator<String> for XmlArray {
fn from_iter<U: IntoIterator<Item=String>>(u: U) -> Self {
XmlArray(Vec::<String>::from_iter(u))
}
}
impl ::std::iter::IntoIterator for XmlArray {
type Item = String;
type IntoIter = ::std::vec::IntoIter<String>;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}
impl<'a> ::std::iter::IntoIterator for &'a XmlArray {
type Item = &'a String;
type IntoIter = ::std::slice::Iter<'a, String>;
fn into_iter(self) -> Self::IntoIter {
(&self.0).into_iter()
}
}
impl<'a> ::std::iter::IntoIterator for &'a mut XmlArray {
type Item = &'a mut String;
type IntoIter = ::std::slice::IterMut<'a, String>;
fn into_iter(self) -> Self::IntoIter {
(&mut self.0).into_iter()
}
}
impl ::std::ops::Deref for XmlArray {
type Target = Vec<String>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl ::std::ops::DerefMut for XmlArray {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl XmlArray {
/// Helper function to allow us to convert this model to an XML string.
/// Will panic if serialisation fails.
#[allow(dead_code)]
pub(crate) fn to_xml(&self) -> String {
serde_xml_rs::to_string(&self).expect("impossible to fail to serialize")
}
}
#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize, Deserialize)]
#[serde(rename = "camelXmlInner")]
pub struct XmlInner(String);

View File

@ -309,7 +309,7 @@ where
Ok(body) => {
let mut unused_elements = Vec::new();
let param_string: Option<Vec<models::AnotherXmlInner>> = if !body.is_empty() {
let param_string: Option<models::AnotherXmlArray> = if !body.is_empty() {
let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body);
match serde_ignored::deserialize(deserializer, |path| {
@ -326,7 +326,7 @@ where
};
Box::new(api_impl.xml_other_put(param_string.as_ref(), &context)
Box::new(api_impl.xml_other_put(param_string, &context)
.then(move |result| {
let mut response = Response::new();
response.headers_mut().set(XSpanId((&context as &Has<XSpanIdString>).get().0.to_string()));
@ -391,7 +391,7 @@ where
Ok(body) => {
let mut unused_elements = Vec::new();
let param_string: Option<Vec<models::XmlInner>> = if !body.is_empty() {
let param_string: Option<models::XmlArray> = if !body.is_empty() {
let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body);
match serde_ignored::deserialize(deserializer, |path| {
@ -408,7 +408,7 @@ where
};
Box::new(api_impl.xml_post(param_string.as_ref(), &context)
Box::new(api_impl.xml_post(param_string, &context)
.then(move |result| {
let mut response = Response::new();
response.headers_mut().set(XSpanId((&context as &Has<XSpanIdString>).get().0.to_string()));

View File

@ -178,6 +178,7 @@ Method | HTTP request | Description
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
- [Animal](docs/Animal.md)
- [AnimalFarm](docs/AnimalFarm.md)
- [ApiResponse](docs/ApiResponse.md)
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)

View File

@ -33,7 +33,7 @@ Optional parameters are passed through a map[string]interface{}.
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **bool**| Input boolean as post body |
**body** | [**boolean**](boolean.md)| Input boolean as post body |
### Return type
@ -101,7 +101,7 @@ Optional parameters are passed through a map[string]interface{}.
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **f64**| Input number as post body |
**body** | [**number**](number.md)| Input number as post body |
### Return type
@ -135,7 +135,7 @@ Optional parameters are passed through a map[string]interface{}.
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **String**| Input string as post body |
**body** | [**string**](string.md)| Input string as post body |
### Return type

View File

@ -128,7 +128,7 @@ fn main() {
// },
Some("FakeOuterBooleanSerialize") => {
let result = core.run(client.fake_outer_boolean_serialize(Some(true)));
let result = core.run(client.fake_outer_boolean_serialize(None));
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
@ -138,12 +138,12 @@ fn main() {
},
Some("FakeOuterNumberSerialize") => {
let result = core.run(client.fake_outer_number_serialize(Some(8.14)));
let result = core.run(client.fake_outer_number_serialize(None));
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("FakeOuterStringSerialize") => {
let result = core.run(client.fake_outer_string_serialize(Some("body_example".to_string())));
let result = core.run(client.fake_outer_string_serialize(None));
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},

View File

@ -67,7 +67,7 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString>{
}
fn fake_outer_boolean_serialize(&self, body: Option<bool>, context: &C) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>> {
fn fake_outer_boolean_serialize(&self, body: Option<models::OuterBoolean>, context: &C) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>> {
let context = context.clone();
println!("fake_outer_boolean_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
@ -81,14 +81,14 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString>{
}
fn fake_outer_number_serialize(&self, body: Option<f64>, context: &C) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>> {
fn fake_outer_number_serialize(&self, body: Option<models::OuterNumber>, context: &C) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>> {
let context = context.clone();
println!("fake_outer_number_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn fake_outer_string_serialize(&self, body: Option<String>, context: &C) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>> {
fn fake_outer_string_serialize(&self, body: Option<models::OuterString>, context: &C) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>> {
let context = context.clone();
println!("fake_outer_string_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))

View File

@ -357,7 +357,7 @@ impl<F, C> Api<C> for Client<F> where
}
fn fake_outer_boolean_serialize(&self, param_body: Option<bool>, context: &C) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>> {
fn fake_outer_boolean_serialize(&self, param_body: Option<models::OuterBoolean>, context: &C) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>> {
let mut uri = format!(
"{}/v2/fake/outer/boolean",
self.base_path
@ -521,7 +521,7 @@ if let Some(body) = body {
}
fn fake_outer_number_serialize(&self, param_body: Option<f64>, context: &C) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>> {
fn fake_outer_number_serialize(&self, param_body: Option<models::OuterNumber>, context: &C) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>> {
let mut uri = format!(
"{}/v2/fake/outer/number",
self.base_path
@ -602,7 +602,7 @@ if let Some(body) = body {
}
fn fake_outer_string_serialize(&self, param_body: Option<String>, context: &C) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>> {
fn fake_outer_string_serialize(&self, param_body: Option<models::OuterString>, context: &C) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>> {
let mut uri = format!(
"{}/v2/fake/outer/string",
self.base_path

View File

@ -273,16 +273,16 @@ pub trait Api<C> {
fn test_special_tags(&self, body: models::Client, context: &C) -> Box<Future<Item=TestSpecialTagsResponse, Error=ApiError>>;
fn fake_outer_boolean_serialize(&self, body: Option<bool>, context: &C) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>>;
fn fake_outer_boolean_serialize(&self, body: Option<models::OuterBoolean>, context: &C) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>>;
fn fake_outer_composite_serialize(&self, body: Option<models::OuterComposite>, context: &C) -> Box<Future<Item=FakeOuterCompositeSerializeResponse, Error=ApiError>>;
fn fake_outer_number_serialize(&self, body: Option<f64>, context: &C) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>>;
fn fake_outer_number_serialize(&self, body: Option<models::OuterNumber>, context: &C) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>>;
fn fake_outer_string_serialize(&self, body: Option<String>, context: &C) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>>;
fn fake_outer_string_serialize(&self, body: Option<models::OuterString>, context: &C) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>>;
fn test_body_with_query_params(&self, query: String, body: models::User, context: &C) -> Box<Future<Item=TestBodyWithQueryParamsResponse, Error=ApiError>>;
@ -374,16 +374,16 @@ pub trait ApiNoContext {
fn test_special_tags(&self, body: models::Client) -> Box<Future<Item=TestSpecialTagsResponse, Error=ApiError>>;
fn fake_outer_boolean_serialize(&self, body: Option<bool>) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>>;
fn fake_outer_boolean_serialize(&self, body: Option<models::OuterBoolean>) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>>;
fn fake_outer_composite_serialize(&self, body: Option<models::OuterComposite>) -> Box<Future<Item=FakeOuterCompositeSerializeResponse, Error=ApiError>>;
fn fake_outer_number_serialize(&self, body: Option<f64>) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>>;
fn fake_outer_number_serialize(&self, body: Option<models::OuterNumber>) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>>;
fn fake_outer_string_serialize(&self, body: Option<String>) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>>;
fn fake_outer_string_serialize(&self, body: Option<models::OuterString>) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>>;
fn test_body_with_query_params(&self, query: String, body: models::User) -> Box<Future<Item=TestBodyWithQueryParamsResponse, Error=ApiError>>;
@ -488,7 +488,7 @@ impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C> {
}
fn fake_outer_boolean_serialize(&self, body: Option<bool>) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>> {
fn fake_outer_boolean_serialize(&self, body: Option<models::OuterBoolean>) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>> {
self.api().fake_outer_boolean_serialize(body, &self.context())
}
@ -498,12 +498,12 @@ impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C> {
}
fn fake_outer_number_serialize(&self, body: Option<f64>) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>> {
fn fake_outer_number_serialize(&self, body: Option<models::OuterNumber>) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>> {
self.api().fake_outer_number_serialize(body, &self.context())
}
fn fake_outer_string_serialize(&self, body: Option<String>) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>> {
fn fake_outer_string_serialize(&self, body: Option<models::OuterString>) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>> {
self.api().fake_outer_string_serialize(body, &self.context())
}

View File

@ -69,6 +69,77 @@ impl Animal {
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AnimalFarm(Vec<Animal>);
impl ::std::convert::From<Vec<Animal>> for AnimalFarm {
fn from(x: Vec<Animal>) -> Self {
AnimalFarm(x)
}
}
impl ::std::convert::From<AnimalFarm> for Vec<Animal> {
fn from(x: AnimalFarm) -> Self {
x.0
}
}
impl ::std::iter::FromIterator<Animal> for AnimalFarm {
fn from_iter<U: IntoIterator<Item=Animal>>(u: U) -> Self {
AnimalFarm(Vec::<Animal>::from_iter(u))
}
}
impl ::std::iter::IntoIterator for AnimalFarm {
type Item = Animal;
type IntoIter = ::std::vec::IntoIter<Animal>;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}
impl<'a> ::std::iter::IntoIterator for &'a AnimalFarm {
type Item = &'a Animal;
type IntoIter = ::std::slice::Iter<'a, Animal>;
fn into_iter(self) -> Self::IntoIter {
(&self.0).into_iter()
}
}
impl<'a> ::std::iter::IntoIterator for &'a mut AnimalFarm {
type Item = &'a mut Animal;
type IntoIter = ::std::slice::IterMut<'a, Animal>;
fn into_iter(self) -> Self::IntoIter {
(&mut self.0).into_iter()
}
}
impl ::std::ops::Deref for AnimalFarm {
type Target = Vec<Animal>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl ::std::ops::DerefMut for AnimalFarm {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl AnimalFarm {
/// Helper function to allow us to convert this model to an XML string.
/// Will panic if serialisation fails.
#[allow(dead_code)]
pub(crate) fn to_xml(&self) -> String {
serde_xml_rs::to_string(&self).expect("impossible to fail to serialize")
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ApiResponse {
#[serde(rename = "code")]

View File

@ -313,7 +313,7 @@ where
Ok(body) => {
let mut unused_elements = Vec::new();
let param_body: Option<bool> = if !body.is_empty() {
let param_body: Option<models::OuterBoolean> = if !body.is_empty() {
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
@ -481,7 +481,7 @@ where
Ok(body) => {
let mut unused_elements = Vec::new();
let param_body: Option<f64> = if !body.is_empty() {
let param_body: Option<models::OuterNumber> = if !body.is_empty() {
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
@ -565,7 +565,7 @@ where
Ok(body) => {
let mut unused_elements = Vec::new();
let param_body: Option<String> = if !body.is_empty() {
let param_body: Option<models::OuterString> = if !body.is_empty() {
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);

View File

@ -123,6 +123,7 @@ Method | HTTP request | Description
## Documentation For Models
- [ANullableContainer](docs/ANullableContainer.md)
- [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md)
- [InlineObject](docs/InlineObject.md)
- [ObjectOfObjects](docs/ObjectOfObjects.md)
- [ObjectOfObjectsInner](docs/ObjectOfObjectsInner.md)

View File

@ -32,6 +32,19 @@ impl ANullableContainer {
}
/// An additionalPropertiesObject
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AdditionalPropertiesObject {
}
impl AdditionalPropertiesObject {
pub fn new() -> AdditionalPropertiesObject {
AdditionalPropertiesObject {
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct InlineObject {
#[serde(rename = "id")]