From 0509909a20bfac14f2983d66a7bf8186c2cc7744 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 10 May 2025 20:36:58 -0700 Subject: [PATCH] [rust] add tests for rust deep objects --- .../src/test/resources/3_0/rust/petstore.yaml | 62 ++++++++++ .../hyper/petstore/.openapi-generator/FILES | 2 + .../petstore/rust/hyper/petstore/README.md | 3 + .../petstore/rust/hyper/petstore/docs/Page.md | 12 ++ .../rust/hyper/petstore/docs/PetApi.md | 62 ++++++++++ .../PetsExplodePostPageExplodeParameter.md | 12 ++ .../docs/PetsExplodePostPageParameter.md | 12 ++ .../rust/hyper/petstore/src/apis/pet_api.rs | 26 ++++ ...ets_explode_post_page_explode_parameter.rs | 32 +++++ .../_pets_explode_post_page_parameter.rs | 32 +++++ .../rust/hyper/petstore/src/models/mod.rs | 2 + .../rust/hyper/petstore/src/models/page.rs | 30 +++++ .../hyper0x/petstore/.openapi-generator/FILES | 2 + .../petstore/rust/hyper0x/petstore/README.md | 3 + .../rust/hyper0x/petstore/docs/Page.md | 12 ++ .../rust/hyper0x/petstore/docs/PetApi.md | 62 ++++++++++ .../PetsExplodePostPageExplodeParameter.md | 12 ++ .../docs/PetsExplodePostPageParameter.md | 12 ++ .../rust/hyper0x/petstore/src/apis/pet_api.rs | 26 ++++ ...ets_explode_post_page_explode_parameter.rs | 32 +++++ .../_pets_explode_post_page_parameter.rs | 32 +++++ .../rust/hyper0x/petstore/src/models/mod.rs | 2 + .../rust/hyper0x/petstore/src/models/page.rs | 30 +++++ .../petstore/.openapi-generator/FILES | 2 + .../rust/reqwest-trait/petstore/README.md | 3 + .../rust/reqwest-trait/petstore/docs/Page.md | 12 ++ .../reqwest-trait/petstore/docs/PetApi.md | 62 ++++++++++ .../PetsExplodePostPageExplodeParameter.md | 12 ++ .../docs/PetsExplodePostPageParameter.md | 12 ++ .../petstore/src/apis/fake_api.rs | 4 +- .../petstore/src/apis/pet_api.rs | 115 +++++++++++++++++- ...ets_explode_post_page_explode_parameter.rs | 32 +++++ .../_pets_explode_post_page_parameter.rs | 32 +++++ .../reqwest-trait/petstore/src/models/mod.rs | 2 + .../reqwest-trait/petstore/src/models/page.rs | 30 +++++ .../.openapi-generator/FILES | 2 + .../petstore-async-middleware/README.md | 3 + .../petstore-async-middleware/docs/Page.md | 12 ++ .../petstore-async-middleware/docs/PetApi.md | 62 ++++++++++ .../PetsExplodePostPageExplodeParameter.md | 12 ++ .../docs/PetsExplodePostPageParameter.md | 12 ++ .../src/apis/pet_api.rs | 104 ++++++++++++++++ ...ets_explode_post_page_explode_parameter.rs | 32 +++++ .../_pets_explode_post_page_parameter.rs | 32 +++++ .../src/models/mod.rs | 2 + .../src/models/page.rs | 30 +++++ .../.openapi-generator/FILES | 2 + .../petstore-async-tokensource/README.md | 3 + .../petstore-async-tokensource/docs/Page.md | 12 ++ .../petstore-async-tokensource/docs/PetApi.md | 62 ++++++++++ .../PetsExplodePostPageExplodeParameter.md | 12 ++ .../docs/PetsExplodePostPageParameter.md | 12 ++ .../src/apis/pet_api.rs | 104 ++++++++++++++++ ...ets_explode_post_page_explode_parameter.rs | 32 +++++ .../_pets_explode_post_page_parameter.rs | 32 +++++ .../src/models/mod.rs | 2 + .../src/models/page.rs | 30 +++++ .../petstore-async/.openapi-generator/FILES | 2 + .../rust/reqwest/petstore-async/README.md | 3 + .../rust/reqwest/petstore-async/docs/Page.md | 12 ++ .../reqwest/petstore-async/docs/PetApi.md | 62 ++++++++++ .../PetsExplodePostPageExplodeParameter.md | 12 ++ .../docs/PetsExplodePostPageParameter.md | 12 ++ .../petstore-async/src/apis/pet_api.rs | 104 ++++++++++++++++ ...ets_explode_post_page_explode_parameter.rs | 32 +++++ .../_pets_explode_post_page_parameter.rs | 32 +++++ .../reqwest/petstore-async/src/models/mod.rs | 2 + .../reqwest/petstore-async/src/models/page.rs | 30 +++++ .../.openapi-generator/FILES | 2 + .../rust/reqwest/petstore-avoid-box/README.md | 3 + .../reqwest/petstore-avoid-box/docs/Page.md | 12 ++ .../reqwest/petstore-avoid-box/docs/PetApi.md | 62 ++++++++++ .../PetsExplodePostPageExplodeParameter.md | 12 ++ .../docs/PetsExplodePostPageParameter.md | 12 ++ .../petstore-avoid-box/src/apis/pet_api.rs | 104 ++++++++++++++++ ...ets_explode_post_page_explode_parameter.rs | 32 +++++ .../_pets_explode_post_page_parameter.rs | 32 +++++ .../petstore-avoid-box/src/models/mod.rs | 2 + .../petstore-avoid-box/src/models/page.rs | 30 +++++ .../.openapi-generator/FILES | 2 + .../reqwest/petstore-awsv4signature/README.md | 3 + .../petstore-awsv4signature/docs/Page.md | 12 ++ .../petstore-awsv4signature/docs/PetApi.md | 62 ++++++++++ .../PetsExplodePostPageExplodeParameter.md | 12 ++ .../docs/PetsExplodePostPageParameter.md | 12 ++ .../src/apis/pet_api.rs | 96 +++++++++++++++ ...ets_explode_post_page_explode_parameter.rs | 32 +++++ .../_pets_explode_post_page_parameter.rs | 32 +++++ .../petstore-awsv4signature/src/models/mod.rs | 2 + .../src/models/page.rs | 30 +++++ .../.openapi-generator/FILES | 2 + .../petstore-model-name-prefix/README.md | 3 + .../docs/FooPage.md | 12 ++ .../FooPetsExplodePostPageExplodeParameter.md | 12 ++ .../docs/FooPetsExplodePostPageParameter.md | 12 ++ .../petstore-model-name-prefix/docs/PetApi.md | 62 ++++++++++ .../src/apis/pet_api.rs | 96 +++++++++++++++ ...ets_explode_post_page_explode_parameter.rs | 32 +++++ .../foo__pets_explode_post_page_parameter.rs | 32 +++++ .../src/models/foo_page.rs | 30 +++++ .../src/models/mod.rs | 2 + .../reqwest/petstore/.openapi-generator/FILES | 2 + .../petstore/rust/reqwest/petstore/README.md | 3 + .../rust/reqwest/petstore/docs/Page.md | 12 ++ .../rust/reqwest/petstore/docs/PetApi.md | 62 ++++++++++ .../PetsExplodePostPageExplodeParameter.md | 12 ++ .../docs/PetsExplodePostPageParameter.md | 12 ++ .../rust/reqwest/petstore/src/apis/pet_api.rs | 96 +++++++++++++++ ...ets_explode_post_page_explode_parameter.rs | 32 +++++ .../_pets_explode_post_page_parameter.rs | 32 +++++ .../rust/reqwest/petstore/src/models/mod.rs | 2 + .../rust/reqwest/petstore/src/models/page.rs | 30 +++++ 112 files changed, 2922 insertions(+), 5 deletions(-) create mode 100644 samples/client/petstore/rust/hyper/petstore/docs/Page.md create mode 100644 samples/client/petstore/rust/hyper/petstore/docs/PetsExplodePostPageExplodeParameter.md create mode 100644 samples/client/petstore/rust/hyper/petstore/docs/PetsExplodePostPageParameter.md create mode 100644 samples/client/petstore/rust/hyper/petstore/src/models/_pets_explode_post_page_explode_parameter.rs create mode 100644 samples/client/petstore/rust/hyper/petstore/src/models/_pets_explode_post_page_parameter.rs create mode 100644 samples/client/petstore/rust/hyper/petstore/src/models/page.rs create mode 100644 samples/client/petstore/rust/hyper0x/petstore/docs/Page.md create mode 100644 samples/client/petstore/rust/hyper0x/petstore/docs/PetsExplodePostPageExplodeParameter.md create mode 100644 samples/client/petstore/rust/hyper0x/petstore/docs/PetsExplodePostPageParameter.md create mode 100644 samples/client/petstore/rust/hyper0x/petstore/src/models/_pets_explode_post_page_explode_parameter.rs create mode 100644 samples/client/petstore/rust/hyper0x/petstore/src/models/_pets_explode_post_page_parameter.rs create mode 100644 samples/client/petstore/rust/hyper0x/petstore/src/models/page.rs create mode 100644 samples/client/petstore/rust/reqwest-trait/petstore/docs/Page.md create mode 100644 samples/client/petstore/rust/reqwest-trait/petstore/docs/PetsExplodePostPageExplodeParameter.md create mode 100644 samples/client/petstore/rust/reqwest-trait/petstore/docs/PetsExplodePostPageParameter.md create mode 100644 samples/client/petstore/rust/reqwest-trait/petstore/src/models/_pets_explode_post_page_explode_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest-trait/petstore/src/models/_pets_explode_post_page_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest-trait/petstore/src/models/page.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/Page.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetsExplodePostPageExplodeParameter.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetsExplodePostPageParameter.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/_pets_explode_post_page_explode_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/_pets_explode_post_page_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/page.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/Page.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetsExplodePostPageExplodeParameter.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetsExplodePostPageParameter.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/_pets_explode_post_page_explode_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/_pets_explode_post_page_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/page.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-async/docs/Page.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-async/docs/PetsExplodePostPageExplodeParameter.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-async/docs/PetsExplodePostPageParameter.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-async/src/models/_pets_explode_post_page_explode_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-async/src/models/_pets_explode_post_page_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-async/src/models/page.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/Page.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetsExplodePostPageExplodeParameter.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetsExplodePostPageParameter.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/_pets_explode_post_page_explode_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/_pets_explode_post_page_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/page.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/Page.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetsExplodePostPageExplodeParameter.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetsExplodePostPageParameter.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/_pets_explode_post_page_explode_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/_pets_explode_post_page_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/page.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooPage.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooPetsExplodePostPageExplodeParameter.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooPetsExplodePostPageParameter.md create mode 100644 samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo__pets_explode_post_page_explode_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo__pets_explode_post_page_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_page.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore/docs/Page.md create mode 100644 samples/client/petstore/rust/reqwest/petstore/docs/PetsExplodePostPageExplodeParameter.md create mode 100644 samples/client/petstore/rust/reqwest/petstore/docs/PetsExplodePostPageParameter.md create mode 100644 samples/client/petstore/rust/reqwest/petstore/src/models/_pets_explode_post_page_explode_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore/src/models/_pets_explode_post_page_parameter.rs create mode 100644 samples/client/petstore/rust/reqwest/petstore/src/models/page.rs diff --git a/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml index 64de2e9e67c..6c658424a17 100644 --- a/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml @@ -18,6 +18,49 @@ tags: - name: user description: Operations about user paths: + /pets: + post: + tags: + - pet + summary: List all pets + description: Returns a list of pets + parameters: + - name: page + in: query + description: The page number + required: false + schema: + $ref: '#/components/schemas/Page' + responses: + '200': + description: A list of pets + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid page number + /pets/explode: + post: + tags: + - pet + summary: List all pets + description: Returns a list of pets + parameters: + - $ref: '#/components/parameters/PageExplode' + responses: + '200': + description: A list of pets + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid page number /pet: post: tags: @@ -1120,3 +1163,22 @@ components: oneOf: - $ref: '#/components/schemas/Order' - $ref: '#/components/schemas/Order' + Page: + type: object + properties: + page: + type: integer + format: int32 + perPage: + type: integer + format: int32 + parameters: + PageExplode: + name: pageExplode + in: query + description: Object containing page `size` and page `number`. + required: false + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/Page' diff --git a/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES b/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES index f56a8ace96e..9b85cc92014 100644 --- a/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES +++ b/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES @@ -16,6 +16,7 @@ docs/NullableArray.md docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md +docs/Page.md docs/Person.md docs/Pet.md docs/PetApi.md @@ -61,6 +62,7 @@ src/models/nullable_array.rs src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs +src/models/page.rs src/models/person.rs src/models/pet.rs src/models/property_test.rs diff --git a/samples/client/petstore/rust/hyper/petstore/README.md b/samples/client/petstore/rust/hyper/petstore/README.md index 164048d493b..e9484f587b1 100644 --- a/samples/client/petstore/rust/hyper/petstore/README.md +++ b/samples/client/petstore/rust/hyper/petstore/README.md @@ -32,6 +32,8 @@ Class | Method | HTTP request | Description *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **Get** /pet/findByStatus | Finds Pets by status *PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **Get** /pet/findByTags | Finds Pets by tags *PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **Get** /pet/{petId} | Find pet by ID +*PetApi* | [**pets_explode_post**](docs/PetApi.md#pets_explode_post) | **Post** /pets/explode | List all pets +*PetApi* | [**pets_post**](docs/PetApi.md#pets_post) | **Post** /pets | List all pets *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **Put** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **Post** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **Post** /pet/{petId}/uploadImage | uploads an image @@ -68,6 +70,7 @@ Class | Method | HTTP request | Description - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) + - [Page](docs/Page.md) - [Person](docs/Person.md) - [Pet](docs/Pet.md) - [PropertyTest](docs/PropertyTest.md) diff --git a/samples/client/petstore/rust/hyper/petstore/docs/Page.md b/samples/client/petstore/rust/hyper/petstore/docs/Page.md new file mode 100644 index 00000000000..dac3d45928d --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/docs/Page.md @@ -0,0 +1,12 @@ +# Page + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**page** | Option<**i32**> | | [optional] +**per_page** | Option<**i32**> | | [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) + + diff --git a/samples/client/petstore/rust/hyper/petstore/docs/PetApi.md b/samples/client/petstore/rust/hyper/petstore/docs/PetApi.md index aa7c10c030b..747dd0c5b97 100644 --- a/samples/client/petstore/rust/hyper/petstore/docs/PetApi.md +++ b/samples/client/petstore/rust/hyper/petstore/docs/PetApi.md @@ -9,6 +9,8 @@ Method | HTTP request | Description [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **Get** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **Get** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **Get** /pet/{petId} | Find pet by ID +[**pets_explode_post**](PetApi.md#pets_explode_post) | **Post** /pets/explode | List all pets +[**pets_post**](PetApi.md#pets_post) | **Post** /pets | List all pets [**update_pet**](PetApi.md#update_pet) | **Put** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **Post** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **Post** /pet/{petId}/uploadImage | uploads an image @@ -167,6 +169,66 @@ Name | Type | Description | Required | 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) +## pets_explode_post + +> Vec pets_explode_post(page_explode) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page_explode** | Option<[**Page**](.md)> | Object containing page `size` and page `number`. | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## pets_post + +> Vec pets_post(page) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page** | Option<[**Page**](.md)> | The page number | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## update_pet > models::Pet update_pet(pet) diff --git a/samples/client/petstore/rust/hyper/petstore/docs/PetsExplodePostPageExplodeParameter.md b/samples/client/petstore/rust/hyper/petstore/docs/PetsExplodePostPageExplodeParameter.md new file mode 100644 index 00000000000..4d328f64458 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/docs/PetsExplodePostPageExplodeParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageExplodeParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/hyper/petstore/docs/PetsExplodePostPageParameter.md b/samples/client/petstore/rust/hyper/petstore/docs/PetsExplodePostPageParameter.md new file mode 100644 index 00000000000..feef5fcabd7 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/docs/PetsExplodePostPageParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/hyper/petstore/src/apis/pet_api.rs b/samples/client/petstore/rust/hyper/petstore/src/apis/pet_api.rs index eff676820f4..f6c8e0f0d83 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/apis/pet_api.rs @@ -42,6 +42,8 @@ pub trait PetApi: Send + Sync { fn find_pets_by_status(&self, status: Vec, r#type: Option>) -> Pin, Error>> + Send>>; fn find_pets_by_tags(&self, tags: Vec) -> Pin, Error>> + Send>>; fn get_pet_by_id(&self, pet_id: i64) -> Pin> + Send>>; + fn pets_explode_post(&self, page_explode: Option) -> Pin, Error>> + Send>>; + fn pets_post(&self, page: Option) -> Pin, Error>> + Send>>; fn update_pet(&self, pet: models::Pet) -> Pin> + Send>>; fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Pin> + Send>>; fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option) -> Pin> + Send>>; @@ -111,6 +113,30 @@ implPetApi for PetApiClient req.execute(self.configuration.borrow()) } + #[allow(unused_mut)] + fn pets_explode_post(&self, page_explode: Option) -> Pin, Error>> + Send>> { + let mut req = __internal_request::Request::new(hyper::Method::POST, "/pets/explode".to_string()) + ; + if let Some(ref s) = page_explode { + let query_value = s.to_string(); + req = req.with_query_param("pageExplode".to_string(), query_value); + } + + req.execute(self.configuration.borrow()) + } + + #[allow(unused_mut)] + fn pets_post(&self, page: Option) -> Pin, Error>> + Send>> { + let mut req = __internal_request::Request::new(hyper::Method::POST, "/pets".to_string()) + ; + if let Some(ref s) = page { + let query_value = s.to_string(); + req = req.with_query_param("page".to_string(), query_value); + } + + req.execute(self.configuration.borrow()) + } + #[allow(unused_mut)] fn update_pet(&self, pet: models::Pet) -> Pin> + Send>> { let mut req = __internal_request::Request::new(hyper::Method::PUT, "/pet".to_string()) diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/_pets_explode_post_page_explode_parameter.rs b/samples/client/petstore/rust/hyper/petstore/src/models/_pets_explode_post_page_explode_parameter.rs new file mode 100644 index 00000000000..39367534b60 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/src/models/_pets_explode_post_page_explode_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageExplodeParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageExplodeParameter { + pub fn new() -> PetsExplodePostPageExplodeParameter { + PetsExplodePostPageExplodeParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/_pets_explode_post_page_parameter.rs b/samples/client/petstore/rust/hyper/petstore/src/models/_pets_explode_post_page_parameter.rs new file mode 100644 index 00000000000..6a9d3bd2797 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/src/models/_pets_explode_post_page_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageParameter { + pub fn new() -> PetsExplodePostPageParameter { + PetsExplodePostPageParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs b/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs index 7cdaa063edb..653d185cd8d 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs @@ -24,6 +24,8 @@ pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; pub use self::order::Order; +pub mod page; +pub use self::page::Page; pub mod person; pub use self::person::Person; pub mod pet; diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/page.rs b/samples/client/petstore/rust/hyper/petstore/src/models/page.rs new file mode 100644 index 00000000000..3e007e7eb38 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/src/models/page.rs @@ -0,0 +1,30 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Page { + #[serde(rename = "page", skip_serializing_if = "Option::is_none")] + pub page: Option, + #[serde(rename = "perPage", skip_serializing_if = "Option::is_none")] + pub per_page: Option, +} + +impl Page { + pub fn new() -> Page { + Page { + page: None, + per_page: None, + } + } +} + diff --git a/samples/client/petstore/rust/hyper0x/petstore/.openapi-generator/FILES b/samples/client/petstore/rust/hyper0x/petstore/.openapi-generator/FILES index bb1f8da36d1..40cf3b75bc0 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/.openapi-generator/FILES +++ b/samples/client/petstore/rust/hyper0x/petstore/.openapi-generator/FILES @@ -16,6 +16,7 @@ docs/NullableArray.md docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md +docs/Page.md docs/Person.md docs/Pet.md docs/PetApi.md @@ -59,6 +60,7 @@ src/models/nullable_array.rs src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs +src/models/page.rs src/models/person.rs src/models/pet.rs src/models/property_test.rs diff --git a/samples/client/petstore/rust/hyper0x/petstore/README.md b/samples/client/petstore/rust/hyper0x/petstore/README.md index 567353a1d2d..74bd6fab3aa 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/README.md +++ b/samples/client/petstore/rust/hyper0x/petstore/README.md @@ -32,6 +32,8 @@ Class | Method | HTTP request | Description *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**pets_explode_post**](docs/PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +*PetApi* | [**pets_post**](docs/PetApi.md#pets_post) | **POST** /pets | List all pets *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -68,6 +70,7 @@ Class | Method | HTTP request | Description - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) + - [Page](docs/Page.md) - [Person](docs/Person.md) - [Pet](docs/Pet.md) - [PropertyTest](docs/PropertyTest.md) diff --git a/samples/client/petstore/rust/hyper0x/petstore/docs/Page.md b/samples/client/petstore/rust/hyper0x/petstore/docs/Page.md new file mode 100644 index 00000000000..dac3d45928d --- /dev/null +++ b/samples/client/petstore/rust/hyper0x/petstore/docs/Page.md @@ -0,0 +1,12 @@ +# Page + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**page** | Option<**i32**> | | [optional] +**per_page** | Option<**i32**> | | [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) + + diff --git a/samples/client/petstore/rust/hyper0x/petstore/docs/PetApi.md b/samples/client/petstore/rust/hyper0x/petstore/docs/PetApi.md index bcf5d512410..9d10c02f498 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/docs/PetApi.md +++ b/samples/client/petstore/rust/hyper0x/petstore/docs/PetApi.md @@ -9,6 +9,8 @@ Method | HTTP request | Description [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**pets_explode_post**](PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +[**pets_post**](PetApi.md#pets_post) | **POST** /pets | List all pets [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -167,6 +169,66 @@ Name | Type | Description | Required | 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) +## pets_explode_post + +> Vec pets_explode_post(page_explode) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page_explode** | Option<[**Page**](.md)> | Object containing page `size` and page `number`. | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## pets_post + +> Vec pets_post(page) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page** | Option<[**Page**](.md)> | The page number | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## update_pet > models::Pet update_pet(pet) diff --git a/samples/client/petstore/rust/hyper0x/petstore/docs/PetsExplodePostPageExplodeParameter.md b/samples/client/petstore/rust/hyper0x/petstore/docs/PetsExplodePostPageExplodeParameter.md new file mode 100644 index 00000000000..4d328f64458 --- /dev/null +++ b/samples/client/petstore/rust/hyper0x/petstore/docs/PetsExplodePostPageExplodeParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageExplodeParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/hyper0x/petstore/docs/PetsExplodePostPageParameter.md b/samples/client/petstore/rust/hyper0x/petstore/docs/PetsExplodePostPageParameter.md new file mode 100644 index 00000000000..feef5fcabd7 --- /dev/null +++ b/samples/client/petstore/rust/hyper0x/petstore/docs/PetsExplodePostPageParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/apis/pet_api.rs b/samples/client/petstore/rust/hyper0x/petstore/src/apis/pet_api.rs index ff4fadea86a..dac261755a9 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/hyper0x/petstore/src/apis/pet_api.rs @@ -41,6 +41,8 @@ pub trait PetApi { fn find_pets_by_status(&self, status: Vec, r#type: Option>) -> Pin, Error>>>>; fn find_pets_by_tags(&self, tags: Vec) -> Pin, Error>>>>; fn get_pet_by_id(&self, pet_id: i64) -> Pin>>>; + fn pets_explode_post(&self, page_explode: Option) -> Pin, Error>>>>; + fn pets_post(&self, page: Option) -> Pin, Error>>>>; fn update_pet(&self, pet: models::Pet) -> Pin>>>; fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Pin>>>; fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option) -> Pin>>>; @@ -110,6 +112,30 @@ implPetApi for PetApiClient req.execute(self.configuration.borrow()) } + #[allow(unused_mut)] + fn pets_explode_post(&self, page_explode: Option) -> Pin, Error>>>> { + let mut req = __internal_request::Request::new(hyper::Method::POST, "/pets/explode".to_string()) + ; + if let Some(ref s) = page_explode { + let query_value = s.to_string(); + req = req.with_query_param("pageExplode".to_string(), query_value); + } + + req.execute(self.configuration.borrow()) + } + + #[allow(unused_mut)] + fn pets_post(&self, page: Option) -> Pin, Error>>>> { + let mut req = __internal_request::Request::new(hyper::Method::POST, "/pets".to_string()) + ; + if let Some(ref s) = page { + let query_value = s.to_string(); + req = req.with_query_param("page".to_string(), query_value); + } + + req.execute(self.configuration.borrow()) + } + #[allow(unused_mut)] fn update_pet(&self, pet: models::Pet) -> Pin>>> { let mut req = __internal_request::Request::new(hyper::Method::PUT, "/pet".to_string()) diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/models/_pets_explode_post_page_explode_parameter.rs b/samples/client/petstore/rust/hyper0x/petstore/src/models/_pets_explode_post_page_explode_parameter.rs new file mode 100644 index 00000000000..39367534b60 --- /dev/null +++ b/samples/client/petstore/rust/hyper0x/petstore/src/models/_pets_explode_post_page_explode_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageExplodeParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageExplodeParameter { + pub fn new() -> PetsExplodePostPageExplodeParameter { + PetsExplodePostPageExplodeParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/models/_pets_explode_post_page_parameter.rs b/samples/client/petstore/rust/hyper0x/petstore/src/models/_pets_explode_post_page_parameter.rs new file mode 100644 index 00000000000..6a9d3bd2797 --- /dev/null +++ b/samples/client/petstore/rust/hyper0x/petstore/src/models/_pets_explode_post_page_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageParameter { + pub fn new() -> PetsExplodePostPageParameter { + PetsExplodePostPageParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs b/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs index 7cdaa063edb..653d185cd8d 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs @@ -24,6 +24,8 @@ pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; pub use self::order::Order; +pub mod page; +pub use self::page::Page; pub mod person; pub use self::person::Person; pub mod pet; diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/models/page.rs b/samples/client/petstore/rust/hyper0x/petstore/src/models/page.rs new file mode 100644 index 00000000000..3e007e7eb38 --- /dev/null +++ b/samples/client/petstore/rust/hyper0x/petstore/src/models/page.rs @@ -0,0 +1,30 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Page { + #[serde(rename = "page", skip_serializing_if = "Option::is_none")] + pub page: Option, + #[serde(rename = "perPage", skip_serializing_if = "Option::is_none")] + pub per_page: Option, +} + +impl Page { + pub fn new() -> Page { + Page { + page: None, + per_page: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest-trait/petstore/.openapi-generator/FILES index bb1f8da36d1..40cf3b75bc0 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest-trait/petstore/.openapi-generator/FILES @@ -16,6 +16,7 @@ docs/NullableArray.md docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md +docs/Page.md docs/Person.md docs/Pet.md docs/PetApi.md @@ -59,6 +60,7 @@ src/models/nullable_array.rs src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs +src/models/page.rs src/models/person.rs src/models/pet.rs src/models/property_test.rs diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/README.md b/samples/client/petstore/rust/reqwest-trait/petstore/README.md index c9cc16b3075..1f758b38983 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/README.md +++ b/samples/client/petstore/rust/reqwest-trait/petstore/README.md @@ -32,6 +32,8 @@ Class | Method | HTTP request | Description *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**pets_explode_post**](docs/PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +*PetApi* | [**pets_post**](docs/PetApi.md#pets_post) | **POST** /pets | List all pets *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -68,6 +70,7 @@ Class | Method | HTTP request | Description - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) + - [Page](docs/Page.md) - [Person](docs/Person.md) - [Pet](docs/Pet.md) - [PropertyTest](docs/PropertyTest.md) diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/docs/Page.md b/samples/client/petstore/rust/reqwest-trait/petstore/docs/Page.md new file mode 100644 index 00000000000..dac3d45928d --- /dev/null +++ b/samples/client/petstore/rust/reqwest-trait/petstore/docs/Page.md @@ -0,0 +1,12 @@ +# Page + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**page** | Option<**i32**> | | [optional] +**per_page** | Option<**i32**> | | [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) + + diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/docs/PetApi.md b/samples/client/petstore/rust/reqwest-trait/petstore/docs/PetApi.md index bcf5d512410..9d10c02f498 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest-trait/petstore/docs/PetApi.md @@ -9,6 +9,8 @@ Method | HTTP request | Description [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**pets_explode_post**](PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +[**pets_post**](PetApi.md#pets_post) | **POST** /pets | List all pets [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -167,6 +169,66 @@ Name | Type | Description | Required | 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) +## pets_explode_post + +> Vec pets_explode_post(page_explode) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page_explode** | Option<[**Page**](.md)> | Object containing page `size` and page `number`. | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## pets_post + +> Vec pets_post(page) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page** | Option<[**Page**](.md)> | The page number | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## update_pet > models::Pet update_pet(pet) diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/docs/PetsExplodePostPageExplodeParameter.md b/samples/client/petstore/rust/reqwest-trait/petstore/docs/PetsExplodePostPageExplodeParameter.md new file mode 100644 index 00000000000..4d328f64458 --- /dev/null +++ b/samples/client/petstore/rust/reqwest-trait/petstore/docs/PetsExplodePostPageExplodeParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageExplodeParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/docs/PetsExplodePostPageParameter.md b/samples/client/petstore/rust/reqwest-trait/petstore/docs/PetsExplodePostPageParameter.md new file mode 100644 index 00000000000..feef5fcabd7 --- /dev/null +++ b/samples/client/petstore/rust/reqwest-trait/petstore/docs/PetsExplodePostPageParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/fake_api.rs index b4eb9420cdb..781dc75659c 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/fake_api.rs @@ -50,8 +50,8 @@ impl FakeApi for FakeApiClient { let local_var_uri_str = format!("{}/fake/user/{user_name}", local_var_configuration.base_path, user_name=crate::apis::urlencode(user_name)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - if let Some(ref local_var_str) = content { - local_var_req_builder = local_var_req_builder.query(&[("content", &local_var_str.to_string())]); + if let Some(ref param_value) = content { + local_var_req_builder = local_var_req_builder.query(&[("content", ¶m_value.to_string())]); } local_var_req_builder = local_var_req_builder.query(&[("anyType", &any_type.to_string())]); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/pet_api.rs index d1dafb82af4..2d98e504da5 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/apis/pet_api.rs @@ -46,6 +46,16 @@ pub trait PetApi: Send + Sync { /// Returns a single pet async fn get_pet_by_id<'pet_id>(&self, pet_id: i64) -> Result>; + /// POST /pets/explode + /// + /// Returns a list of pets + async fn pets_explode_post<'page_explode>(&self, page_explode: Option) -> Result, Error>; + + /// POST /pets + /// + /// Returns a list of pets + async fn pets_post<'page>(&self, page: Option) -> Result, Error>; + /// PUT /pet async fn update_pet<'pet>(&self, pet: models::Pet) -> Result>; @@ -159,11 +169,12 @@ impl PetApi for PetApiClient { "multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::>()), _ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; - if let Some(ref local_var_str) = r#type { + if let Some(ref param_value) = r#type { local_var_req_builder = match "csv" { - "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::>()), - _ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), + "multi" => local_var_req_builder.query(¶m_value.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::>()), + _ => local_var_req_builder.query(&[("type", ¶m_value.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; + local_var_req_builder = local_var_req_builder.query(&[("type", ¶m_value.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); @@ -288,6 +299,88 @@ impl PetApi for PetApiClient { } } + /// Returns a list of pets + async fn pets_explode_post<'page_explode>(&self, page_explode: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/pets/explode", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref param_value) = page_explode { + local_var_req_builder = local_var_req_builder.query(¶m_value); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Pet>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::Pet>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// Returns a list of pets + async fn pets_post<'page>(&self, page: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/pets", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref param_value) = page { + local_var_req_builder = local_var_req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Pet>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::Pet>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + /// async fn update_pet<'pet>(&self, pet: models::Pet) -> Result> { let local_var_configuration = &self.configuration; @@ -459,6 +552,22 @@ pub enum GetPetByIdError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`pets_explode_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsExplodePostError { + Status400(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`pets_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsPostError { + Status400(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_pet`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/_pets_explode_post_page_explode_parameter.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/_pets_explode_post_page_explode_parameter.rs new file mode 100644 index 00000000000..39367534b60 --- /dev/null +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/_pets_explode_post_page_explode_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageExplodeParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageExplodeParameter { + pub fn new() -> PetsExplodePostPageExplodeParameter { + PetsExplodePostPageExplodeParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/_pets_explode_post_page_parameter.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/_pets_explode_post_page_parameter.rs new file mode 100644 index 00000000000..6a9d3bd2797 --- /dev/null +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/_pets_explode_post_page_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageParameter { + pub fn new() -> PetsExplodePostPageParameter { + PetsExplodePostPageParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/mod.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/mod.rs index 7cdaa063edb..653d185cd8d 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/mod.rs @@ -24,6 +24,8 @@ pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; pub use self::order::Order; +pub mod page; +pub use self::page::Page; pub mod person; pub use self::person::Person; pub mod pet; diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/page.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/page.rs new file mode 100644 index 00000000000..3e007e7eb38 --- /dev/null +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/page.rs @@ -0,0 +1,30 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Page { + #[serde(rename = "page", skip_serializing_if = "Option::is_none")] + pub page: Option, + #[serde(rename = "perPage", skip_serializing_if = "Option::is_none")] + pub per_page: Option, +} + +impl Page { + pub fn new() -> Page { + Page { + page: None, + per_page: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-async-middleware/.openapi-generator/FILES index bb1f8da36d1..40cf3b75bc0 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/.openapi-generator/FILES @@ -16,6 +16,7 @@ docs/NullableArray.md docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md +docs/Page.md docs/Person.md docs/Pet.md docs/PetApi.md @@ -59,6 +60,7 @@ src/models/nullable_array.rs src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs +src/models/page.rs src/models/person.rs src/models/pet.rs src/models/property_test.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/README.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/README.md index a3bd1d24642..44d8ca58eb4 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/README.md @@ -32,6 +32,8 @@ Class | Method | HTTP request | Description *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**pets_explode_post**](docs/PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +*PetApi* | [**pets_post**](docs/PetApi.md#pets_post) | **POST** /pets | List all pets *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -68,6 +70,7 @@ Class | Method | HTTP request | Description - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) + - [Page](docs/Page.md) - [Person](docs/Person.md) - [Pet](docs/Pet.md) - [PropertyTest](docs/PropertyTest.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/Page.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/Page.md new file mode 100644 index 00000000000..dac3d45928d --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/Page.md @@ -0,0 +1,12 @@ +# Page + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**page** | Option<**i32**> | | [optional] +**per_page** | Option<**i32**> | | [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) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetApi.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetApi.md index bcf5d512410..9d10c02f498 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetApi.md @@ -9,6 +9,8 @@ Method | HTTP request | Description [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**pets_explode_post**](PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +[**pets_post**](PetApi.md#pets_post) | **POST** /pets | List all pets [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -167,6 +169,66 @@ Name | Type | Description | Required | 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) +## pets_explode_post + +> Vec pets_explode_post(page_explode) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page_explode** | Option<[**Page**](.md)> | Object containing page `size` and page `number`. | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## pets_post + +> Vec pets_post(page) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page** | Option<[**Page**](.md)> | The page number | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## update_pet > models::Pet update_pet(pet) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetsExplodePostPageExplodeParameter.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetsExplodePostPageExplodeParameter.md new file mode 100644 index 00000000000..4d328f64458 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetsExplodePostPageExplodeParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageExplodeParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetsExplodePostPageParameter.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetsExplodePostPageParameter.md new file mode 100644 index 00000000000..feef5fcabd7 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/PetsExplodePostPageParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs index 342302918d2..bc0ad904237 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs @@ -52,6 +52,20 @@ pub struct GetPetByIdParams { pub pet_id: i64 } +/// struct for passing parameters to the method [`pets_explode_post`] +#[derive(Clone, Debug)] +pub struct PetsExplodePostParams { + /// Object containing page `size` and page `number`. + pub page_explode: Option +} + +/// struct for passing parameters to the method [`pets_post`] +#[derive(Clone, Debug)] +pub struct PetsPostParams { + /// The page number + pub page: Option +} + /// struct for passing parameters to the method [`update_pet`] #[derive(Clone, Debug)] pub struct UpdatePetParams { @@ -121,6 +135,22 @@ pub enum GetPetByIdSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`pets_explode_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsExplodePostSuccess { + Status200(Vec), + UnknownValue(serde_json::Value), +} + +/// struct for typed successes of method [`pets_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsPostSuccess { + Status200(Vec), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`update_pet`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -185,6 +215,22 @@ pub enum GetPetByIdError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`pets_explode_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsExplodePostError { + Status400(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`pets_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsPostError { + Status400(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_pet`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -379,6 +425,64 @@ pub async fn get_pet_by_id(configuration: &configuration::Configuration, params: } } +/// Returns a list of pets +pub async fn pets_explode_post(configuration: &configuration::Configuration, params: PetsExplodePostParams) -> Result, Error> { + + let uri_str = format!("{}/pets/explode", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = params.page_explode { + req_builder = req_builder.query(¶m_value); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +/// Returns a list of pets +pub async fn pets_post(configuration: &configuration::Configuration, params: PetsPostParams) -> Result, Error> { + + let uri_str = format!("{}/pets", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = params.page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + /// pub async fn update_pet(configuration: &configuration::Configuration, params: UpdatePetParams) -> Result, Error> { diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/_pets_explode_post_page_explode_parameter.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/_pets_explode_post_page_explode_parameter.rs new file mode 100644 index 00000000000..39367534b60 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/_pets_explode_post_page_explode_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageExplodeParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageExplodeParameter { + pub fn new() -> PetsExplodePostPageExplodeParameter { + PetsExplodePostPageExplodeParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/_pets_explode_post_page_parameter.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/_pets_explode_post_page_parameter.rs new file mode 100644 index 00000000000..6a9d3bd2797 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/_pets_explode_post_page_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageParameter { + pub fn new() -> PetsExplodePostPageParameter { + PetsExplodePostPageParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs index 7cdaa063edb..653d185cd8d 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs @@ -24,6 +24,8 @@ pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; pub use self::order::Order; +pub mod page; +pub use self::page::Page; pub mod person; pub use self::person::Person; pub mod pet; diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/page.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/page.rs new file mode 100644 index 00000000000..3e007e7eb38 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/page.rs @@ -0,0 +1,30 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Page { + #[serde(rename = "page", skip_serializing_if = "Option::is_none")] + pub page: Option, + #[serde(rename = "perPage", skip_serializing_if = "Option::is_none")] + pub per_page: Option, +} + +impl Page { + pub fn new() -> Page { + Page { + page: None, + per_page: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/.openapi-generator/FILES index bb1f8da36d1..40cf3b75bc0 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/.openapi-generator/FILES @@ -16,6 +16,7 @@ docs/NullableArray.md docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md +docs/Page.md docs/Person.md docs/Pet.md docs/PetApi.md @@ -59,6 +60,7 @@ src/models/nullable_array.rs src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs +src/models/page.rs src/models/person.rs src/models/pet.rs src/models/property_test.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/README.md b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/README.md index b717783e955..1235f031c8f 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/README.md @@ -32,6 +32,8 @@ Class | Method | HTTP request | Description *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**pets_explode_post**](docs/PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +*PetApi* | [**pets_post**](docs/PetApi.md#pets_post) | **POST** /pets | List all pets *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -68,6 +70,7 @@ Class | Method | HTTP request | Description - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) + - [Page](docs/Page.md) - [Person](docs/Person.md) - [Pet](docs/Pet.md) - [PropertyTest](docs/PropertyTest.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/Page.md b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/Page.md new file mode 100644 index 00000000000..dac3d45928d --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/Page.md @@ -0,0 +1,12 @@ +# Page + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**page** | Option<**i32**> | | [optional] +**per_page** | Option<**i32**> | | [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) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetApi.md b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetApi.md index bcf5d512410..9d10c02f498 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetApi.md @@ -9,6 +9,8 @@ Method | HTTP request | Description [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**pets_explode_post**](PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +[**pets_post**](PetApi.md#pets_post) | **POST** /pets | List all pets [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -167,6 +169,66 @@ Name | Type | Description | Required | 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) +## pets_explode_post + +> Vec pets_explode_post(page_explode) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page_explode** | Option<[**Page**](.md)> | Object containing page `size` and page `number`. | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## pets_post + +> Vec pets_post(page) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page** | Option<[**Page**](.md)> | The page number | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## update_pet > models::Pet update_pet(pet) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetsExplodePostPageExplodeParameter.md b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetsExplodePostPageExplodeParameter.md new file mode 100644 index 00000000000..4d328f64458 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetsExplodePostPageExplodeParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageExplodeParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetsExplodePostPageParameter.md b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetsExplodePostPageParameter.md new file mode 100644 index 00000000000..feef5fcabd7 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/PetsExplodePostPageParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/pet_api.rs index 7ff1983fc3a..cb157eb4c13 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/pet_api.rs @@ -52,6 +52,20 @@ pub struct GetPetByIdParams { pub pet_id: i64 } +/// struct for passing parameters to the method [`pets_explode_post`] +#[derive(Clone, Debug)] +pub struct PetsExplodePostParams { + /// Object containing page `size` and page `number`. + pub page_explode: Option +} + +/// struct for passing parameters to the method [`pets_post`] +#[derive(Clone, Debug)] +pub struct PetsPostParams { + /// The page number + pub page: Option +} + /// struct for passing parameters to the method [`update_pet`] #[derive(Clone, Debug)] pub struct UpdatePetParams { @@ -121,6 +135,22 @@ pub enum GetPetByIdSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`pets_explode_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsExplodePostSuccess { + Status200(Vec), + UnknownValue(serde_json::Value), +} + +/// struct for typed successes of method [`pets_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsPostSuccess { + Status200(Vec), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`update_pet`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -185,6 +215,22 @@ pub enum GetPetByIdError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`pets_explode_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsExplodePostError { + Status400(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`pets_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsPostError { + Status400(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_pet`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -384,6 +430,64 @@ pub async fn get_pet_by_id(configuration: &configuration::Configuration, params: } } +/// Returns a list of pets +pub async fn pets_explode_post(configuration: &configuration::Configuration, params: PetsExplodePostParams) -> Result, Error> { + + let uri_str = format!("{}/pets/explode", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = params.page_explode { + req_builder = req_builder.query(¶m_value); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +/// Returns a list of pets +pub async fn pets_post(configuration: &configuration::Configuration, params: PetsPostParams) -> Result, Error> { + + let uri_str = format!("{}/pets", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = params.page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + /// pub async fn update_pet(configuration: &configuration::Configuration, params: UpdatePetParams) -> Result, Error> { diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/_pets_explode_post_page_explode_parameter.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/_pets_explode_post_page_explode_parameter.rs new file mode 100644 index 00000000000..39367534b60 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/_pets_explode_post_page_explode_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageExplodeParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageExplodeParameter { + pub fn new() -> PetsExplodePostPageExplodeParameter { + PetsExplodePostPageExplodeParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/_pets_explode_post_page_parameter.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/_pets_explode_post_page_parameter.rs new file mode 100644 index 00000000000..6a9d3bd2797 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/_pets_explode_post_page_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageParameter { + pub fn new() -> PetsExplodePostPageParameter { + PetsExplodePostPageParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/mod.rs index 7cdaa063edb..653d185cd8d 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/mod.rs @@ -24,6 +24,8 @@ pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; pub use self::order::Order; +pub mod page; +pub use self::page::Page; pub mod person; pub use self::person::Person; pub mod pet; diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/page.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/page.rs new file mode 100644 index 00000000000..3e007e7eb38 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/page.rs @@ -0,0 +1,30 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Page { + #[serde(rename = "page", skip_serializing_if = "Option::is_none")] + pub page: Option, + #[serde(rename = "perPage", skip_serializing_if = "Option::is_none")] + pub per_page: Option, +} + +impl Page { + pub fn new() -> Page { + Page { + page: None, + per_page: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-async/.openapi-generator/FILES index bb1f8da36d1..40cf3b75bc0 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-async/.openapi-generator/FILES @@ -16,6 +16,7 @@ docs/NullableArray.md docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md +docs/Page.md docs/Person.md docs/Pet.md docs/PetApi.md @@ -59,6 +60,7 @@ src/models/nullable_array.rs src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs +src/models/page.rs src/models/person.rs src/models/pet.rs src/models/property_test.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-async/README.md b/samples/client/petstore/rust/reqwest/petstore-async/README.md index 69502f2f6be..261f526b6ba 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-async/README.md @@ -32,6 +32,8 @@ Class | Method | HTTP request | Description *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**pets_explode_post**](docs/PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +*PetApi* | [**pets_post**](docs/PetApi.md#pets_post) | **POST** /pets | List all pets *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -68,6 +70,7 @@ Class | Method | HTTP request | Description - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) + - [Page](docs/Page.md) - [Person](docs/Person.md) - [Pet](docs/Pet.md) - [PropertyTest](docs/PropertyTest.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-async/docs/Page.md b/samples/client/petstore/rust/reqwest/petstore-async/docs/Page.md new file mode 100644 index 00000000000..dac3d45928d --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async/docs/Page.md @@ -0,0 +1,12 @@ +# Page + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**page** | Option<**i32**> | | [optional] +**per_page** | Option<**i32**> | | [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) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-async/docs/PetApi.md b/samples/client/petstore/rust/reqwest/petstore-async/docs/PetApi.md index bcf5d512410..9d10c02f498 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-async/docs/PetApi.md @@ -9,6 +9,8 @@ Method | HTTP request | Description [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**pets_explode_post**](PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +[**pets_post**](PetApi.md#pets_post) | **POST** /pets | List all pets [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -167,6 +169,66 @@ Name | Type | Description | Required | 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) +## pets_explode_post + +> Vec pets_explode_post(page_explode) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page_explode** | Option<[**Page**](.md)> | Object containing page `size` and page `number`. | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## pets_post + +> Vec pets_post(page) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page** | Option<[**Page**](.md)> | The page number | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## update_pet > models::Pet update_pet(pet) diff --git a/samples/client/petstore/rust/reqwest/petstore-async/docs/PetsExplodePostPageExplodeParameter.md b/samples/client/petstore/rust/reqwest/petstore-async/docs/PetsExplodePostPageExplodeParameter.md new file mode 100644 index 00000000000..4d328f64458 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async/docs/PetsExplodePostPageExplodeParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageExplodeParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-async/docs/PetsExplodePostPageParameter.md b/samples/client/petstore/rust/reqwest/petstore-async/docs/PetsExplodePostPageParameter.md new file mode 100644 index 00000000000..feef5fcabd7 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async/docs/PetsExplodePostPageParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs index 342302918d2..bc0ad904237 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs @@ -52,6 +52,20 @@ pub struct GetPetByIdParams { pub pet_id: i64 } +/// struct for passing parameters to the method [`pets_explode_post`] +#[derive(Clone, Debug)] +pub struct PetsExplodePostParams { + /// Object containing page `size` and page `number`. + pub page_explode: Option +} + +/// struct for passing parameters to the method [`pets_post`] +#[derive(Clone, Debug)] +pub struct PetsPostParams { + /// The page number + pub page: Option +} + /// struct for passing parameters to the method [`update_pet`] #[derive(Clone, Debug)] pub struct UpdatePetParams { @@ -121,6 +135,22 @@ pub enum GetPetByIdSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`pets_explode_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsExplodePostSuccess { + Status200(Vec), + UnknownValue(serde_json::Value), +} + +/// struct for typed successes of method [`pets_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsPostSuccess { + Status200(Vec), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`update_pet`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -185,6 +215,22 @@ pub enum GetPetByIdError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`pets_explode_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsExplodePostError { + Status400(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`pets_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsPostError { + Status400(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_pet`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -379,6 +425,64 @@ pub async fn get_pet_by_id(configuration: &configuration::Configuration, params: } } +/// Returns a list of pets +pub async fn pets_explode_post(configuration: &configuration::Configuration, params: PetsExplodePostParams) -> Result, Error> { + + let uri_str = format!("{}/pets/explode", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = params.page_explode { + req_builder = req_builder.query(¶m_value); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +/// Returns a list of pets +pub async fn pets_post(configuration: &configuration::Configuration, params: PetsPostParams) -> Result, Error> { + + let uri_str = format!("{}/pets", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = params.page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + /// pub async fn update_pet(configuration: &configuration::Configuration, params: UpdatePetParams) -> Result, Error> { diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/_pets_explode_post_page_explode_parameter.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/_pets_explode_post_page_explode_parameter.rs new file mode 100644 index 00000000000..39367534b60 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/_pets_explode_post_page_explode_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageExplodeParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageExplodeParameter { + pub fn new() -> PetsExplodePostPageExplodeParameter { + PetsExplodePostPageExplodeParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/_pets_explode_post_page_parameter.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/_pets_explode_post_page_parameter.rs new file mode 100644 index 00000000000..6a9d3bd2797 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/_pets_explode_post_page_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageParameter { + pub fn new() -> PetsExplodePostPageParameter { + PetsExplodePostPageParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs index 7cdaa063edb..653d185cd8d 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs @@ -24,6 +24,8 @@ pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; pub use self::order::Order; +pub mod page; +pub use self::page::Page; pub mod person; pub use self::person::Person; pub mod pet; diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/page.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/page.rs new file mode 100644 index 00000000000..3e007e7eb38 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/page.rs @@ -0,0 +1,30 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Page { + #[serde(rename = "page", skip_serializing_if = "Option::is_none")] + pub page: Option, + #[serde(rename = "perPage", skip_serializing_if = "Option::is_none")] + pub per_page: Option, +} + +impl Page { + pub fn new() -> Page { + Page { + page: None, + per_page: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-avoid-box/.openapi-generator/FILES index bb1f8da36d1..40cf3b75bc0 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/.openapi-generator/FILES @@ -16,6 +16,7 @@ docs/NullableArray.md docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md +docs/Page.md docs/Person.md docs/Pet.md docs/PetApi.md @@ -59,6 +60,7 @@ src/models/nullable_array.rs src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs +src/models/page.rs src/models/person.rs src/models/pet.rs src/models/property_test.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/README.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/README.md index 48fdd05c464..b4d5de8c325 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/README.md @@ -32,6 +32,8 @@ Class | Method | HTTP request | Description *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**pets_explode_post**](docs/PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +*PetApi* | [**pets_post**](docs/PetApi.md#pets_post) | **POST** /pets | List all pets *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -68,6 +70,7 @@ Class | Method | HTTP request | Description - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) + - [Page](docs/Page.md) - [Person](docs/Person.md) - [Pet](docs/Pet.md) - [PropertyTest](docs/PropertyTest.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/Page.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/Page.md new file mode 100644 index 00000000000..dac3d45928d --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/Page.md @@ -0,0 +1,12 @@ +# Page + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**page** | Option<**i32**> | | [optional] +**per_page** | Option<**i32**> | | [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) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetApi.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetApi.md index bcf5d512410..9d10c02f498 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetApi.md @@ -9,6 +9,8 @@ Method | HTTP request | Description [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**pets_explode_post**](PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +[**pets_post**](PetApi.md#pets_post) | **POST** /pets | List all pets [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -167,6 +169,66 @@ Name | Type | Description | Required | 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) +## pets_explode_post + +> Vec pets_explode_post(page_explode) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page_explode** | Option<[**Page**](.md)> | Object containing page `size` and page `number`. | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## pets_post + +> Vec pets_post(page) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page** | Option<[**Page**](.md)> | The page number | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## update_pet > models::Pet update_pet(pet) diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetsExplodePostPageExplodeParameter.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetsExplodePostPageExplodeParameter.md new file mode 100644 index 00000000000..4d328f64458 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetsExplodePostPageExplodeParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageExplodeParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetsExplodePostPageParameter.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetsExplodePostPageParameter.md new file mode 100644 index 00000000000..feef5fcabd7 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/PetsExplodePostPageParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs index 342302918d2..bc0ad904237 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs @@ -52,6 +52,20 @@ pub struct GetPetByIdParams { pub pet_id: i64 } +/// struct for passing parameters to the method [`pets_explode_post`] +#[derive(Clone, Debug)] +pub struct PetsExplodePostParams { + /// Object containing page `size` and page `number`. + pub page_explode: Option +} + +/// struct for passing parameters to the method [`pets_post`] +#[derive(Clone, Debug)] +pub struct PetsPostParams { + /// The page number + pub page: Option +} + /// struct for passing parameters to the method [`update_pet`] #[derive(Clone, Debug)] pub struct UpdatePetParams { @@ -121,6 +135,22 @@ pub enum GetPetByIdSuccess { UnknownValue(serde_json::Value), } +/// struct for typed successes of method [`pets_explode_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsExplodePostSuccess { + Status200(Vec), + UnknownValue(serde_json::Value), +} + +/// struct for typed successes of method [`pets_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsPostSuccess { + Status200(Vec), + UnknownValue(serde_json::Value), +} + /// struct for typed successes of method [`update_pet`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -185,6 +215,22 @@ pub enum GetPetByIdError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`pets_explode_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsExplodePostError { + Status400(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`pets_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsPostError { + Status400(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_pet`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -379,6 +425,64 @@ pub async fn get_pet_by_id(configuration: &configuration::Configuration, params: } } +/// Returns a list of pets +pub async fn pets_explode_post(configuration: &configuration::Configuration, params: PetsExplodePostParams) -> Result, Error> { + + let uri_str = format!("{}/pets/explode", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = params.page_explode { + req_builder = req_builder.query(¶m_value); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +/// Returns a list of pets +pub async fn pets_post(configuration: &configuration::Configuration, params: PetsPostParams) -> Result, Error> { + + let uri_str = format!("{}/pets", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = params.page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Ok(ResponseContent { status, content, entity }) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + /// pub async fn update_pet(configuration: &configuration::Configuration, params: UpdatePetParams) -> Result, Error> { diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/_pets_explode_post_page_explode_parameter.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/_pets_explode_post_page_explode_parameter.rs new file mode 100644 index 00000000000..39367534b60 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/_pets_explode_post_page_explode_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageExplodeParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageExplodeParameter { + pub fn new() -> PetsExplodePostPageExplodeParameter { + PetsExplodePostPageExplodeParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/_pets_explode_post_page_parameter.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/_pets_explode_post_page_parameter.rs new file mode 100644 index 00000000000..6a9d3bd2797 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/_pets_explode_post_page_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageParameter { + pub fn new() -> PetsExplodePostPageParameter { + PetsExplodePostPageParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs index 7cdaa063edb..653d185cd8d 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs @@ -24,6 +24,8 @@ pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; pub use self::order::Order; +pub mod page; +pub use self::page::Page; pub mod person; pub use self::person::Person; pub mod pet; diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/page.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/page.rs new file mode 100644 index 00000000000..3e007e7eb38 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/page.rs @@ -0,0 +1,30 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Page { + #[serde(rename = "page", skip_serializing_if = "Option::is_none")] + pub page: Option, + #[serde(rename = "perPage", skip_serializing_if = "Option::is_none")] + pub per_page: Option, +} + +impl Page { + pub fn new() -> Page { + Page { + page: None, + per_page: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/.openapi-generator/FILES index bb1f8da36d1..40cf3b75bc0 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/.openapi-generator/FILES @@ -16,6 +16,7 @@ docs/NullableArray.md docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md +docs/Page.md docs/Person.md docs/Pet.md docs/PetApi.md @@ -59,6 +60,7 @@ src/models/nullable_array.rs src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs +src/models/page.rs src/models/person.rs src/models/pet.rs src/models/property_test.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md index fb71914ebef..d27cf59be36 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md @@ -32,6 +32,8 @@ Class | Method | HTTP request | Description *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**pets_explode_post**](docs/PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +*PetApi* | [**pets_post**](docs/PetApi.md#pets_post) | **POST** /pets | List all pets *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -68,6 +70,7 @@ Class | Method | HTTP request | Description - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) + - [Page](docs/Page.md) - [Person](docs/Person.md) - [Pet](docs/Pet.md) - [PropertyTest](docs/PropertyTest.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/Page.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/Page.md new file mode 100644 index 00000000000..dac3d45928d --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/Page.md @@ -0,0 +1,12 @@ +# Page + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**page** | Option<**i32**> | | [optional] +**per_page** | Option<**i32**> | | [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) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetApi.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetApi.md index bcf5d512410..9d10c02f498 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetApi.md @@ -9,6 +9,8 @@ Method | HTTP request | Description [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**pets_explode_post**](PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +[**pets_post**](PetApi.md#pets_post) | **POST** /pets | List all pets [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -167,6 +169,66 @@ Name | Type | Description | Required | 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) +## pets_explode_post + +> Vec pets_explode_post(page_explode) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page_explode** | Option<[**Page**](.md)> | Object containing page `size` and page `number`. | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## pets_post + +> Vec pets_post(page) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page** | Option<[**Page**](.md)> | The page number | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## update_pet > models::Pet update_pet(pet) diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetsExplodePostPageExplodeParameter.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetsExplodePostPageExplodeParameter.md new file mode 100644 index 00000000000..4d328f64458 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetsExplodePostPageExplodeParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageExplodeParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetsExplodePostPageParameter.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetsExplodePostPageParameter.md new file mode 100644 index 00000000000..feef5fcabd7 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/PetsExplodePostPageParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs index bc728dd0245..3390794b31c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs @@ -56,6 +56,22 @@ pub enum GetPetByIdError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`pets_explode_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsExplodePostError { + Status400(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`pets_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsPostError { + Status400(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_pet`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -361,6 +377,86 @@ pub fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64) } } +/// Returns a list of pets +pub fn pets_explode_post(configuration: &configuration::Configuration, page_explode: Option) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_page_explode = page_explode; + + let uri_str = format!("{}/pets/explode", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = p_page_explode { + req_builder = req_builder.query(¶m_value); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req)?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text()?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Pet>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Pet>`")))), + } + } else { + let content = resp.text()?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +/// Returns a list of pets +pub fn pets_post(configuration: &configuration::Configuration, page: Option) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_page = page; + + let uri_str = format!("{}/pets", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = p_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req)?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text()?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Pet>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Pet>`")))), + } + } else { + let content = resp.text()?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + /// pub fn update_pet(configuration: &configuration::Configuration, pet: models::Pet) -> Result> { // add a prefix to parameters to efficiently prevent name collisions diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/_pets_explode_post_page_explode_parameter.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/_pets_explode_post_page_explode_parameter.rs new file mode 100644 index 00000000000..39367534b60 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/_pets_explode_post_page_explode_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageExplodeParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageExplodeParameter { + pub fn new() -> PetsExplodePostPageExplodeParameter { + PetsExplodePostPageExplodeParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/_pets_explode_post_page_parameter.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/_pets_explode_post_page_parameter.rs new file mode 100644 index 00000000000..6a9d3bd2797 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/_pets_explode_post_page_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageParameter { + pub fn new() -> PetsExplodePostPageParameter { + PetsExplodePostPageParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs index 7cdaa063edb..653d185cd8d 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs @@ -24,6 +24,8 @@ pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; pub use self::order::Order; +pub mod page; +pub use self::page::Page; pub mod person; pub use self::person::Person; pub mod pet; diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/page.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/page.rs new file mode 100644 index 00000000000..3e007e7eb38 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/page.rs @@ -0,0 +1,30 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Page { + #[serde(rename = "page", skip_serializing_if = "Option::is_none")] + pub page: Option, + #[serde(rename = "perPage", skip_serializing_if = "Option::is_none")] + pub per_page: Option, +} + +impl Page { + pub fn new() -> Page { + Page { + page: None, + per_page: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/.openapi-generator/FILES index abb373467d5..37979799bb0 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/.openapi-generator/FILES @@ -16,6 +16,7 @@ docs/FooNullableArray.md docs/FooNumericEnumTesting.md docs/FooOptionalTesting.md docs/FooOrder.md +docs/FooPage.md docs/FooPerson.md docs/FooPet.md docs/FooPropertyTest.md @@ -56,6 +57,7 @@ src/models/foo_nullable_array.rs src/models/foo_numeric_enum_testing.rs src/models/foo_optional_testing.rs src/models/foo_order.rs +src/models/foo_page.rs src/models/foo_person.rs src/models/foo_pet.rs src/models/foo_property_test.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/README.md b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/README.md index a89804b595f..2521f128271 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/README.md @@ -32,6 +32,8 @@ Class | Method | HTTP request | Description *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**pets_explode_post**](docs/PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +*PetApi* | [**pets_post**](docs/PetApi.md#pets_post) | **POST** /pets | List all pets *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -68,6 +70,7 @@ Class | Method | HTTP request | Description - [FooNumericEnumTesting](docs/FooNumericEnumTesting.md) - [FooOptionalTesting](docs/FooOptionalTesting.md) - [FooOrder](docs/FooOrder.md) + - [FooPage](docs/FooPage.md) - [FooPerson](docs/FooPerson.md) - [FooPet](docs/FooPet.md) - [FooPropertyTest](docs/FooPropertyTest.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooPage.md b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooPage.md new file mode 100644 index 00000000000..3e538523f2d --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooPage.md @@ -0,0 +1,12 @@ +# FooPage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**page** | Option<**i32**> | | [optional] +**per_page** | Option<**i32**> | | [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) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooPetsExplodePostPageExplodeParameter.md b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooPetsExplodePostPageExplodeParameter.md new file mode 100644 index 00000000000..99b9910675a --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooPetsExplodePostPageExplodeParameter.md @@ -0,0 +1,12 @@ +# FooPetsExplodePostPageExplodeParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooPetsExplodePostPageParameter.md b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooPetsExplodePostPageParameter.md new file mode 100644 index 00000000000..0d2b7d8f260 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooPetsExplodePostPageParameter.md @@ -0,0 +1,12 @@ +# FooPetsExplodePostPageParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/PetApi.md b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/PetApi.md index 341baaef875..36ecc2ee91e 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/PetApi.md @@ -9,6 +9,8 @@ Method | HTTP request | Description [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**pets_explode_post**](PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +[**pets_post**](PetApi.md#pets_post) | **POST** /pets | List all pets [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -167,6 +169,66 @@ Name | Type | Description | Required | 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) +## pets_explode_post + +> Vec pets_explode_post(page_explode) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page_explode** | Option<[**FooPage**](.md)> | Object containing page `size` and page `number`. | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## pets_post + +> Vec pets_post(page) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page** | Option<[**FooPage**](.md)> | The page number | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## update_pet > models::FooPet update_pet(foo_pet) diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/pet_api.rs index 4f3780b34be..8b5f49e55d3 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/pet_api.rs @@ -56,6 +56,22 @@ pub enum GetPetByIdError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`pets_explode_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsExplodePostError { + Status400(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`pets_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsPostError { + Status400(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_pet`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -296,6 +312,86 @@ pub fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64) } } +/// Returns a list of pets +pub fn pets_explode_post(configuration: &configuration::Configuration, page_explode: Option) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_page_explode = page_explode; + + let uri_str = format!("{}/pets/explode", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = p_page_explode { + req_builder = req_builder.query(¶m_value); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req)?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text()?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::FooPet>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::FooPet>`")))), + } + } else { + let content = resp.text()?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +/// Returns a list of pets +pub fn pets_post(configuration: &configuration::Configuration, page: Option) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_page = page; + + let uri_str = format!("{}/pets", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = p_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req)?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text()?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::FooPet>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::FooPet>`")))), + } + } else { + let content = resp.text()?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + /// pub fn update_pet(configuration: &configuration::Configuration, foo_pet: models::FooPet) -> Result> { // add a prefix to parameters to efficiently prevent name collisions diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo__pets_explode_post_page_explode_parameter.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo__pets_explode_post_page_explode_parameter.rs new file mode 100644 index 00000000000..e35b41189b8 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo__pets_explode_post_page_explode_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct FooPetsExplodePostPageExplodeParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl FooPetsExplodePostPageExplodeParameter { + pub fn new() -> FooPetsExplodePostPageExplodeParameter { + FooPetsExplodePostPageExplodeParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo__pets_explode_post_page_parameter.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo__pets_explode_post_page_parameter.rs new file mode 100644 index 00000000000..393d60a6e88 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo__pets_explode_post_page_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct FooPetsExplodePostPageParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl FooPetsExplodePostPageParameter { + pub fn new() -> FooPetsExplodePostPageParameter { + FooPetsExplodePostPageParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_page.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_page.rs new file mode 100644 index 00000000000..2f9870f418e --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_page.rs @@ -0,0 +1,30 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct FooPage { + #[serde(rename = "page", skip_serializing_if = "Option::is_none")] + pub page: Option, + #[serde(rename = "perPage", skip_serializing_if = "Option::is_none")] + pub per_page: Option, +} + +impl FooPage { + pub fn new() -> FooPage { + FooPage { + page: None, + per_page: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/mod.rs index b08f685662b..a3ff8aa5353 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/mod.rs @@ -24,6 +24,8 @@ pub mod foo_optional_testing; pub use self::foo_optional_testing::FooOptionalTesting; pub mod foo_order; pub use self::foo_order::FooOrder; +pub mod foo_page; +pub use self::foo_page::FooPage; pub mod foo_person; pub use self::foo_person::FooPerson; pub mod foo_pet; diff --git a/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES index bb1f8da36d1..40cf3b75bc0 100644 --- a/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES @@ -16,6 +16,7 @@ docs/NullableArray.md docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md +docs/Page.md docs/Person.md docs/Pet.md docs/PetApi.md @@ -59,6 +60,7 @@ src/models/nullable_array.rs src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs +src/models/page.rs src/models/person.rs src/models/pet.rs src/models/property_test.rs diff --git a/samples/client/petstore/rust/reqwest/petstore/README.md b/samples/client/petstore/rust/reqwest/petstore/README.md index c9cc16b3075..1f758b38983 100644 --- a/samples/client/petstore/rust/reqwest/petstore/README.md +++ b/samples/client/petstore/rust/reqwest/petstore/README.md @@ -32,6 +32,8 @@ Class | Method | HTTP request | Description *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**pets_explode_post**](docs/PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +*PetApi* | [**pets_post**](docs/PetApi.md#pets_post) | **POST** /pets | List all pets *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -68,6 +70,7 @@ Class | Method | HTTP request | Description - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) + - [Page](docs/Page.md) - [Person](docs/Person.md) - [Pet](docs/Pet.md) - [PropertyTest](docs/PropertyTest.md) diff --git a/samples/client/petstore/rust/reqwest/petstore/docs/Page.md b/samples/client/petstore/rust/reqwest/petstore/docs/Page.md new file mode 100644 index 00000000000..dac3d45928d --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/docs/Page.md @@ -0,0 +1,12 @@ +# Page + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**page** | Option<**i32**> | | [optional] +**per_page** | Option<**i32**> | | [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) + + diff --git a/samples/client/petstore/rust/reqwest/petstore/docs/PetApi.md b/samples/client/petstore/rust/reqwest/petstore/docs/PetApi.md index bcf5d512410..9d10c02f498 100644 --- a/samples/client/petstore/rust/reqwest/petstore/docs/PetApi.md +++ b/samples/client/petstore/rust/reqwest/petstore/docs/PetApi.md @@ -9,6 +9,8 @@ Method | HTTP request | Description [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**pets_explode_post**](PetApi.md#pets_explode_post) | **POST** /pets/explode | List all pets +[**pets_post**](PetApi.md#pets_post) | **POST** /pets | List all pets [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -167,6 +169,66 @@ Name | Type | Description | Required | 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) +## pets_explode_post + +> Vec pets_explode_post(page_explode) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page_explode** | Option<[**Page**](.md)> | Object containing page `size` and page `number`. | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## pets_post + +> Vec pets_post(page) +List all pets + +Returns a list of pets + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**page** | Option<[**Page**](.md)> | The page number | | + +### Return type + +[**Vec**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## update_pet > models::Pet update_pet(pet) diff --git a/samples/client/petstore/rust/reqwest/petstore/docs/PetsExplodePostPageExplodeParameter.md b/samples/client/petstore/rust/reqwest/petstore/docs/PetsExplodePostPageExplodeParameter.md new file mode 100644 index 00000000000..4d328f64458 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/docs/PetsExplodePostPageExplodeParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageExplodeParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore/docs/PetsExplodePostPageParameter.md b/samples/client/petstore/rust/reqwest/petstore/docs/PetsExplodePostPageParameter.md new file mode 100644 index 00000000000..feef5fcabd7 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/docs/PetsExplodePostPageParameter.md @@ -0,0 +1,12 @@ +# PetsExplodePostPageParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | Option<**i64**> | The page size. | [optional][default to 10] +**number** | Option<**i64**> | The page number. | [optional][default to 1] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs index f30857ad872..a57a673a7c7 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs @@ -56,6 +56,22 @@ pub enum GetPetByIdError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`pets_explode_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsExplodePostError { + Status400(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`pets_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PetsPostError { + Status400(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_pet`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -296,6 +312,86 @@ pub fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64) } } +/// Returns a list of pets +pub fn pets_explode_post(configuration: &configuration::Configuration, page_explode: Option) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_page_explode = page_explode; + + let uri_str = format!("{}/pets/explode", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = p_page_explode { + req_builder = req_builder.query(¶m_value); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req)?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text()?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Pet>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Pet>`")))), + } + } else { + let content = resp.text()?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +/// Returns a list of pets +pub fn pets_post(configuration: &configuration::Configuration, page: Option) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_page = page; + + let uri_str = format!("{}/pets", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = p_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req)?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text()?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Pet>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Pet>`")))), + } + } else { + let content = resp.text()?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + /// pub fn update_pet(configuration: &configuration::Configuration, pet: models::Pet) -> Result> { // add a prefix to parameters to efficiently prevent name collisions diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/_pets_explode_post_page_explode_parameter.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/_pets_explode_post_page_explode_parameter.rs new file mode 100644 index 00000000000..39367534b60 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/_pets_explode_post_page_explode_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageExplodeParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageExplodeParameter { + pub fn new() -> PetsExplodePostPageExplodeParameter { + PetsExplodePostPageExplodeParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/_pets_explode_post_page_parameter.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/_pets_explode_post_page_parameter.rs new file mode 100644 index 00000000000..6a9d3bd2797 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/_pets_explode_post_page_parameter.rs @@ -0,0 +1,32 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PetsExplodePostPageParameter { + /// The page size. + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, + /// The page number. + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, +} + +impl PetsExplodePostPageParameter { + pub fn new() -> PetsExplodePostPageParameter { + PetsExplodePostPageParameter { + size: None, + number: None, + } + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs index 7cdaa063edb..653d185cd8d 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs @@ -24,6 +24,8 @@ pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; pub use self::order::Order; +pub mod page; +pub use self::page::Page; pub mod person; pub use self::person::Person; pub mod pet; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/page.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/page.rs new file mode 100644 index 00000000000..3e007e7eb38 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/page.rs @@ -0,0 +1,30 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Page { + #[serde(rename = "page", skip_serializing_if = "Option::is_none")] + pub page: Option, + #[serde(rename = "perPage", skip_serializing_if = "Option::is_none")] + pub per_page: Option, +} + +impl Page { + pub fn new() -> Page { + Page { + page: None, + per_page: None, + } + } +} +