diff --git a/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES index 8ca56876d60f..1eba63bf5d49 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES @@ -96,6 +96,7 @@ docs/TaskActivity.md docs/TestErrorResponsesWithModel400Response.md docs/TestErrorResponsesWithModel404Response.md docs/TestInlineFreeformAdditionalPropertiesRequest.md +docs/TestObjectForMultipartRequestsRequestMarker.md docs/Tiger.md docs/UnnamedDictWithAdditionalModelListProperties.md docs/UnnamedDictWithAdditionalStringListProperties.md @@ -204,6 +205,7 @@ petstore_api/models/task_activity.py petstore_api/models/test_error_responses_with_model400_response.py petstore_api/models/test_error_responses_with_model404_response.py petstore_api/models/test_inline_freeform_additional_properties_request.py +petstore_api/models/test_object_for_multipart_requests_request_marker.py petstore_api/models/tiger.py petstore_api/models/unnamed_dict_with_additional_model_list_properties.py petstore_api/models/unnamed_dict_with_additional_string_list_properties.py @@ -218,4 +220,5 @@ setup.cfg setup.py test-requirements.txt test/__init__.py +test/test_test_object_for_multipart_requests_request_marker.py tox.ini diff --git a/samples/openapi3/client/petstore/python-aiohttp/README.md b/samples/openapi3/client/petstore/python-aiohttp/README.md index 786d1ec7491b..8c7f6e6eb561 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/README.md +++ b/samples/openapi3/client/petstore/python-aiohttp/README.md @@ -120,6 +120,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties *FakeApi* | [**test_inline_freeform_additional_properties**](docs/FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties *FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**test_object_for_multipart_requests**](docs/FakeApi.md#test_object_for_multipart_requests) | **POST** /fake/object_for_multipart_requests | *FakeApi* | [**test_query_parameter_collection_format**](docs/FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | *FakeApi* | [**test_string_map_reference**](docs/FakeApi.md#test_string_map_reference) | **POST** /fake/stringMap-reference | test referenced string map *FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case @@ -235,6 +236,7 @@ Class | Method | HTTP request | Description - [TestErrorResponsesWithModel400Response](docs/TestErrorResponsesWithModel400Response.md) - [TestErrorResponsesWithModel404Response](docs/TestErrorResponsesWithModel404Response.md) - [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md) + - [TestObjectForMultipartRequestsRequestMarker](docs/TestObjectForMultipartRequestsRequestMarker.md) - [Tiger](docs/Tiger.md) - [UnnamedDictWithAdditionalModelListProperties](docs/UnnamedDictWithAdditionalModelListProperties.md) - [UnnamedDictWithAdditionalStringListProperties](docs/UnnamedDictWithAdditionalStringListProperties.md) diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/FakeApi.md b/samples/openapi3/client/petstore/python-aiohttp/docs/FakeApi.md index 17e42c6b1c1d..83d1c1d37d4c 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/FakeApi.md @@ -37,6 +37,7 @@ Method | HTTP request | Description [**test_inline_additional_properties**](FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties [**test_inline_freeform_additional_properties**](FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties [**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +[**test_object_for_multipart_requests**](FakeApi.md#test_object_for_multipart_requests) | **POST** /fake/object_for_multipart_requests | [**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | [**test_string_map_reference**](FakeApi.md#test_string_map_reference) | **POST** /fake/stringMap-reference | test referenced string map @@ -2274,6 +2275,69 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **test_object_for_multipart_requests** +> test_object_for_multipart_requests(marker) + + + +### Example + + +```python +import petstore_api +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + marker = petstore_api.TestObjectForMultipartRequestsRequestMarker() # TestObjectForMultipartRequestsRequestMarker | + + try: + await api_instance.test_object_for_multipart_requests(marker) + except Exception as e: + print("Exception when calling FakeApi->test_object_for_multipart_requests: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **marker** | [**TestObjectForMultipartRequestsRequestMarker**](TestObjectForMultipartRequestsRequestMarker.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[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) + # **test_query_parameter_collection_format** > test_query_parameter_collection_format(pipe, ioutil, http, url, context, allow_empty, language=language) diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/TestObjectForMultipartRequestsRequestMarker.md b/samples/openapi3/client/petstore/python-aiohttp/docs/TestObjectForMultipartRequestsRequestMarker.md new file mode 100644 index 000000000000..75cd561ffae8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/TestObjectForMultipartRequestsRequestMarker.md @@ -0,0 +1,29 @@ +# TestObjectForMultipartRequestsRequestMarker + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker + +# TODO update the JSON string below +json = "{}" +# create an instance of TestObjectForMultipartRequestsRequestMarker from a JSON string +test_object_for_multipart_requests_request_marker_instance = TestObjectForMultipartRequestsRequestMarker.from_json(json) +# print the JSON string representation of the object +print(TestObjectForMultipartRequestsRequestMarker.to_json()) + +# convert the object into a dict +test_object_for_multipart_requests_request_marker_dict = test_object_for_multipart_requests_request_marker_instance.to_dict() +# create an instance of TestObjectForMultipartRequestsRequestMarker from a dict +test_object_for_multipart_requests_request_marker_form_dict = test_object_for_multipart_requests_request_marker.from_dict(test_object_for_multipart_requests_request_marker_dict) +``` +[[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/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py index b038a7fc2608..c00449f73c79 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py @@ -125,6 +125,7 @@ from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py index 23c1e1bdd82a..dc839324d4cb 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py @@ -29,6 +29,7 @@ from petstore_api.models.pet import Pet from petstore_api.models.tag import Tag from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.user import User from petstore_api.api_client import ApiClient, RequestSerialized @@ -8815,6 +8816,267 @@ def _test_json_form_data_serialize( + @validate_call + async def test_object_for_multipart_requests( + self, + marker: TestObjectForMultipartRequestsRequestMarker, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """test_object_for_multipart_requests + + + :param marker: (required) + :type marker: TestObjectForMultipartRequestsRequestMarker + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._test_object_for_multipart_requests_serialize( + marker=marker, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def test_object_for_multipart_requests_with_http_info( + self, + marker: TestObjectForMultipartRequestsRequestMarker, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """test_object_for_multipart_requests + + + :param marker: (required) + :type marker: TestObjectForMultipartRequestsRequestMarker + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._test_object_for_multipart_requests_serialize( + marker=marker, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def test_object_for_multipart_requests_without_preload_content( + self, + marker: TestObjectForMultipartRequestsRequestMarker, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """test_object_for_multipart_requests + + + :param marker: (required) + :type marker: TestObjectForMultipartRequestsRequestMarker + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._test_object_for_multipart_requests_serialize( + marker=marker, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _test_object_for_multipart_requests_serialize( + self, + marker, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + if marker is not None: + _form_params.append(('marker', marker)) + # process the body parameter + + + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/fake/object_for_multipart_requests', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call async def test_query_parameter_collection_format( self, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py index 4724dd902c60..df6dfce63fb3 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py @@ -101,6 +101,7 @@ from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_object_for_multipart_requests_request_marker.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_object_for_multipart_requests_request_marker.py new file mode 100644 index 000000000000..a5c3bfdbb1b5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_object_for_multipart_requests_request_marker.py @@ -0,0 +1,87 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class TestObjectForMultipartRequestsRequestMarker(BaseModel): + """ + TestObjectForMultipartRequestsRequestMarker + """ # noqa: E501 + name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TestObjectForMultipartRequestsRequestMarker from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TestObjectForMultipartRequestsRequestMarker from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_test_object_for_multipart_requests_request_marker.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_test_object_for_multipart_requests_request_marker.py new file mode 100644 index 000000000000..3c831caad5a0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_test_object_for_multipart_requests_request_marker.py @@ -0,0 +1,51 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker + +class TestTestObjectForMultipartRequestsRequestMarker(unittest.TestCase): + """TestObjectForMultipartRequestsRequestMarker unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TestObjectForMultipartRequestsRequestMarker: + """Test TestObjectForMultipartRequestsRequestMarker + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TestObjectForMultipartRequestsRequestMarker` + """ + model = TestObjectForMultipartRequestsRequestMarker() + if include_optional: + return TestObjectForMultipartRequestsRequestMarker( + name = '' + ) + else: + return TestObjectForMultipartRequestsRequestMarker( + ) + """ + + def testTestObjectForMultipartRequestsRequestMarker(self): + """Test TestObjectForMultipartRequestsRequestMarker""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES index fa3538ce756b..dd4150711036 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES @@ -96,6 +96,7 @@ docs/TaskActivity.md docs/TestErrorResponsesWithModel400Response.md docs/TestErrorResponsesWithModel404Response.md docs/TestInlineFreeformAdditionalPropertiesRequest.md +docs/TestObjectForMultipartRequestsRequestMarker.md docs/Tiger.md docs/UnnamedDictWithAdditionalModelListProperties.md docs/UnnamedDictWithAdditionalStringListProperties.md @@ -204,6 +205,7 @@ petstore_api/models/task_activity.py petstore_api/models/test_error_responses_with_model400_response.py petstore_api/models/test_error_responses_with_model404_response.py petstore_api/models/test_inline_freeform_additional_properties_request.py +petstore_api/models/test_object_for_multipart_requests_request_marker.py petstore_api/models/tiger.py petstore_api/models/unnamed_dict_with_additional_model_list_properties.py petstore_api/models/unnamed_dict_with_additional_string_list_properties.py @@ -218,4 +220,5 @@ setup.cfg setup.py test-requirements.txt test/__init__.py +test/test_test_object_for_multipart_requests_request_marker.py tox.ini diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md index a82cd0b31ea7..62a7a2a776af 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md @@ -121,6 +121,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties *FakeApi* | [**test_inline_freeform_additional_properties**](docs/FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties *FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**test_object_for_multipart_requests**](docs/FakeApi.md#test_object_for_multipart_requests) | **POST** /fake/object_for_multipart_requests | *FakeApi* | [**test_query_parameter_collection_format**](docs/FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | *FakeApi* | [**test_string_map_reference**](docs/FakeApi.md#test_string_map_reference) | **POST** /fake/stringMap-reference | test referenced string map *FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case @@ -236,6 +237,7 @@ Class | Method | HTTP request | Description - [TestErrorResponsesWithModel400Response](docs/TestErrorResponsesWithModel400Response.md) - [TestErrorResponsesWithModel404Response](docs/TestErrorResponsesWithModel404Response.md) - [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md) + - [TestObjectForMultipartRequestsRequestMarker](docs/TestObjectForMultipartRequestsRequestMarker.md) - [Tiger](docs/Tiger.md) - [UnnamedDictWithAdditionalModelListProperties](docs/UnnamedDictWithAdditionalModelListProperties.md) - [UnnamedDictWithAdditionalStringListProperties](docs/UnnamedDictWithAdditionalStringListProperties.md) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md index 2f3472a78aea..22c6daa82b19 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md @@ -37,6 +37,7 @@ Method | HTTP request | Description [**test_inline_additional_properties**](FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties [**test_inline_freeform_additional_properties**](FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties [**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +[**test_object_for_multipart_requests**](FakeApi.md#test_object_for_multipart_requests) | **POST** /fake/object_for_multipart_requests | [**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | [**test_string_map_reference**](FakeApi.md#test_string_map_reference) | **POST** /fake/stringMap-reference | test referenced string map @@ -2241,6 +2242,68 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **test_object_for_multipart_requests** +> test_object_for_multipart_requests(marker) + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + marker = petstore_api.TestObjectForMultipartRequestsRequestMarker() # TestObjectForMultipartRequestsRequestMarker | + + try: + await api_instance.test_object_for_multipart_requests(marker) + except Exception as e: + print("Exception when calling FakeApi->test_object_for_multipart_requests: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **marker** | [**TestObjectForMultipartRequestsRequestMarker**](TestObjectForMultipartRequestsRequestMarker.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[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) + # **test_query_parameter_collection_format** > test_query_parameter_collection_format(pipe, ioutil, http, url, context, allow_empty, language=language) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestObjectForMultipartRequestsRequestMarker.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestObjectForMultipartRequestsRequestMarker.md new file mode 100644 index 000000000000..25613918e920 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestObjectForMultipartRequestsRequestMarker.md @@ -0,0 +1,28 @@ +# TestObjectForMultipartRequestsRequestMarker + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker + +# TODO update the JSON string below +json = "{}" +# create an instance of TestObjectForMultipartRequestsRequestMarker from a JSON string +test_object_for_multipart_requests_request_marker_instance = TestObjectForMultipartRequestsRequestMarker.from_json(json) +# print the JSON string representation of the object +print TestObjectForMultipartRequestsRequestMarker.to_json() + +# convert the object into a dict +test_object_for_multipart_requests_request_marker_dict = test_object_for_multipart_requests_request_marker_instance.to_dict() +# create an instance of TestObjectForMultipartRequestsRequestMarker from a dict +test_object_for_multipart_requests_request_marker_form_dict = test_object_for_multipart_requests_request_marker.from_dict(test_object_for_multipart_requests_request_marker_dict) +``` +[[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/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py index 5b780780fd85..76a74629edde 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py @@ -125,6 +125,7 @@ from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py index 792c9b17c714..da27c4cd9545 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py @@ -35,6 +35,7 @@ from petstore_api.models.pet import Pet from petstore_api.models.tag import Tag from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.user import User from petstore_api.api_client import ApiClient @@ -4233,6 +4234,129 @@ async def test_json_form_data_with_http_info(self, param : Annotated[StrictStr, collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @validate_arguments + async def test_object_for_multipart_requests(self, marker : TestObjectForMultipartRequestsRequestMarker, **kwargs) -> None: # noqa: E501 + """test_object_for_multipart_requests # noqa: E501 + + + :param marker: (required) + :type marker: TestObjectForMultipartRequestsRequestMarker + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_object_for_multipart_requests_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.test_object_for_multipart_requests_with_http_info(marker, **kwargs) # noqa: E501 + + @validate_arguments + async def test_object_for_multipart_requests_with_http_info(self, marker : TestObjectForMultipartRequestsRequestMarker, **kwargs) -> ApiResponse: # noqa: E501 + """test_object_for_multipart_requests # noqa: E501 + + + :param marker: (required) + :type marker: TestObjectForMultipartRequestsRequestMarker + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'marker' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_object_for_multipart_requests" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['marker'] is not None: + _form_params.append(('marker', _params['marker'])) + + # process the body parameter + _body_params = None + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['multipart/form-data'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake/object_for_multipart_requests', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments async def test_query_parameter_collection_format(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> None: # noqa: E501 """test_query_parameter_collection_format # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py index 5be0f85af54c..b3bfacd80743 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py @@ -101,6 +101,7 @@ from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_object_for_multipart_requests_request_marker.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_object_for_multipart_requests_request_marker.py new file mode 100644 index 000000000000..957ccc5af28f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_object_for_multipart_requests_request_marker.py @@ -0,0 +1,71 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class TestObjectForMultipartRequestsRequestMarker(BaseModel): + """ + TestObjectForMultipartRequestsRequestMarker + """ + name: Optional[StrictStr] = None + __properties = ["name"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> TestObjectForMultipartRequestsRequestMarker: + """Create an instance of TestObjectForMultipartRequestsRequestMarker from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> TestObjectForMultipartRequestsRequestMarker: + """Create an instance of TestObjectForMultipartRequestsRequestMarker from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return TestObjectForMultipartRequestsRequestMarker.parse_obj(obj) + + _obj = TestObjectForMultipartRequestsRequestMarker.parse_obj({ + "name": obj.get("name") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_test_object_for_multipart_requests_request_marker.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_test_object_for_multipart_requests_request_marker.py new file mode 100644 index 000000000000..109f682bb634 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_test_object_for_multipart_requests_request_marker.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker # noqa: E501 + +class TestTestObjectForMultipartRequestsRequestMarker(unittest.TestCase): + """TestObjectForMultipartRequestsRequestMarker unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TestObjectForMultipartRequestsRequestMarker: + """Test TestObjectForMultipartRequestsRequestMarker + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TestObjectForMultipartRequestsRequestMarker` + """ + model = TestObjectForMultipartRequestsRequestMarker() # noqa: E501 + if include_optional: + return TestObjectForMultipartRequestsRequestMarker( + name = '' + ) + else: + return TestObjectForMultipartRequestsRequestMarker( + ) + """ + + def testTestObjectForMultipartRequestsRequestMarker(self): + """Test TestObjectForMultipartRequestsRequestMarker""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES index fa3538ce756b..dd4150711036 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES @@ -96,6 +96,7 @@ docs/TaskActivity.md docs/TestErrorResponsesWithModel400Response.md docs/TestErrorResponsesWithModel404Response.md docs/TestInlineFreeformAdditionalPropertiesRequest.md +docs/TestObjectForMultipartRequestsRequestMarker.md docs/Tiger.md docs/UnnamedDictWithAdditionalModelListProperties.md docs/UnnamedDictWithAdditionalStringListProperties.md @@ -204,6 +205,7 @@ petstore_api/models/task_activity.py petstore_api/models/test_error_responses_with_model400_response.py petstore_api/models/test_error_responses_with_model404_response.py petstore_api/models/test_inline_freeform_additional_properties_request.py +petstore_api/models/test_object_for_multipart_requests_request_marker.py petstore_api/models/tiger.py petstore_api/models/unnamed_dict_with_additional_model_list_properties.py petstore_api/models/unnamed_dict_with_additional_string_list_properties.py @@ -218,4 +220,5 @@ setup.cfg setup.py test-requirements.txt test/__init__.py +test/test_test_object_for_multipart_requests_request_marker.py tox.ini diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/README.md b/samples/openapi3/client/petstore/python-pydantic-v1/README.md index 2aa26baea077..41fb398a902b 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/README.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/README.md @@ -121,6 +121,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties *FakeApi* | [**test_inline_freeform_additional_properties**](docs/FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties *FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**test_object_for_multipart_requests**](docs/FakeApi.md#test_object_for_multipart_requests) | **POST** /fake/object_for_multipart_requests | *FakeApi* | [**test_query_parameter_collection_format**](docs/FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | *FakeApi* | [**test_string_map_reference**](docs/FakeApi.md#test_string_map_reference) | **POST** /fake/stringMap-reference | test referenced string map *FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case @@ -236,6 +237,7 @@ Class | Method | HTTP request | Description - [TestErrorResponsesWithModel400Response](docs/TestErrorResponsesWithModel400Response.md) - [TestErrorResponsesWithModel404Response](docs/TestErrorResponsesWithModel404Response.md) - [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md) + - [TestObjectForMultipartRequestsRequestMarker](docs/TestObjectForMultipartRequestsRequestMarker.md) - [Tiger](docs/Tiger.md) - [UnnamedDictWithAdditionalModelListProperties](docs/UnnamedDictWithAdditionalModelListProperties.md) - [UnnamedDictWithAdditionalStringListProperties](docs/UnnamedDictWithAdditionalStringListProperties.md) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeApi.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeApi.md index 1cc9de9d601f..a4f0f72b5bd5 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeApi.md @@ -37,6 +37,7 @@ Method | HTTP request | Description [**test_inline_additional_properties**](FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties [**test_inline_freeform_additional_properties**](FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties [**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +[**test_object_for_multipart_requests**](FakeApi.md#test_object_for_multipart_requests) | **POST** /fake/object_for_multipart_requests | [**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | [**test_string_map_reference**](FakeApi.md#test_string_map_reference) | **POST** /fake/stringMap-reference | test referenced string map @@ -2241,6 +2242,68 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **test_object_for_multipart_requests** +> test_object_for_multipart_requests(marker) + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + marker = petstore_api.TestObjectForMultipartRequestsRequestMarker() # TestObjectForMultipartRequestsRequestMarker | + + try: + api_instance.test_object_for_multipart_requests(marker) + except Exception as e: + print("Exception when calling FakeApi->test_object_for_multipart_requests: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **marker** | [**TestObjectForMultipartRequestsRequestMarker**](TestObjectForMultipartRequestsRequestMarker.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[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) + # **test_query_parameter_collection_format** > test_query_parameter_collection_format(pipe, ioutil, http, url, context, allow_empty, language=language) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/TestObjectForMultipartRequestsRequestMarker.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/TestObjectForMultipartRequestsRequestMarker.md new file mode 100644 index 000000000000..25613918e920 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/TestObjectForMultipartRequestsRequestMarker.md @@ -0,0 +1,28 @@ +# TestObjectForMultipartRequestsRequestMarker + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker + +# TODO update the JSON string below +json = "{}" +# create an instance of TestObjectForMultipartRequestsRequestMarker from a JSON string +test_object_for_multipart_requests_request_marker_instance = TestObjectForMultipartRequestsRequestMarker.from_json(json) +# print the JSON string representation of the object +print TestObjectForMultipartRequestsRequestMarker.to_json() + +# convert the object into a dict +test_object_for_multipart_requests_request_marker_dict = test_object_for_multipart_requests_request_marker_instance.to_dict() +# create an instance of TestObjectForMultipartRequestsRequestMarker from a dict +test_object_for_multipart_requests_request_marker_form_dict = test_object_for_multipart_requests_request_marker.from_dict(test_object_for_multipart_requests_request_marker_dict) +``` +[[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/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py index 5b780780fd85..76a74629edde 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py @@ -125,6 +125,7 @@ from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_api.py index 03fccc5f3fa5..cc35197590a2 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_api.py @@ -34,6 +34,7 @@ from petstore_api.models.pet import Pet from petstore_api.models.tag import Tag from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.user import User from petstore_api.api_client import ApiClient @@ -4760,6 +4761,145 @@ def test_json_form_data_with_http_info(self, param : Annotated[StrictStr, Field( collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @validate_arguments + def test_object_for_multipart_requests(self, marker : TestObjectForMultipartRequestsRequestMarker, **kwargs) -> None: # noqa: E501 + """test_object_for_multipart_requests # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_object_for_multipart_requests(marker, async_req=True) + >>> result = thread.get() + + :param marker: (required) + :type marker: TestObjectForMultipartRequestsRequestMarker + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_object_for_multipart_requests_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_object_for_multipart_requests_with_http_info(marker, **kwargs) # noqa: E501 + + @validate_arguments + def test_object_for_multipart_requests_with_http_info(self, marker : TestObjectForMultipartRequestsRequestMarker, **kwargs) -> ApiResponse: # noqa: E501 + """test_object_for_multipart_requests # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_object_for_multipart_requests_with_http_info(marker, async_req=True) + >>> result = thread.get() + + :param marker: (required) + :type marker: TestObjectForMultipartRequestsRequestMarker + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'marker' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_object_for_multipart_requests" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['marker'] is not None: + _form_params.append(('marker', _params['marker'])) + + # process the body parameter + _body_params = None + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['multipart/form-data'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake/object_for_multipart_requests', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments def test_query_parameter_collection_format(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> None: # noqa: E501 """test_query_parameter_collection_format # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py index 5be0f85af54c..b3bfacd80743 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py @@ -101,6 +101,7 @@ from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/test_object_for_multipart_requests_request_marker.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/test_object_for_multipart_requests_request_marker.py new file mode 100644 index 000000000000..92b02afed6c7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/test_object_for_multipart_requests_request_marker.py @@ -0,0 +1,83 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Any, Dict, Optional +from pydantic import BaseModel, StrictStr + +class TestObjectForMultipartRequestsRequestMarker(BaseModel): + """ + TestObjectForMultipartRequestsRequestMarker + """ + name: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["name"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> TestObjectForMultipartRequestsRequestMarker: + """Create an instance of TestObjectForMultipartRequestsRequestMarker from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + "additional_properties" + }, + exclude_none=True) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> TestObjectForMultipartRequestsRequestMarker: + """Create an instance of TestObjectForMultipartRequestsRequestMarker from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return TestObjectForMultipartRequestsRequestMarker.parse_obj(obj) + + _obj = TestObjectForMultipartRequestsRequestMarker.parse_obj({ + "name": obj.get("name") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_test_object_for_multipart_requests_request_marker.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_test_object_for_multipart_requests_request_marker.py new file mode 100644 index 000000000000..109f682bb634 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_test_object_for_multipart_requests_request_marker.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker # noqa: E501 + +class TestTestObjectForMultipartRequestsRequestMarker(unittest.TestCase): + """TestObjectForMultipartRequestsRequestMarker unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TestObjectForMultipartRequestsRequestMarker: + """Test TestObjectForMultipartRequestsRequestMarker + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TestObjectForMultipartRequestsRequestMarker` + """ + model = TestObjectForMultipartRequestsRequestMarker() # noqa: E501 + if include_optional: + return TestObjectForMultipartRequestsRequestMarker( + name = '' + ) + else: + return TestObjectForMultipartRequestsRequestMarker( + ) + """ + + def testTestObjectForMultipartRequestsRequestMarker(self): + """Test TestObjectForMultipartRequestsRequestMarker""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python/.openapi-generator/FILES b/samples/openapi3/client/petstore/python/.openapi-generator/FILES index 8ca56876d60f..1eba63bf5d49 100755 --- a/samples/openapi3/client/petstore/python/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python/.openapi-generator/FILES @@ -96,6 +96,7 @@ docs/TaskActivity.md docs/TestErrorResponsesWithModel400Response.md docs/TestErrorResponsesWithModel404Response.md docs/TestInlineFreeformAdditionalPropertiesRequest.md +docs/TestObjectForMultipartRequestsRequestMarker.md docs/Tiger.md docs/UnnamedDictWithAdditionalModelListProperties.md docs/UnnamedDictWithAdditionalStringListProperties.md @@ -204,6 +205,7 @@ petstore_api/models/task_activity.py petstore_api/models/test_error_responses_with_model400_response.py petstore_api/models/test_error_responses_with_model404_response.py petstore_api/models/test_inline_freeform_additional_properties_request.py +petstore_api/models/test_object_for_multipart_requests_request_marker.py petstore_api/models/tiger.py petstore_api/models/unnamed_dict_with_additional_model_list_properties.py petstore_api/models/unnamed_dict_with_additional_string_list_properties.py @@ -218,4 +220,5 @@ setup.cfg setup.py test-requirements.txt test/__init__.py +test/test_test_object_for_multipart_requests_request_marker.py tox.ini diff --git a/samples/openapi3/client/petstore/python/README.md b/samples/openapi3/client/petstore/python/README.md index 08b0a1e89373..6ddc082d4032 100755 --- a/samples/openapi3/client/petstore/python/README.md +++ b/samples/openapi3/client/petstore/python/README.md @@ -120,6 +120,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties *FakeApi* | [**test_inline_freeform_additional_properties**](docs/FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties *FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**test_object_for_multipart_requests**](docs/FakeApi.md#test_object_for_multipart_requests) | **POST** /fake/object_for_multipart_requests | *FakeApi* | [**test_query_parameter_collection_format**](docs/FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | *FakeApi* | [**test_string_map_reference**](docs/FakeApi.md#test_string_map_reference) | **POST** /fake/stringMap-reference | test referenced string map *FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case @@ -235,6 +236,7 @@ Class | Method | HTTP request | Description - [TestErrorResponsesWithModel400Response](docs/TestErrorResponsesWithModel400Response.md) - [TestErrorResponsesWithModel404Response](docs/TestErrorResponsesWithModel404Response.md) - [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md) + - [TestObjectForMultipartRequestsRequestMarker](docs/TestObjectForMultipartRequestsRequestMarker.md) - [Tiger](docs/Tiger.md) - [UnnamedDictWithAdditionalModelListProperties](docs/UnnamedDictWithAdditionalModelListProperties.md) - [UnnamedDictWithAdditionalStringListProperties](docs/UnnamedDictWithAdditionalStringListProperties.md) diff --git a/samples/openapi3/client/petstore/python/docs/FakeApi.md b/samples/openapi3/client/petstore/python/docs/FakeApi.md index feb61aa9c9fa..354a3ce7191f 100644 --- a/samples/openapi3/client/petstore/python/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python/docs/FakeApi.md @@ -37,6 +37,7 @@ Method | HTTP request | Description [**test_inline_additional_properties**](FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties [**test_inline_freeform_additional_properties**](FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties [**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +[**test_object_for_multipart_requests**](FakeApi.md#test_object_for_multipart_requests) | **POST** /fake/object_for_multipart_requests | [**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | [**test_string_map_reference**](FakeApi.md#test_string_map_reference) | **POST** /fake/stringMap-reference | test referenced string map @@ -2274,6 +2275,69 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **test_object_for_multipart_requests** +> test_object_for_multipart_requests(marker) + + + +### Example + + +```python +import petstore_api +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + marker = petstore_api.TestObjectForMultipartRequestsRequestMarker() # TestObjectForMultipartRequestsRequestMarker | + + try: + api_instance.test_object_for_multipart_requests(marker) + except Exception as e: + print("Exception when calling FakeApi->test_object_for_multipart_requests: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **marker** | [**TestObjectForMultipartRequestsRequestMarker**](TestObjectForMultipartRequestsRequestMarker.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[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) + # **test_query_parameter_collection_format** > test_query_parameter_collection_format(pipe, ioutil, http, url, context, allow_empty, language=language) diff --git a/samples/openapi3/client/petstore/python/docs/TestObjectForMultipartRequestsRequestMarker.md b/samples/openapi3/client/petstore/python/docs/TestObjectForMultipartRequestsRequestMarker.md new file mode 100644 index 000000000000..75cd561ffae8 --- /dev/null +++ b/samples/openapi3/client/petstore/python/docs/TestObjectForMultipartRequestsRequestMarker.md @@ -0,0 +1,29 @@ +# TestObjectForMultipartRequestsRequestMarker + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker + +# TODO update the JSON string below +json = "{}" +# create an instance of TestObjectForMultipartRequestsRequestMarker from a JSON string +test_object_for_multipart_requests_request_marker_instance = TestObjectForMultipartRequestsRequestMarker.from_json(json) +# print the JSON string representation of the object +print(TestObjectForMultipartRequestsRequestMarker.to_json()) + +# convert the object into a dict +test_object_for_multipart_requests_request_marker_dict = test_object_for_multipart_requests_request_marker_instance.to_dict() +# create an instance of TestObjectForMultipartRequestsRequestMarker from a dict +test_object_for_multipart_requests_request_marker_form_dict = test_object_for_multipart_requests_request_marker.from_dict(test_object_for_multipart_requests_request_marker_dict) +``` +[[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/openapi3/client/petstore/python/petstore_api/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/__init__.py index b038a7fc2608..c00449f73c79 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/__init__.py @@ -125,6 +125,7 @@ from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py index 3dbc6c22cd72..258954a0b6d3 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py @@ -29,6 +29,7 @@ from petstore_api.models.pet import Pet from petstore_api.models.tag import Tag from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.user import User from petstore_api.api_client import ApiClient, RequestSerialized @@ -8815,6 +8816,267 @@ def _test_json_form_data_serialize( + @validate_call + def test_object_for_multipart_requests( + self, + marker: TestObjectForMultipartRequestsRequestMarker, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """test_object_for_multipart_requests + + + :param marker: (required) + :type marker: TestObjectForMultipartRequestsRequestMarker + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._test_object_for_multipart_requests_serialize( + marker=marker, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def test_object_for_multipart_requests_with_http_info( + self, + marker: TestObjectForMultipartRequestsRequestMarker, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """test_object_for_multipart_requests + + + :param marker: (required) + :type marker: TestObjectForMultipartRequestsRequestMarker + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._test_object_for_multipart_requests_serialize( + marker=marker, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def test_object_for_multipart_requests_without_preload_content( + self, + marker: TestObjectForMultipartRequestsRequestMarker, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """test_object_for_multipart_requests + + + :param marker: (required) + :type marker: TestObjectForMultipartRequestsRequestMarker + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._test_object_for_multipart_requests_serialize( + marker=marker, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _test_object_for_multipart_requests_serialize( + self, + marker, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + if marker is not None: + _form_params.append(('marker', marker)) + # process the body parameter + + + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/fake/object_for_multipart_requests', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def test_query_parameter_collection_format( self, diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py index 4724dd902c60..df6dfce63fb3 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py @@ -101,6 +101,7 @@ from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/test_object_for_multipart_requests_request_marker.py b/samples/openapi3/client/petstore/python/petstore_api/models/test_object_for_multipart_requests_request_marker.py new file mode 100644 index 000000000000..c31d72482d59 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/models/test_object_for_multipart_requests_request_marker.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class TestObjectForMultipartRequestsRequestMarker(BaseModel): + """ + TestObjectForMultipartRequestsRequestMarker + """ # noqa: E501 + name: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TestObjectForMultipartRequestsRequestMarker from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TestObjectForMultipartRequestsRequestMarker from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/samples/openapi3/client/petstore/python/test/test_test_object_for_multipart_requests_request_marker.py b/samples/openapi3/client/petstore/python/test/test_test_object_for_multipart_requests_request_marker.py new file mode 100644 index 000000000000..3c831caad5a0 --- /dev/null +++ b/samples/openapi3/client/petstore/python/test/test_test_object_for_multipart_requests_request_marker.py @@ -0,0 +1,51 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker + +class TestTestObjectForMultipartRequestsRequestMarker(unittest.TestCase): + """TestObjectForMultipartRequestsRequestMarker unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TestObjectForMultipartRequestsRequestMarker: + """Test TestObjectForMultipartRequestsRequestMarker + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TestObjectForMultipartRequestsRequestMarker` + """ + model = TestObjectForMultipartRequestsRequestMarker() + if include_optional: + return TestObjectForMultipartRequestsRequestMarker( + name = '' + ) + else: + return TestObjectForMultipartRequestsRequestMarker( + ) + """ + + def testTestObjectForMultipartRequestsRequestMarker(self): + """Test TestObjectForMultipartRequestsRequestMarker""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main()