forked from loafle/openapi-generator-original
Add enum support to rust
and skip none option serialization in clients (#2244)
* Add support for enum schemas and properties to the rust generator Also: * Skip serializing a field with serde if it's optional and empty * Fix borrow checker error when using &std::path::Path (should be std::path::PathBuf) * Add script to generate sample with rust-reqwest * Regenerate petstore sample for both rust targets * Remove go code from README.md * Fix formatting of serde skip_serializing_if attribute
This commit is contained in:
parent
c2f5038d75
commit
3df525ee33
@ -123,8 +123,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
// TODO(bcourtine): review file mapping.
|
||||
// I tried to map as "std::io::File", but Reqwest multipart file requires a "AsRef<Path>" param.
|
||||
// Getting a file from a Path is simple, but the opposite is difficult. So I map as "std::path::Path".
|
||||
// Reference is required here because Path does not implement the "Sized" trait.
|
||||
typeMapping.put("file", "&std::path::Path");
|
||||
typeMapping.put("file", "std::path::PathBuf");
|
||||
typeMapping.put("binary", "::models::File");
|
||||
typeMapping.put("ByteArray", "String");
|
||||
typeMapping.put("object", "Value");
|
||||
@ -151,6 +150,12 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
setLibrary(HYPER_LIBRARY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||
// process enum in models
|
||||
return postProcessModelsEnum(objs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
@ -488,25 +493,25 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
@Override
|
||||
public String toEnumVarName(String name, String datatype) {
|
||||
if (name.length() == 0) {
|
||||
return "EMPTY";
|
||||
return "Empty";
|
||||
}
|
||||
|
||||
// number
|
||||
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||
String varName = name;
|
||||
varName = varName.replaceAll("-", "MINUS_");
|
||||
varName = varName.replaceAll("\\+", "PLUS_");
|
||||
varName = varName.replaceAll("\\.", "_DOT_");
|
||||
varName = varName.replaceAll("-", "Minus");
|
||||
varName = varName.replaceAll("\\+", "Plus");
|
||||
varName = varName.replaceAll("\\.", "Dot");
|
||||
return varName;
|
||||
}
|
||||
|
||||
// for symbol, e.g. $, #
|
||||
if (getSymbolName(name) != null) {
|
||||
return getSymbolName(name).toUpperCase(Locale.ROOT);
|
||||
return getSymbolName(name);
|
||||
}
|
||||
|
||||
// string
|
||||
String enumName = sanitizeName(underscore(name).toUpperCase(Locale.ROOT));
|
||||
String enumName = sanitizeName(camelize(name));
|
||||
enumName = enumName.replaceFirst("^_", "");
|
||||
enumName = enumName.replaceFirst("_$", "");
|
||||
|
||||
@ -519,7 +524,9 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
@Override
|
||||
public String toEnumName(CodegenProperty property) {
|
||||
String enumName = underscore(toModelName(property.name)).toUpperCase(Locale.ROOT);
|
||||
// camelize the enum name
|
||||
// phone_number => PhoneNumber
|
||||
String enumName = camelize(toModelName(property.name));
|
||||
|
||||
// remove [] for array or map of enum
|
||||
enumName = enumName.replace("[]", "");
|
||||
|
@ -20,10 +20,10 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||
|
||||
## Installation
|
||||
|
||||
Put the package under your project folder and add the following in import:
|
||||
Put the package under your project folder and add the following to `Cargo.toml` under `[dependencies]`:
|
||||
|
||||
```
|
||||
"./{{{packageName}}}"
|
||||
openapi = { path = "./generated" }
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
@ -40,69 +40,12 @@ Class | Method | HTTP request | Description
|
||||
{{#models}}{{#model}} - [{{{classname}}}]({{{modelDocPath}}}{{{classname}}}.md)
|
||||
{{/model}}{{/models}}
|
||||
|
||||
## Documentation For Authorization
|
||||
|
||||
{{^authMethods}} Endpoints do not require authorization.
|
||||
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
|
||||
{{#authMethods}}
|
||||
|
||||
## {{{name}}}
|
||||
|
||||
{{#isApiKey}}- **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)
|
||||
```
|
||||
{{/isApiKey}}
|
||||
{{#isBasic}}- **Type**: HTTP basic authentication
|
||||
|
||||
Example
|
||||
To get access to the crate's generated documentation, use:
|
||||
|
||||
```
|
||||
auth := context.WithValue(context.TODO(), sw.ContextBasicAuth, sw.BasicAuth{
|
||||
UserName: "username",
|
||||
Password: "password",
|
||||
})
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
cargo doc --open
|
||||
```
|
||||
|
||||
{{/isBasic}}
|
||||
{{#isOAuth}}
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: {{{flow}}}
|
||||
- **Authorization URL**: {{{authorizationUrl}}}
|
||||
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
||||
{{#scopes}} - **{{{scope}}}**: {{{description}}}
|
||||
{{/scopes}}
|
||||
|
||||
Example
|
||||
|
||||
```
|
||||
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"
|
||||
|
||||
/ .. 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)
|
||||
```
|
||||
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
|
||||
## Author
|
||||
|
||||
{{#apiInfo}}{{#apis}}{{^hasMore}}{{{infoEmail}}}
|
||||
|
@ -8,13 +8,28 @@
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
{{!-- for enum schemas --}}
|
||||
{{#isEnum}}
|
||||
/// {{{description}}}
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum {{classname}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
#[serde(rename = "{{{value}}}")]
|
||||
{{name}},
|
||||
{{/enumVars}}{{/allowableValues}}
|
||||
}
|
||||
{{/isEnum}}
|
||||
|
||||
{{!-- for non-enum schemas --}}
|
||||
{{^isEnum}}
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct {{{classname}}} {
|
||||
{{#vars}}
|
||||
{{#description}}
|
||||
/// {{{description}}}
|
||||
{{/description}}
|
||||
#[serde(rename = "{{{baseName}}}")]
|
||||
#[serde(rename = "{{{baseName}}}"{{^required}}, skip_serializing_if = "Option::is_none"{{/required}})]
|
||||
pub {{{name}}}: {{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{^required}}Option<{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^required}}>{{/required}},
|
||||
{{/vars}}
|
||||
}
|
||||
@ -31,16 +46,23 @@ impl {{{classname}}} {
|
||||
}
|
||||
}
|
||||
}
|
||||
{{#isEnum}}
|
||||
// TODO enum
|
||||
// List of {{{name}}}
|
||||
//const (
|
||||
// {{#allowableValues}}
|
||||
// {{#enumVars}}
|
||||
// {{{name}}} {{{classname}}} = "{{{value}}}"
|
||||
// {{/enumVars}}
|
||||
// {{/allowableValues}}
|
||||
//)
|
||||
{{/isEnum}}
|
||||
|
||||
{{!-- for properties that are of enum type --}}
|
||||
{{#vars}}
|
||||
{{#isEnum}}
|
||||
/// {{{description}}}
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum {{enumName}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
#[serde(rename = "{{{value}}}")]
|
||||
{{name}},
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
{{/isEnum}}
|
||||
{{/vars}}
|
||||
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
|
@ -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,9 +11,11 @@ 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:
|
||||
|
||||
Put the package under your project folder and add the following to `Cargo.toml` under `[dependencies]`:
|
||||
|
||||
```
|
||||
"./petstore_client"
|
||||
openapi = { path = "./generated" }
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
@ -53,42 +56,10 @@ Class | Method | HTTP request | Description
|
||||
- [User](docs/User.md)
|
||||
|
||||
|
||||
## Documentation For Authorization
|
||||
To get access to the crate's generated documentation, use:
|
||||
|
||||
## api_key
|
||||
- **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
|
||||
- **Scopes**:
|
||||
- **write:pets**: modify pets in your account
|
||||
- **read:pets**: read your pets
|
||||
|
||||
Example
|
||||
```
|
||||
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"
|
||||
|
||||
/ .. 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)
|
||||
cargo doc --open
|
||||
```
|
||||
|
||||
## Author
|
||||
|
@ -1,6 +1,7 @@
|
||||
# ApiResponse
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**code** | **i32** | | [optional]
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Category
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **i64** | | [optional]
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Order
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **i64** | | [optional]
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Pet
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **i64** | | [optional]
|
||||
|
@ -14,12 +14,15 @@ Method | HTTP request | Description
|
||||
[**upload_file**](PetApi.md#upload_file) | **post** /pet/{petId}/uploadImage | uploads an image
|
||||
|
||||
|
||||
# **add_pet**
|
||||
|
||||
## add_pet
|
||||
|
||||
> add_pet(ctx, body)
|
||||
Add a new pet to the store
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
|
||||
@ -40,12 +43,15 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **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
|
||||
@ -75,7 +82,9 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **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
|
||||
@ -103,7 +113,9 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **find_pets_by_tags**
|
||||
|
||||
## find_pets_by_tags
|
||||
|
||||
> Vec<::models::Pet> find_pets_by_tags(ctx, tags)
|
||||
Finds Pets by tags
|
||||
|
||||
@ -111,6 +123,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
|
||||
@ -131,7 +144,9 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **get_pet_by_id**
|
||||
|
||||
## get_pet_by_id
|
||||
|
||||
> ::models::Pet get_pet_by_id(ctx, pet_id)
|
||||
Find pet by ID
|
||||
|
||||
@ -139,6 +154,7 @@ Returns a single pet
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
|
||||
@ -159,12 +175,15 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **update_pet**
|
||||
|
||||
## update_pet
|
||||
|
||||
> update_pet(ctx, body)
|
||||
Update an existing pet
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
|
||||
@ -185,12 +204,15 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **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 +220,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
|
||||
@ -221,12 +244,15 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **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,13 +260,14 @@ 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
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **i64**| ID of pet to update |
|
||||
**additional_metadata** | **String**| Additional data to pass to server |
|
||||
**file** | **&std::path::Path**| file to upload |
|
||||
**file** | **std::path::PathBuf**| file to upload |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -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 |
|
||||
@ -37,13 +40,16 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **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
|
||||
@ -61,7 +67,9 @@ This endpoint does not need any parameter.
|
||||
|
||||
[[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 |
|
||||
@ -88,12 +97,15 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **place_order**
|
||||
|
||||
## place_order
|
||||
|
||||
> ::models::Order place_order(body)
|
||||
Place an order for a pet
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Tag
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **i64** | | [optional]
|
||||
|
@ -1,6 +1,7 @@
|
||||
# User
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **i64** | | [optional]
|
||||
|
@ -14,7 +14,9 @@ Method | HTTP request | Description
|
||||
[**update_user**](UserApi.md#update_user) | **put** /user/{username} | Updated user
|
||||
|
||||
|
||||
# **create_user**
|
||||
|
||||
## create_user
|
||||
|
||||
> create_user(body)
|
||||
Create user
|
||||
|
||||
@ -22,6 +24,7 @@ This can only be done by the logged in user.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**User**](User.md)| Created user object |
|
||||
@ -41,12 +44,15 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **create_users_with_array_input**
|
||||
|
||||
## create_users_with_array_input
|
||||
|
||||
> create_users_with_array_input(body)
|
||||
Creates list of users with given input array
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Vec<::models::User>**](array.md)| List of user object |
|
||||
@ -66,12 +72,15 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **create_users_with_list_input**
|
||||
|
||||
## create_users_with_list_input
|
||||
|
||||
> create_users_with_list_input(body)
|
||||
Creates list of users with given input array
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Vec<::models::User>**](array.md)| List of user object |
|
||||
@ -91,7 +100,9 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **delete_user**
|
||||
|
||||
## delete_user
|
||||
|
||||
> delete_user(username)
|
||||
Delete user
|
||||
|
||||
@ -99,6 +110,7 @@ This can only be done by the logged in user.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be deleted |
|
||||
@ -118,12 +130,15 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **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. |
|
||||
@ -143,12 +158,15 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **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 |
|
||||
@ -169,11 +187,14 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **logout_user**
|
||||
|
||||
## logout_user
|
||||
|
||||
> logout_user()
|
||||
Logs out current logged in user session
|
||||
|
||||
### Required Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
@ -191,7 +212,9 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **update_user**
|
||||
|
||||
## update_user
|
||||
|
||||
> update_user(username, body)
|
||||
Updated user
|
||||
|
||||
@ -199,6 +222,7 @@ This can only be done by the logged in user.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
|
@ -4,7 +4,7 @@
|
||||
<artifactId>RustReqwestPetstoreClientTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>Rust Reqwest Petstore Client</name>
|
||||
<name>Rust (reqwest) Petstore Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
@ -35,7 +35,7 @@ pub trait PetApi {
|
||||
fn get_pet_by_id(&self, pet_id: i64) -> Result<::models::Pet, Error>;
|
||||
fn update_pet(&self, body: ::models::Pet) -> Result<(), Error>;
|
||||
fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Result<(), Error>;
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: &std::path::Path) -> Result<::models::ApiResponse, Error>;
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Result<::models::ApiResponse, Error>;
|
||||
}
|
||||
|
||||
impl PetApi for PetApiClient {
|
||||
@ -197,7 +197,7 @@ impl PetApi for PetApiClient {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: &std::path::Path) -> Result<::models::ApiResponse, Error> {
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Result<::models::ApiResponse, Error> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
|
@ -13,13 +13,14 @@
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct ApiResponse {
|
||||
#[serde(rename = "code")]
|
||||
#[serde(rename = "code", skip_serializing_if = "Option::is_none")]
|
||||
pub code: Option<i32>,
|
||||
#[serde(rename = "type")]
|
||||
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
|
||||
pub _type: Option<String>,
|
||||
#[serde(rename = "message")]
|
||||
#[serde(rename = "message", skip_serializing_if = "Option::is_none")]
|
||||
pub message: Option<String>,
|
||||
}
|
||||
|
||||
@ -33,3 +34,5 @@ impl ApiResponse {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,11 +13,12 @@
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Category {
|
||||
#[serde(rename = "id")]
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<i64>,
|
||||
#[serde(rename = "name")]
|
||||
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<String>,
|
||||
}
|
||||
|
||||
@ -30,3 +31,5 @@ impl Category {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,20 +13,21 @@
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Order {
|
||||
#[serde(rename = "id")]
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<i64>,
|
||||
#[serde(rename = "petId")]
|
||||
#[serde(rename = "petId", skip_serializing_if = "Option::is_none")]
|
||||
pub pet_id: Option<i64>,
|
||||
#[serde(rename = "quantity")]
|
||||
#[serde(rename = "quantity", skip_serializing_if = "Option::is_none")]
|
||||
pub quantity: Option<i32>,
|
||||
#[serde(rename = "shipDate")]
|
||||
#[serde(rename = "shipDate", skip_serializing_if = "Option::is_none")]
|
||||
pub ship_date: Option<String>,
|
||||
/// Order Status
|
||||
#[serde(rename = "status")]
|
||||
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
|
||||
pub status: Option<String>,
|
||||
#[serde(rename = "complete")]
|
||||
#[serde(rename = "complete", skip_serializing_if = "Option::is_none")]
|
||||
pub complete: Option<bool>,
|
||||
}
|
||||
|
||||
@ -43,3 +44,15 @@ impl Order {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Order Status
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum Status {
|
||||
#[serde(rename = "placed")]
|
||||
Placed,
|
||||
#[serde(rename = "approved")]
|
||||
Approved,
|
||||
#[serde(rename = "delivered")]
|
||||
Delivered,
|
||||
}
|
||||
|
||||
|
@ -13,20 +13,21 @@
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Pet {
|
||||
#[serde(rename = "id")]
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<i64>,
|
||||
#[serde(rename = "category")]
|
||||
#[serde(rename = "category", skip_serializing_if = "Option::is_none")]
|
||||
pub category: Option<::models::Category>,
|
||||
#[serde(rename = "name")]
|
||||
pub name: String,
|
||||
#[serde(rename = "photoUrls")]
|
||||
pub photo_urls: Vec<String>,
|
||||
#[serde(rename = "tags")]
|
||||
#[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
|
||||
pub tags: Option<Vec<::models::Tag>>,
|
||||
/// pet status in the store
|
||||
#[serde(rename = "status")]
|
||||
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
|
||||
pub status: Option<String>,
|
||||
}
|
||||
|
||||
@ -43,3 +44,15 @@ impl Pet {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// pet status in the store
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum Status {
|
||||
#[serde(rename = "available")]
|
||||
Available,
|
||||
#[serde(rename = "pending")]
|
||||
Pending,
|
||||
#[serde(rename = "sold")]
|
||||
Sold,
|
||||
}
|
||||
|
||||
|
@ -13,11 +13,12 @@
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Tag {
|
||||
#[serde(rename = "id")]
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<i64>,
|
||||
#[serde(rename = "name")]
|
||||
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<String>,
|
||||
}
|
||||
|
||||
@ -30,3 +31,5 @@ impl Tag {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,24 +13,25 @@
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct User {
|
||||
#[serde(rename = "id")]
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<i64>,
|
||||
#[serde(rename = "username")]
|
||||
#[serde(rename = "username", skip_serializing_if = "Option::is_none")]
|
||||
pub username: Option<String>,
|
||||
#[serde(rename = "firstName")]
|
||||
#[serde(rename = "firstName", skip_serializing_if = "Option::is_none")]
|
||||
pub first_name: Option<String>,
|
||||
#[serde(rename = "lastName")]
|
||||
#[serde(rename = "lastName", skip_serializing_if = "Option::is_none")]
|
||||
pub last_name: Option<String>,
|
||||
#[serde(rename = "email")]
|
||||
#[serde(rename = "email", skip_serializing_if = "Option::is_none")]
|
||||
pub email: Option<String>,
|
||||
#[serde(rename = "password")]
|
||||
#[serde(rename = "password", skip_serializing_if = "Option::is_none")]
|
||||
pub password: Option<String>,
|
||||
#[serde(rename = "phone")]
|
||||
#[serde(rename = "phone", skip_serializing_if = "Option::is_none")]
|
||||
pub phone: Option<String>,
|
||||
/// User Status
|
||||
#[serde(rename = "userStatus")]
|
||||
#[serde(rename = "userStatus", skip_serializing_if = "Option::is_none")]
|
||||
pub user_status: Option<i32>,
|
||||
}
|
||||
|
||||
@ -49,3 +50,5 @@ impl User {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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,9 +11,11 @@ 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:
|
||||
|
||||
Put the package under your project folder and add the following to `Cargo.toml` under `[dependencies]`:
|
||||
|
||||
```
|
||||
"./petstore_client"
|
||||
openapi = { path = "./generated" }
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
@ -53,42 +56,10 @@ Class | Method | HTTP request | Description
|
||||
- [User](docs/User.md)
|
||||
|
||||
|
||||
## Documentation For Authorization
|
||||
To get access to the crate's generated documentation, use:
|
||||
|
||||
## api_key
|
||||
- **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
|
||||
- **Scopes**:
|
||||
- **write:pets**: modify pets in your account
|
||||
- **read:pets**: read your pets
|
||||
|
||||
Example
|
||||
```
|
||||
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"
|
||||
|
||||
/ .. 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)
|
||||
cargo doc --open
|
||||
```
|
||||
|
||||
## Author
|
||||
|
@ -1,6 +1,7 @@
|
||||
# ApiResponse
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**code** | **i32** | | [optional]
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Category
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **i64** | | [optional]
|
||||
|
@ -1,11 +0,0 @@
|
||||
# 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)
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
# InlineObject1
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**additional_metadata** | **String** | Additional data to pass to server | [optional]
|
||||
**file** | [***&std::path::Path**](&std::path::Path.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)
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Order
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **i64** | | [optional]
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Pet
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **i64** | | [optional]
|
||||
|
@ -14,12 +14,15 @@ Method | HTTP request | Description
|
||||
[**upload_file**](PetApi.md#upload_file) | **Post** /pet/{petId}/uploadImage | uploads an image
|
||||
|
||||
|
||||
# **add_pet**
|
||||
|
||||
## add_pet
|
||||
|
||||
> add_pet(ctx, body)
|
||||
Add a new pet to the store
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
|
||||
@ -40,12 +43,15 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **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
|
||||
@ -75,7 +82,9 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **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
|
||||
@ -103,7 +113,9 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **find_pets_by_tags**
|
||||
|
||||
## find_pets_by_tags
|
||||
|
||||
> Vec<::models::Pet> find_pets_by_tags(ctx, tags)
|
||||
Finds Pets by tags
|
||||
|
||||
@ -111,6 +123,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
|
||||
@ -131,7 +144,9 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **get_pet_by_id**
|
||||
|
||||
## get_pet_by_id
|
||||
|
||||
> ::models::Pet get_pet_by_id(ctx, pet_id)
|
||||
Find pet by ID
|
||||
|
||||
@ -139,6 +154,7 @@ Returns a single pet
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
|
||||
@ -159,12 +175,15 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **update_pet**
|
||||
|
||||
## update_pet
|
||||
|
||||
> update_pet(ctx, body)
|
||||
Update an existing pet
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
|
||||
@ -185,12 +204,15 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **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 +220,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
|
||||
@ -221,12 +244,15 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **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,13 +260,14 @@ 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
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **i64**| ID of pet to update |
|
||||
**additional_metadata** | **String**| Additional data to pass to server |
|
||||
**file** | **&std::path::Path**| file to upload |
|
||||
**file** | **std::path::PathBuf**| file to upload |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -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 |
|
||||
@ -37,13 +40,16 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **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
|
||||
@ -61,7 +67,9 @@ This endpoint does not need any parameter.
|
||||
|
||||
[[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 |
|
||||
@ -88,12 +97,15 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **place_order**
|
||||
|
||||
## place_order
|
||||
|
||||
> ::models::Order place_order(body)
|
||||
Place an order for a pet
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Tag
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **i64** | | [optional]
|
||||
|
@ -1,6 +1,7 @@
|
||||
# User
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **i64** | | [optional]
|
||||
|
@ -14,7 +14,9 @@ Method | HTTP request | Description
|
||||
[**update_user**](UserApi.md#update_user) | **Put** /user/{username} | Updated user
|
||||
|
||||
|
||||
# **create_user**
|
||||
|
||||
## create_user
|
||||
|
||||
> create_user(body)
|
||||
Create user
|
||||
|
||||
@ -22,6 +24,7 @@ This can only be done by the logged in user.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**User**](User.md)| Created user object |
|
||||
@ -41,12 +44,15 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **create_users_with_array_input**
|
||||
|
||||
## create_users_with_array_input
|
||||
|
||||
> create_users_with_array_input(body)
|
||||
Creates list of users with given input array
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Vec<::models::User>**](array.md)| List of user object |
|
||||
@ -66,12 +72,15 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **create_users_with_list_input**
|
||||
|
||||
## create_users_with_list_input
|
||||
|
||||
> create_users_with_list_input(body)
|
||||
Creates list of users with given input array
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Vec<::models::User>**](array.md)| List of user object |
|
||||
@ -91,7 +100,9 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **delete_user**
|
||||
|
||||
## delete_user
|
||||
|
||||
> delete_user(username)
|
||||
Delete user
|
||||
|
||||
@ -99,6 +110,7 @@ This can only be done by the logged in user.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be deleted |
|
||||
@ -118,12 +130,15 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **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. |
|
||||
@ -143,12 +158,15 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **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 |
|
||||
@ -169,11 +187,14 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **logout_user**
|
||||
|
||||
## logout_user
|
||||
|
||||
> logout_user()
|
||||
Logs out current logged in user session
|
||||
|
||||
### Required Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
@ -191,7 +212,9 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **update_user**
|
||||
|
||||
## update_user
|
||||
|
||||
> update_user(username, body)
|
||||
Updated user
|
||||
|
||||
@ -199,6 +222,7 @@ This can only be done by the logged in user.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
|
@ -1,39 +0,0 @@
|
||||
extern crate futures;
|
||||
extern crate hyper;
|
||||
extern crate petstore_client;
|
||||
extern crate tokio_core;
|
||||
|
||||
use futures::Future;
|
||||
use hyper::client::HttpConnector;
|
||||
use hyper::Client;
|
||||
use tokio_core::reactor::Core;
|
||||
|
||||
fn main() {
|
||||
let mut core = Core::new().expect("failed to init core");
|
||||
let handle = core.handle();
|
||||
|
||||
let apicli = petstore_client::apis::client::APIClient::new(
|
||||
petstore_client::apis::configuration::Configuration::new(
|
||||
Client::configure()
|
||||
.connector(HttpConnector::new(4, &handle))
|
||||
.build(&handle),
|
||||
),
|
||||
);
|
||||
|
||||
let new_pet = petstore_client::models::Pet::new("ferris".to_owned(), vec![]).with_id(128149);
|
||||
let work = apicli
|
||||
.pet_api()
|
||||
.add_pet(new_pet)
|
||||
.and_then(|_| {
|
||||
apicli
|
||||
.pet_api()
|
||||
.update_pet_with_form(128149, "ferris", "rusted")
|
||||
})
|
||||
.and_then(|_| apicli.pet_api().get_pet_by_id(128149))
|
||||
.and_then(|pet| {
|
||||
println!("pet: {:?}", pet);
|
||||
futures::future::ok(())
|
||||
});
|
||||
|
||||
core.run(work).expect("failed to run core");
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
extern crate futures;
|
||||
extern crate hyper;
|
||||
extern crate petstore_client;
|
||||
extern crate tokio_core;
|
||||
|
||||
use futures::Future;
|
||||
use hyper::client::HttpConnector;
|
||||
use hyper::Client;
|
||||
use petstore_client::apis::client::APIClient;
|
||||
use petstore_client::apis::Error;
|
||||
use tokio_core::reactor::Core;
|
||||
|
||||
fn main() {
|
||||
let mut core = Core::new().expect("failed to init core");
|
||||
let handle = core.handle();
|
||||
|
||||
let mut configuration = petstore_client::apis::configuration::Configuration::new(
|
||||
Client::configure()
|
||||
.connector(HttpConnector::new(4, &handle))
|
||||
.build(&handle),
|
||||
);
|
||||
if let Ok(env_override) = std::env::var("PETSTORE_BASEPATH") {
|
||||
configuration.base_path = env_override;
|
||||
}
|
||||
|
||||
let apicli = APIClient::new(configuration);
|
||||
let work = apicli
|
||||
.user_api()
|
||||
.delete_user("404")
|
||||
.then(|resp| match resp {
|
||||
Ok(resp) => {
|
||||
panic!(format!(
|
||||
"update for nonexistent pet should fail, but got: {:?}",
|
||||
resp
|
||||
));
|
||||
}
|
||||
Err(Error::ApiError(s)) => {
|
||||
println!("got expected error: {:?}", s);
|
||||
futures::future::ok::<(), ()>(())
|
||||
}
|
||||
Err(Error::Hyper(e)) => {
|
||||
println!("network error: {}", e);
|
||||
futures::future::ok::<(), ()>(())
|
||||
}
|
||||
Err(e) => panic!("unexpected error: {:?}", e),
|
||||
});
|
||||
|
||||
core.run(work).expect("failed to run core");
|
||||
}
|
@ -38,7 +38,7 @@ pub trait PetApi {
|
||||
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_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>>>;
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Box<Future<Item = ::models::ApiResponse, Error = Error<serde_json::Value>>>;
|
||||
}
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
|
||||
.execute(self.configuration.borrow())
|
||||
}
|
||||
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: &std::path::Path) -> Box<Future<Item = ::models::ApiResponse, Error = Error<serde_json::Value>>> {
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Box<Future<Item = ::models::ApiResponse, Error = Error<serde_json::Value>>> {
|
||||
__internal_request::Request::new(hyper::Method::Post, "/pet/{petId}/uploadImage".to_string())
|
||||
.with_auth(__internal_request::Auth::Oauth)
|
||||
.with_path_param("petId".to_string(), pet_id.to_string())
|
||||
|
@ -13,13 +13,14 @@
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct ApiResponse {
|
||||
#[serde(rename = "code")]
|
||||
#[serde(rename = "code", skip_serializing_if = "Option::is_none")]
|
||||
pub code: Option<i32>,
|
||||
#[serde(rename = "type")]
|
||||
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
|
||||
pub _type: Option<String>,
|
||||
#[serde(rename = "message")]
|
||||
#[serde(rename = "message", skip_serializing_if = "Option::is_none")]
|
||||
pub message: Option<String>,
|
||||
}
|
||||
|
||||
@ -33,3 +34,5 @@ impl ApiResponse {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,11 +13,12 @@
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Category {
|
||||
#[serde(rename = "id")]
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<i64>,
|
||||
#[serde(rename = "name")]
|
||||
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<String>,
|
||||
}
|
||||
|
||||
@ -30,3 +31,5 @@ impl Category {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct InlineObject {
|
||||
/// Updated name of the pet
|
||||
#[serde(rename = "name")]
|
||||
pub name: Option<String>,
|
||||
/// Updated status of the pet
|
||||
#[serde(rename = "status")]
|
||||
pub status: Option<String>,
|
||||
}
|
||||
|
||||
impl InlineObject {
|
||||
pub fn new() -> InlineObject {
|
||||
InlineObject {
|
||||
name: None,
|
||||
status: None,
|
||||
}
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct InlineObject1 {
|
||||
/// Additional data to pass to server
|
||||
#[serde(rename = "additionalMetadata")]
|
||||
pub additional_metadata: Option<String>,
|
||||
/// file to upload
|
||||
#[serde(rename = "file")]
|
||||
pub file: Option<&std::path::Path>,
|
||||
}
|
||||
|
||||
impl InlineObject1 {
|
||||
pub fn new() -> InlineObject1 {
|
||||
InlineObject1 {
|
||||
additional_metadata: None,
|
||||
file: None,
|
||||
}
|
||||
}
|
||||
}
|
@ -13,20 +13,21 @@
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Order {
|
||||
#[serde(rename = "id")]
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<i64>,
|
||||
#[serde(rename = "petId")]
|
||||
#[serde(rename = "petId", skip_serializing_if = "Option::is_none")]
|
||||
pub pet_id: Option<i64>,
|
||||
#[serde(rename = "quantity")]
|
||||
#[serde(rename = "quantity", skip_serializing_if = "Option::is_none")]
|
||||
pub quantity: Option<i32>,
|
||||
#[serde(rename = "shipDate")]
|
||||
#[serde(rename = "shipDate", skip_serializing_if = "Option::is_none")]
|
||||
pub ship_date: Option<String>,
|
||||
/// Order Status
|
||||
#[serde(rename = "status")]
|
||||
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
|
||||
pub status: Option<String>,
|
||||
#[serde(rename = "complete")]
|
||||
#[serde(rename = "complete", skip_serializing_if = "Option::is_none")]
|
||||
pub complete: Option<bool>,
|
||||
}
|
||||
|
||||
@ -43,3 +44,15 @@ impl Order {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Order Status
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum Status {
|
||||
#[serde(rename = "placed")]
|
||||
Placed,
|
||||
#[serde(rename = "approved")]
|
||||
Approved,
|
||||
#[serde(rename = "delivered")]
|
||||
Delivered,
|
||||
}
|
||||
|
||||
|
@ -13,20 +13,21 @@
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Pet {
|
||||
#[serde(rename = "id")]
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<i64>,
|
||||
#[serde(rename = "category")]
|
||||
#[serde(rename = "category", skip_serializing_if = "Option::is_none")]
|
||||
pub category: Option<::models::Category>,
|
||||
#[serde(rename = "name")]
|
||||
pub name: String,
|
||||
#[serde(rename = "photoUrls")]
|
||||
pub photo_urls: Vec<String>,
|
||||
#[serde(rename = "tags")]
|
||||
#[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
|
||||
pub tags: Option<Vec<::models::Tag>>,
|
||||
/// pet status in the store
|
||||
#[serde(rename = "status")]
|
||||
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
|
||||
pub status: Option<String>,
|
||||
}
|
||||
|
||||
@ -43,3 +44,15 @@ impl Pet {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// pet status in the store
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum Status {
|
||||
#[serde(rename = "available")]
|
||||
Available,
|
||||
#[serde(rename = "pending")]
|
||||
Pending,
|
||||
#[serde(rename = "sold")]
|
||||
Sold,
|
||||
}
|
||||
|
||||
|
@ -13,11 +13,12 @@
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Tag {
|
||||
#[serde(rename = "id")]
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<i64>,
|
||||
#[serde(rename = "name")]
|
||||
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<String>,
|
||||
}
|
||||
|
||||
@ -30,3 +31,5 @@ impl Tag {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,24 +13,25 @@
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct User {
|
||||
#[serde(rename = "id")]
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<i64>,
|
||||
#[serde(rename = "username")]
|
||||
#[serde(rename = "username", skip_serializing_if = "Option::is_none")]
|
||||
pub username: Option<String>,
|
||||
#[serde(rename = "firstName")]
|
||||
#[serde(rename = "firstName", skip_serializing_if = "Option::is_none")]
|
||||
pub first_name: Option<String>,
|
||||
#[serde(rename = "lastName")]
|
||||
#[serde(rename = "lastName", skip_serializing_if = "Option::is_none")]
|
||||
pub last_name: Option<String>,
|
||||
#[serde(rename = "email")]
|
||||
#[serde(rename = "email", skip_serializing_if = "Option::is_none")]
|
||||
pub email: Option<String>,
|
||||
#[serde(rename = "password")]
|
||||
#[serde(rename = "password", skip_serializing_if = "Option::is_none")]
|
||||
pub password: Option<String>,
|
||||
#[serde(rename = "phone")]
|
||||
#[serde(rename = "phone", skip_serializing_if = "Option::is_none")]
|
||||
pub phone: Option<String>,
|
||||
/// User Status
|
||||
#[serde(rename = "userStatus")]
|
||||
#[serde(rename = "userStatus", skip_serializing_if = "Option::is_none")]
|
||||
pub user_status: Option<i32>,
|
||||
}
|
||||
|
||||
@ -49,3 +50,5 @@ impl User {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user