forked from loafle/openapi-generator-original
[python][client] Clean up samples and CI (#17509)
* chore: Remove leftover Github action file This was probably added by mistake. A similar file is active in .github/workflows/samples-python-pydantic-v1-petstore.yaml. * chore: Remove leftover VERSION from old python-experimental sample * ci: Stop running Python integration tests in Circle CI These Python clients are all tested with Github Actions already, which is faster, more cleanly separated and only runs on modifications. I'm not cleaning up the pydantic-v1 client, I expect it to be removed soon anyway. * chore: Remove true from sample folder name python-disallowAdditionalPropertiesIfNotPresent-true -> python-disallowAdditionalPropertiesIfNotPresent
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
# NOTE: This file is auto generated by OpenAPI Generator.
|
||||
# URL: https://openapi-generator.tech
|
||||
#
|
||||
# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
||||
|
||||
name: openapi_client Python package
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install flake8 pytest
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
pytest
|
||||
66
samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/.gitignore
vendored
Normal file
66
samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/.gitignore
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*,cover
|
||||
.hypothesis/
|
||||
venv/
|
||||
.venv/
|
||||
.python-version
|
||||
.pytest_cache
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
#Ipython Notebook
|
||||
.ipynb_checkpoints
|
||||
@@ -0,0 +1,31 @@
|
||||
# NOTE: This file is auto generated by OpenAPI Generator.
|
||||
# URL: https://openapi-generator.tech
|
||||
#
|
||||
# ref: https://docs.gitlab.com/ee/ci/README.html
|
||||
# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml
|
||||
|
||||
stages:
|
||||
- test
|
||||
|
||||
.pytest:
|
||||
stage: test
|
||||
script:
|
||||
- pip install -r requirements.txt
|
||||
- pip install -r test-requirements.txt
|
||||
- pytest --cov=openapi_client
|
||||
|
||||
pytest-3.7:
|
||||
extends: .pytest
|
||||
image: python:3.7-alpine
|
||||
pytest-3.8:
|
||||
extends: .pytest
|
||||
image: python:3.8-alpine
|
||||
pytest-3.9:
|
||||
extends: .pytest
|
||||
image: python:3.9-alpine
|
||||
pytest-3.10:
|
||||
extends: .pytest
|
||||
image: python:3.10-alpine
|
||||
pytest-3.11:
|
||||
extends: .pytest
|
||||
image: python:3.11-alpine
|
||||
@@ -0,0 +1,23 @@
|
||||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
@@ -0,0 +1,56 @@
|
||||
.github/workflows/python.yml
|
||||
.gitignore
|
||||
.gitlab-ci.yml
|
||||
.travis.yml
|
||||
README.md
|
||||
docs/AuthApi.md
|
||||
docs/Bird.md
|
||||
docs/BodyApi.md
|
||||
docs/Category.md
|
||||
docs/DataQuery.md
|
||||
docs/DefaultValue.md
|
||||
docs/FormApi.md
|
||||
docs/HeaderApi.md
|
||||
docs/NumberPropertiesOnly.md
|
||||
docs/PathApi.md
|
||||
docs/Pet.md
|
||||
docs/Query.md
|
||||
docs/QueryApi.md
|
||||
docs/StringEnumRef.md
|
||||
docs/Tag.md
|
||||
docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md
|
||||
docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
|
||||
git_push.sh
|
||||
openapi_client/__init__.py
|
||||
openapi_client/api/__init__.py
|
||||
openapi_client/api/auth_api.py
|
||||
openapi_client/api/body_api.py
|
||||
openapi_client/api/form_api.py
|
||||
openapi_client/api/header_api.py
|
||||
openapi_client/api/path_api.py
|
||||
openapi_client/api/query_api.py
|
||||
openapi_client/api_client.py
|
||||
openapi_client/api_response.py
|
||||
openapi_client/configuration.py
|
||||
openapi_client/exceptions.py
|
||||
openapi_client/models/__init__.py
|
||||
openapi_client/models/bird.py
|
||||
openapi_client/models/category.py
|
||||
openapi_client/models/data_query.py
|
||||
openapi_client/models/default_value.py
|
||||
openapi_client/models/number_properties_only.py
|
||||
openapi_client/models/pet.py
|
||||
openapi_client/models/query.py
|
||||
openapi_client/models/string_enum_ref.py
|
||||
openapi_client/models/tag.py
|
||||
openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py
|
||||
openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py
|
||||
openapi_client/py.typed
|
||||
openapi_client/rest.py
|
||||
pyproject.toml
|
||||
requirements.txt
|
||||
setup.cfg
|
||||
setup.py
|
||||
test-requirements.txt
|
||||
test/__init__.py
|
||||
tox.ini
|
||||
@@ -0,0 +1 @@
|
||||
7.3.0-SNAPSHOT
|
||||
@@ -0,0 +1,17 @@
|
||||
# ref: https://docs.travis-ci.com/user/languages/python
|
||||
language: python
|
||||
python:
|
||||
- "3.7"
|
||||
- "3.8"
|
||||
- "3.9"
|
||||
- "3.10"
|
||||
- "3.11"
|
||||
# uncomment the following if needed
|
||||
#- "3.11-dev" # 3.11 development branch
|
||||
#- "nightly" # nightly build
|
||||
# command to install dependencies
|
||||
install:
|
||||
- "pip install -r requirements.txt"
|
||||
- "pip install -r test-requirements.txt"
|
||||
# command to run tests
|
||||
script: pytest --cov=openapi_client
|
||||
@@ -0,0 +1,156 @@
|
||||
# openapi-client
|
||||
Echo Server API
|
||||
|
||||
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||
|
||||
- API version: 0.1.0
|
||||
- Package version: 1.0.0
|
||||
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
|
||||
|
||||
## Requirements.
|
||||
|
||||
Python 3.7+
|
||||
|
||||
## Installation & Usage
|
||||
### pip install
|
||||
|
||||
If the python package is hosted on a repository, you can install directly using:
|
||||
|
||||
```sh
|
||||
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
|
||||
```
|
||||
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
|
||||
|
||||
Then import the package:
|
||||
```python
|
||||
import openapi_client
|
||||
```
|
||||
|
||||
### Setuptools
|
||||
|
||||
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
|
||||
|
||||
```sh
|
||||
python setup.py install --user
|
||||
```
|
||||
(or `sudo python setup.py install` to install the package for all users)
|
||||
|
||||
Then import the package:
|
||||
```python
|
||||
import openapi_client
|
||||
```
|
||||
|
||||
### Tests
|
||||
|
||||
Execute `pytest` to run the tests.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation procedure](#installation--usage) and then run the following:
|
||||
|
||||
```python
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
# The client must configure the authentication and authorization parameters
|
||||
# in accordance with the API server security policy.
|
||||
# Examples for each auth method are provided below, use the example that
|
||||
# satisfies your auth use case.
|
||||
|
||||
# Configure HTTP basic authorization: http_auth
|
||||
configuration = openapi_client.Configuration(
|
||||
username = os.environ["USERNAME"],
|
||||
password = os.environ["PASSWORD"]
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.AuthApi(api_client)
|
||||
|
||||
try:
|
||||
# To test HTTP basic authentication
|
||||
api_response = api_instance.test_auth_http_basic()
|
||||
print("The response of AuthApi->test_auth_http_basic:\n")
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print("Exception when calling AuthApi->test_auth_http_basic: %s\n" % e)
|
||||
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*AuthApi* | [**test_auth_http_basic**](docs/AuthApi.md#test_auth_http_basic) | **POST** /auth/http/basic | To test HTTP basic authentication
|
||||
*AuthApi* | [**test_auth_http_bearer**](docs/AuthApi.md#test_auth_http_bearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication
|
||||
*BodyApi* | [**test_binary_gif**](docs/BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
|
||||
*BodyApi* | [**test_body_application_octetstream_binary**](docs/BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
|
||||
*BodyApi* | [**test_body_multipart_formdata_array_of_binary**](docs/BodyApi.md#test_body_multipart_formdata_array_of_binary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
|
||||
*BodyApi* | [**test_body_multipart_formdata_single_binary**](docs/BodyApi.md#test_body_multipart_formdata_single_binary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime
|
||||
*BodyApi* | [**test_echo_body_all_of_pet**](docs/BodyApi.md#test_echo_body_all_of_pet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
|
||||
*BodyApi* | [**test_echo_body_free_form_object_response_string**](docs/BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
||||
*BodyApi* | [**test_echo_body_pet**](docs/BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
|
||||
*BodyApi* | [**test_echo_body_pet_response_string**](docs/BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body
|
||||
*BodyApi* | [**test_echo_body_tag_response_string**](docs/BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
|
||||
*FormApi* | [**test_form_integer_boolean_string**](docs/FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s)
|
||||
*FormApi* | [**test_form_oneof**](docs/FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
|
||||
*HeaderApi* | [**test_header_integer_boolean_string_enums**](docs/HeaderApi.md#test_header_integer_boolean_string_enums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s)
|
||||
*PathApi* | [**tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**](docs/PathApi.md#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s)
|
||||
*QueryApi* | [**test_enum_ref_string**](docs/QueryApi.md#test_enum_ref_string) | **GET** /query/enum_ref_string | Test query parameter(s)
|
||||
*QueryApi* | [**test_query_datetime_date_string**](docs/QueryApi.md#test_query_datetime_date_string) | **GET** /query/datetime/date/string | Test query parameter(s)
|
||||
*QueryApi* | [**test_query_integer_boolean_string**](docs/QueryApi.md#test_query_integer_boolean_string) | **GET** /query/integer/boolean/string | Test query parameter(s)
|
||||
*QueryApi* | [**test_query_style_deep_object_explode_true_object**](docs/QueryApi.md#test_query_style_deep_object_explode_true_object) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s)
|
||||
*QueryApi* | [**test_query_style_deep_object_explode_true_object_all_of**](docs/QueryApi.md#test_query_style_deep_object_explode_true_object_all_of) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s)
|
||||
*QueryApi* | [**test_query_style_form_explode_true_array_string**](docs/QueryApi.md#test_query_style_form_explode_true_array_string) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
|
||||
*QueryApi* | [**test_query_style_form_explode_true_object**](docs/QueryApi.md#test_query_style_form_explode_true_object) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
|
||||
*QueryApi* | [**test_query_style_form_explode_true_object_all_of**](docs/QueryApi.md#test_query_style_form_explode_true_object_all_of) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s)
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [Bird](docs/Bird.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [DataQuery](docs/DataQuery.md)
|
||||
- [DefaultValue](docs/DefaultValue.md)
|
||||
- [NumberPropertiesOnly](docs/NumberPropertiesOnly.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
- [Query](docs/Query.md)
|
||||
- [StringEnumRef](docs/StringEnumRef.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md)
|
||||
- [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md)
|
||||
|
||||
|
||||
<a id="documentation-for-authorization"></a>
|
||||
## Documentation For Authorization
|
||||
|
||||
|
||||
Authentication schemes defined for the API:
|
||||
<a id="http_auth"></a>
|
||||
### http_auth
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
<a id="http_bearer_auth"></a>
|
||||
### http_bearer_auth
|
||||
|
||||
- **Type**: Bearer authentication
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
team@openapitools.org
|
||||
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
# openapi_client.AuthApi
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**test_auth_http_basic**](AuthApi.md#test_auth_http_basic) | **POST** /auth/http/basic | To test HTTP basic authentication
|
||||
[**test_auth_http_bearer**](AuthApi.md#test_auth_http_bearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication
|
||||
|
||||
|
||||
# **test_auth_http_basic**
|
||||
> str test_auth_http_basic()
|
||||
|
||||
To test HTTP basic authentication
|
||||
|
||||
To test HTTP basic authentication
|
||||
|
||||
### Example
|
||||
|
||||
* Basic Authentication (http_auth):
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
# The client must configure the authentication and authorization parameters
|
||||
# in accordance with the API server security policy.
|
||||
# Examples for each auth method are provided below, use the example that
|
||||
# satisfies your auth use case.
|
||||
|
||||
# Configure HTTP basic authorization: http_auth
|
||||
configuration = openapi_client.Configuration(
|
||||
username = os.environ["USERNAME"],
|
||||
password = os.environ["PASSWORD"]
|
||||
)
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.AuthApi(api_client)
|
||||
|
||||
try:
|
||||
# To test HTTP basic authentication
|
||||
api_response = api_instance.test_auth_http_basic()
|
||||
print("The response of AuthApi->test_auth_http_basic:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling AuthApi->test_auth_http_basic: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
[http_auth](../README.md#http_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_auth_http_bearer**
|
||||
> str test_auth_http_bearer()
|
||||
|
||||
To test HTTP bearer authentication
|
||||
|
||||
To test HTTP bearer authentication
|
||||
|
||||
### Example
|
||||
|
||||
* Bearer Authentication (http_bearer_auth):
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
# The client must configure the authentication and authorization parameters
|
||||
# in accordance with the API server security policy.
|
||||
# Examples for each auth method are provided below, use the example that
|
||||
# satisfies your auth use case.
|
||||
|
||||
# Configure Bearer authorization: http_bearer_auth
|
||||
configuration = openapi_client.Configuration(
|
||||
access_token = os.environ["BEARER_TOKEN"]
|
||||
)
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.AuthApi(api_client)
|
||||
|
||||
try:
|
||||
# To test HTTP bearer authentication
|
||||
api_response = api_instance.test_auth_http_bearer()
|
||||
print("The response of AuthApi->test_auth_http_bearer:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling AuthApi->test_auth_http_bearer: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
[http_bearer_auth](../README.md#http_bearer_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# Bird
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**size** | **str** | | [optional]
|
||||
**color** | **str** | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from openapi_client.models.bird import Bird
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of Bird from a JSON string
|
||||
bird_instance = Bird.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print Bird.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
bird_dict = bird_instance.to_dict()
|
||||
# create an instance of Bird from a dict
|
||||
bird_form_dict = bird.from_dict(bird_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)
|
||||
|
||||
|
||||
@@ -0,0 +1,620 @@
|
||||
# openapi_client.BodyApi
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**test_binary_gif**](BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
|
||||
[**test_body_application_octetstream_binary**](BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
|
||||
[**test_body_multipart_formdata_array_of_binary**](BodyApi.md#test_body_multipart_formdata_array_of_binary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
|
||||
[**test_body_multipart_formdata_single_binary**](BodyApi.md#test_body_multipart_formdata_single_binary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime
|
||||
[**test_echo_body_all_of_pet**](BodyApi.md#test_echo_body_all_of_pet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
|
||||
[**test_echo_body_free_form_object_response_string**](BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
||||
[**test_echo_body_pet**](BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
|
||||
[**test_echo_body_pet_response_string**](BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body
|
||||
[**test_echo_body_tag_response_string**](BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
|
||||
|
||||
|
||||
# **test_binary_gif**
|
||||
> bytearray test_binary_gif()
|
||||
|
||||
Test binary (gif) response body
|
||||
|
||||
Test binary (gif) response body
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.BodyApi(api_client)
|
||||
|
||||
try:
|
||||
# Test binary (gif) response body
|
||||
api_response = api_instance.test_binary_gif()
|
||||
print("The response of BodyApi->test_binary_gif:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling BodyApi->test_binary_gif: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
**bytearray**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: image/gif
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_body_application_octetstream_binary**
|
||||
> str test_body_application_octetstream_binary(body=body)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.BodyApi(api_client)
|
||||
body = None # bytearray | (optional)
|
||||
|
||||
try:
|
||||
# Test body parameter(s)
|
||||
api_response = api_instance.test_body_application_octetstream_binary(body=body)
|
||||
print("The response of BodyApi->test_body_application_octetstream_binary:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling BodyApi->test_body_application_octetstream_binary: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | **bytearray**| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/octet-stream
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_body_multipart_formdata_array_of_binary**
|
||||
> str test_body_multipart_formdata_array_of_binary(files)
|
||||
|
||||
Test array of binary in multipart mime
|
||||
|
||||
Test array of binary in multipart mime
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.BodyApi(api_client)
|
||||
files = None # List[bytearray] |
|
||||
|
||||
try:
|
||||
# Test array of binary in multipart mime
|
||||
api_response = api_instance.test_body_multipart_formdata_array_of_binary(files)
|
||||
print("The response of BodyApi->test_body_multipart_formdata_array_of_binary:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling BodyApi->test_body_multipart_formdata_array_of_binary: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**files** | **List[bytearray]**| |
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_body_multipart_formdata_single_binary**
|
||||
> str test_body_multipart_formdata_single_binary(my_file=my_file)
|
||||
|
||||
Test single binary in multipart mime
|
||||
|
||||
Test single binary in multipart mime
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.BodyApi(api_client)
|
||||
my_file = None # bytearray | (optional)
|
||||
|
||||
try:
|
||||
# Test single binary in multipart mime
|
||||
api_response = api_instance.test_body_multipart_formdata_single_binary(my_file=my_file)
|
||||
print("The response of BodyApi->test_body_multipart_formdata_single_binary:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling BodyApi->test_body_multipart_formdata_single_binary: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**my_file** | **bytearray**| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_echo_body_all_of_pet**
|
||||
> Pet test_echo_body_all_of_pet(pet=pet)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.models.pet import Pet
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.BodyApi(api_client)
|
||||
pet = openapi_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
|
||||
|
||||
try:
|
||||
# Test body parameter(s)
|
||||
api_response = api_instance.test_echo_body_all_of_pet(pet=pet)
|
||||
print("The response of BodyApi->test_echo_body_all_of_pet:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling BodyApi->test_echo_body_all_of_pet: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/json
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_echo_body_free_form_object_response_string**
|
||||
> str test_echo_body_free_form_object_response_string(body=body)
|
||||
|
||||
Test free form object
|
||||
|
||||
Test free form object
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.BodyApi(api_client)
|
||||
body = None # object | Free form object (optional)
|
||||
|
||||
try:
|
||||
# Test free form object
|
||||
api_response = api_instance.test_echo_body_free_form_object_response_string(body=body)
|
||||
print("The response of BodyApi->test_echo_body_free_form_object_response_string:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling BodyApi->test_echo_body_free_form_object_response_string: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | **object**| Free form object | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_echo_body_pet**
|
||||
> Pet test_echo_body_pet(pet=pet)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.models.pet import Pet
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.BodyApi(api_client)
|
||||
pet = openapi_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
|
||||
|
||||
try:
|
||||
# Test body parameter(s)
|
||||
api_response = api_instance.test_echo_body_pet(pet=pet)
|
||||
print("The response of BodyApi->test_echo_body_pet:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling BodyApi->test_echo_body_pet: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/json
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_echo_body_pet_response_string**
|
||||
> str test_echo_body_pet_response_string(pet=pet)
|
||||
|
||||
Test empty response body
|
||||
|
||||
Test empty response body
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.models.pet import Pet
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.BodyApi(api_client)
|
||||
pet = openapi_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
|
||||
|
||||
try:
|
||||
# Test empty response body
|
||||
api_response = api_instance.test_echo_body_pet_response_string(pet=pet)
|
||||
print("The response of BodyApi->test_echo_body_pet_response_string:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling BodyApi->test_echo_body_pet_response_string: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_echo_body_tag_response_string**
|
||||
> str test_echo_body_tag_response_string(tag=tag)
|
||||
|
||||
Test empty json (request body)
|
||||
|
||||
Test empty json (request body)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.models.tag import Tag
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.BodyApi(api_client)
|
||||
tag = openapi_client.Tag() # Tag | Tag object (optional)
|
||||
|
||||
try:
|
||||
# Test empty json (request body)
|
||||
api_response = api_instance.test_echo_body_tag_response_string(tag=tag)
|
||||
print("The response of BodyApi->test_echo_body_tag_response_string:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling BodyApi->test_echo_body_tag_response_string: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tag** | [**Tag**](Tag.md)| Tag object | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# Category
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**name** | **str** | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from openapi_client.models.category import Category
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of Category from a JSON string
|
||||
category_instance = Category.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print Category.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
category_dict = category_instance.to_dict()
|
||||
# create an instance of Category from a dict
|
||||
category_form_dict = category.from_dict(category_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)
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# DataQuery
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**suffix** | **str** | test suffix | [optional]
|
||||
**text** | **str** | Some text containing white spaces | [optional]
|
||||
**var_date** | **datetime** | A date | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from openapi_client.models.data_query import DataQuery
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of DataQuery from a JSON string
|
||||
data_query_instance = DataQuery.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print DataQuery.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
data_query_dict = data_query_instance.to_dict()
|
||||
# create an instance of DataQuery from a dict
|
||||
data_query_form_dict = data_query.from_dict(data_query_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)
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# DefaultValue
|
||||
|
||||
to test the default value of properties
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**array_string_enum_ref_default** | [**List[StringEnumRef]**](StringEnumRef.md) | | [optional] [default to ["success","failure"]]
|
||||
**array_string_enum_default** | **List[str]** | | [optional] [default to ["success","failure"]]
|
||||
**array_string_default** | **List[str]** | | [optional] [default to ["failure","skipped"]]
|
||||
**array_integer_default** | **List[int]** | | [optional] [default to [1,3]]
|
||||
**array_string** | **List[str]** | | [optional]
|
||||
**array_string_nullable** | **List[str]** | | [optional]
|
||||
**array_string_extension_nullable** | **List[str]** | | [optional]
|
||||
**string_nullable** | **str** | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from openapi_client.models.default_value import DefaultValue
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of DefaultValue from a JSON string
|
||||
default_value_instance = DefaultValue.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print DefaultValue.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
default_value_dict = default_value_instance.to_dict()
|
||||
# create an instance of DefaultValue from a dict
|
||||
default_value_form_dict = default_value.from_dict(default_value_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)
|
||||
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
# openapi_client.FormApi
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**test_form_integer_boolean_string**](FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s)
|
||||
[**test_form_oneof**](FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
|
||||
|
||||
|
||||
# **test_form_integer_boolean_string**
|
||||
> str test_form_integer_boolean_string(integer_form=integer_form, boolean_form=boolean_form, string_form=string_form)
|
||||
|
||||
Test form parameter(s)
|
||||
|
||||
Test form parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.FormApi(api_client)
|
||||
integer_form = 56 # int | (optional)
|
||||
boolean_form = True # bool | (optional)
|
||||
string_form = 'string_form_example' # str | (optional)
|
||||
|
||||
try:
|
||||
# Test form parameter(s)
|
||||
api_response = api_instance.test_form_integer_boolean_string(integer_form=integer_form, boolean_form=boolean_form, string_form=string_form)
|
||||
print("The response of FormApi->test_form_integer_boolean_string:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling FormApi->test_form_integer_boolean_string: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**integer_form** | **int**| | [optional]
|
||||
**boolean_form** | **bool**| | [optional]
|
||||
**string_form** | **str**| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_form_oneof**
|
||||
> str test_form_oneof(form1=form1, form2=form2, form3=form3, form4=form4, id=id, name=name)
|
||||
|
||||
Test form parameter(s) for oneOf schema
|
||||
|
||||
Test form parameter(s) for oneOf schema
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.FormApi(api_client)
|
||||
form1 = 'form1_example' # str | (optional)
|
||||
form2 = 56 # int | (optional)
|
||||
form3 = 'form3_example' # str | (optional)
|
||||
form4 = True # bool | (optional)
|
||||
id = 56 # int | (optional)
|
||||
name = 'name_example' # str | (optional)
|
||||
|
||||
try:
|
||||
# Test form parameter(s) for oneOf schema
|
||||
api_response = api_instance.test_form_oneof(form1=form1, form2=form2, form3=form3, form4=form4, id=id, name=name)
|
||||
print("The response of FormApi->test_form_oneof:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling FormApi->test_form_oneof: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**form1** | **str**| | [optional]
|
||||
**form2** | **int**| | [optional]
|
||||
**form3** | **str**| | [optional]
|
||||
**form4** | **bool**| | [optional]
|
||||
**id** | **int**| | [optional]
|
||||
**name** | **str**| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
# openapi_client.HeaderApi
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**test_header_integer_boolean_string_enums**](HeaderApi.md#test_header_integer_boolean_string_enums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s)
|
||||
|
||||
|
||||
# **test_header_integer_boolean_string_enums**
|
||||
> str test_header_integer_boolean_string_enums(integer_header=integer_header, boolean_header=boolean_header, string_header=string_header, enum_nonref_string_header=enum_nonref_string_header, enum_ref_string_header=enum_ref_string_header)
|
||||
|
||||
Test header parameter(s)
|
||||
|
||||
Test header parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.models.string_enum_ref import StringEnumRef
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.HeaderApi(api_client)
|
||||
integer_header = 56 # int | (optional)
|
||||
boolean_header = True # bool | (optional)
|
||||
string_header = 'string_header_example' # str | (optional)
|
||||
enum_nonref_string_header = 'enum_nonref_string_header_example' # str | (optional)
|
||||
enum_ref_string_header = openapi_client.StringEnumRef() # StringEnumRef | (optional)
|
||||
|
||||
try:
|
||||
# Test header parameter(s)
|
||||
api_response = api_instance.test_header_integer_boolean_string_enums(integer_header=integer_header, boolean_header=boolean_header, string_header=string_header, enum_nonref_string_header=enum_nonref_string_header, enum_ref_string_header=enum_ref_string_header)
|
||||
print("The response of HeaderApi->test_header_integer_boolean_string_enums:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling HeaderApi->test_header_integer_boolean_string_enums: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**integer_header** | **int**| | [optional]
|
||||
**boolean_header** | **bool**| | [optional]
|
||||
**string_header** | **str**| | [optional]
|
||||
**enum_nonref_string_header** | **str**| | [optional]
|
||||
**enum_ref_string_header** | [**StringEnumRef**](.md)| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# NumberPropertiesOnly
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**number** | **float** | | [optional]
|
||||
**var_float** | **float** | | [optional]
|
||||
**double** | **float** | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from openapi_client.models.number_properties_only import NumberPropertiesOnly
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of NumberPropertiesOnly from a JSON string
|
||||
number_properties_only_instance = NumberPropertiesOnly.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print NumberPropertiesOnly.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
number_properties_only_dict = number_properties_only_instance.to_dict()
|
||||
# create an instance of NumberPropertiesOnly from a dict
|
||||
number_properties_only_form_dict = number_properties_only.from_dict(number_properties_only_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)
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
# openapi_client.PathApi
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**](PathApi.md#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s)
|
||||
|
||||
|
||||
# **tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**
|
||||
> str tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path)
|
||||
|
||||
Test path parameter(s)
|
||||
|
||||
Test path parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.models.string_enum_ref import StringEnumRef
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.PathApi(api_client)
|
||||
path_string = 'path_string_example' # str |
|
||||
path_integer = 56 # int |
|
||||
enum_nonref_string_path = 'enum_nonref_string_path_example' # str |
|
||||
enum_ref_string_path = openapi_client.StringEnumRef() # StringEnumRef |
|
||||
|
||||
try:
|
||||
# Test path parameter(s)
|
||||
api_response = api_instance.tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path)
|
||||
print("The response of PathApi->tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling PathApi->tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**path_string** | **str**| |
|
||||
**path_integer** | **int**| |
|
||||
**enum_nonref_string_path** | **str**| |
|
||||
**enum_ref_string_path** | [**StringEnumRef**](.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# Pet
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**name** | **str** | |
|
||||
**category** | [**Category**](Category.md) | | [optional]
|
||||
**photo_urls** | **List[str]** | |
|
||||
**tags** | [**List[Tag]**](Tag.md) | | [optional]
|
||||
**status** | **str** | pet status in the store | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from openapi_client.models.pet import Pet
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of Pet from a JSON string
|
||||
pet_instance = Pet.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print Pet.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
pet_dict = pet_instance.to_dict()
|
||||
# create an instance of Pet from a dict
|
||||
pet_form_dict = pet.from_dict(pet_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)
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# Query
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | Query | [optional]
|
||||
**outcomes** | **List[str]** | | [optional] [default to ["SUCCESS","FAILURE"]]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from openapi_client.models.query import Query
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of Query from a JSON string
|
||||
query_instance = Query.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print Query.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
query_dict = query_instance.to_dict()
|
||||
# create an instance of Query from a dict
|
||||
query_form_dict = query.from_dict(query_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)
|
||||
|
||||
|
||||
@@ -0,0 +1,566 @@
|
||||
# openapi_client.QueryApi
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**test_enum_ref_string**](QueryApi.md#test_enum_ref_string) | **GET** /query/enum_ref_string | Test query parameter(s)
|
||||
[**test_query_datetime_date_string**](QueryApi.md#test_query_datetime_date_string) | **GET** /query/datetime/date/string | Test query parameter(s)
|
||||
[**test_query_integer_boolean_string**](QueryApi.md#test_query_integer_boolean_string) | **GET** /query/integer/boolean/string | Test query parameter(s)
|
||||
[**test_query_style_deep_object_explode_true_object**](QueryApi.md#test_query_style_deep_object_explode_true_object) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s)
|
||||
[**test_query_style_deep_object_explode_true_object_all_of**](QueryApi.md#test_query_style_deep_object_explode_true_object_all_of) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s)
|
||||
[**test_query_style_form_explode_true_array_string**](QueryApi.md#test_query_style_form_explode_true_array_string) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
|
||||
[**test_query_style_form_explode_true_object**](QueryApi.md#test_query_style_form_explode_true_object) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
|
||||
[**test_query_style_form_explode_true_object_all_of**](QueryApi.md#test_query_style_form_explode_true_object_all_of) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s)
|
||||
|
||||
|
||||
# **test_enum_ref_string**
|
||||
> str test_enum_ref_string(enum_nonref_string_query=enum_nonref_string_query, enum_ref_string_query=enum_ref_string_query)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.models.string_enum_ref import StringEnumRef
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.QueryApi(api_client)
|
||||
enum_nonref_string_query = 'enum_nonref_string_query_example' # str | (optional)
|
||||
enum_ref_string_query = openapi_client.StringEnumRef() # StringEnumRef | (optional)
|
||||
|
||||
try:
|
||||
# Test query parameter(s)
|
||||
api_response = api_instance.test_enum_ref_string(enum_nonref_string_query=enum_nonref_string_query, enum_ref_string_query=enum_ref_string_query)
|
||||
print("The response of QueryApi->test_enum_ref_string:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling QueryApi->test_enum_ref_string: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**enum_nonref_string_query** | **str**| | [optional]
|
||||
**enum_ref_string_query** | [**StringEnumRef**](.md)| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_datetime_date_string**
|
||||
> str test_query_datetime_date_string(datetime_query=datetime_query, date_query=date_query, string_query=string_query)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.QueryApi(api_client)
|
||||
datetime_query = '2013-10-20T19:20:30+01:00' # datetime | (optional)
|
||||
date_query = '2013-10-20' # date | (optional)
|
||||
string_query = 'string_query_example' # str | (optional)
|
||||
|
||||
try:
|
||||
# Test query parameter(s)
|
||||
api_response = api_instance.test_query_datetime_date_string(datetime_query=datetime_query, date_query=date_query, string_query=string_query)
|
||||
print("The response of QueryApi->test_query_datetime_date_string:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling QueryApi->test_query_datetime_date_string: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**datetime_query** | **datetime**| | [optional]
|
||||
**date_query** | **date**| | [optional]
|
||||
**string_query** | **str**| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_integer_boolean_string**
|
||||
> str test_query_integer_boolean_string(integer_query=integer_query, boolean_query=boolean_query, string_query=string_query)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.QueryApi(api_client)
|
||||
integer_query = 56 # int | (optional)
|
||||
boolean_query = True # bool | (optional)
|
||||
string_query = 'string_query_example' # str | (optional)
|
||||
|
||||
try:
|
||||
# Test query parameter(s)
|
||||
api_response = api_instance.test_query_integer_boolean_string(integer_query=integer_query, boolean_query=boolean_query, string_query=string_query)
|
||||
print("The response of QueryApi->test_query_integer_boolean_string:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling QueryApi->test_query_integer_boolean_string: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**integer_query** | **int**| | [optional]
|
||||
**boolean_query** | **bool**| | [optional]
|
||||
**string_query** | **str**| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_style_deep_object_explode_true_object**
|
||||
> str test_query_style_deep_object_explode_true_object(query_object=query_object)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.models.pet import Pet
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.QueryApi(api_client)
|
||||
query_object = openapi_client.Pet() # Pet | (optional)
|
||||
|
||||
try:
|
||||
# Test query parameter(s)
|
||||
api_response = api_instance.test_query_style_deep_object_explode_true_object(query_object=query_object)
|
||||
print("The response of QueryApi->test_query_style_deep_object_explode_true_object:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling QueryApi->test_query_style_deep_object_explode_true_object: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**query_object** | [**Pet**](.md)| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_style_deep_object_explode_true_object_all_of**
|
||||
> str test_query_style_deep_object_explode_true_object_all_of(query_object=query_object)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.QueryApi(api_client)
|
||||
query_object = openapi_client.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() # TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter | (optional)
|
||||
|
||||
try:
|
||||
# Test query parameter(s)
|
||||
api_response = api_instance.test_query_style_deep_object_explode_true_object_all_of(query_object=query_object)
|
||||
print("The response of QueryApi->test_query_style_deep_object_explode_true_object_all_of:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling QueryApi->test_query_style_deep_object_explode_true_object_all_of: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**query_object** | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter**](.md)| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_style_form_explode_true_array_string**
|
||||
> str test_query_style_form_explode_true_array_string(query_object=query_object)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.QueryApi(api_client)
|
||||
query_object = openapi_client.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() # TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | (optional)
|
||||
|
||||
try:
|
||||
# Test query parameter(s)
|
||||
api_response = api_instance.test_query_style_form_explode_true_array_string(query_object=query_object)
|
||||
print("The response of QueryApi->test_query_style_form_explode_true_array_string:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling QueryApi->test_query_style_form_explode_true_array_string: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**query_object** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](.md)| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_style_form_explode_true_object**
|
||||
> str test_query_style_form_explode_true_object(query_object=query_object)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.models.pet import Pet
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.QueryApi(api_client)
|
||||
query_object = openapi_client.Pet() # Pet | (optional)
|
||||
|
||||
try:
|
||||
# Test query parameter(s)
|
||||
api_response = api_instance.test_query_style_form_explode_true_object(query_object=query_object)
|
||||
print("The response of QueryApi->test_query_style_form_explode_true_object:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling QueryApi->test_query_style_form_explode_true_object: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**query_object** | [**Pet**](.md)| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[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_style_form_explode_true_object_all_of**
|
||||
> str test_query_style_form_explode_true_object_all_of(query_object=query_object)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import openapi_client
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to http://localhost:3000
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = openapi_client.Configuration(
|
||||
host = "http://localhost:3000"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.QueryApi(api_client)
|
||||
query_object = openapi_client.DataQuery() # DataQuery | (optional)
|
||||
|
||||
try:
|
||||
# Test query parameter(s)
|
||||
api_response = api_instance.test_query_style_form_explode_true_object_all_of(query_object=query_object)
|
||||
print("The response of QueryApi->test_query_style_form_explode_true_object_all_of:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling QueryApi->test_query_style_form_explode_true_object_all_of: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**query_object** | [**DataQuery**](.md)| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# StringEnumRef
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# Tag
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**name** | **str** | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from openapi_client.models.tag import Tag
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of Tag from a JSON string
|
||||
tag_instance = Tag.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print Tag.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
tag_dict = tag_instance.to_dict()
|
||||
# create an instance of Tag from a dict
|
||||
tag_form_dict = tag.from_dict(tag_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)
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
# TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**size** | **str** | | [optional]
|
||||
**color** | **str** | | [optional]
|
||||
**id** | **int** | | [optional]
|
||||
**name** | **str** | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from a JSON string
|
||||
test_query_style_deep_object_explode_true_object_all_of_query_object_parameter_instance = TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
test_query_style_deep_object_explode_true_object_all_of_query_object_parameter_dict = test_query_style_deep_object_explode_true_object_all_of_query_object_parameter_instance.to_dict()
|
||||
# create an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from a dict
|
||||
test_query_style_deep_object_explode_true_object_all_of_query_object_parameter_form_dict = test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.from_dict(test_query_style_deep_object_explode_true_object_all_of_query_object_parameter_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)
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**values** | **List[str]** | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter from a JSON string
|
||||
test_query_style_form_explode_true_array_string_query_object_parameter_instance = TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
test_query_style_form_explode_true_array_string_query_object_parameter_dict = test_query_style_form_explode_true_array_string_query_object_parameter_instance.to_dict()
|
||||
# create an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter from a dict
|
||||
test_query_style_form_explode_true_array_string_query_object_parameter_form_dict = test_query_style_form_explode_true_array_string_query_object_parameter.from_dict(test_query_style_form_explode_true_array_string_query_object_parameter_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)
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
git_host=$4
|
||||
|
||||
if [ "$git_host" = "" ]; then
|
||||
git_host="github.com"
|
||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||
fi
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="GIT_USER_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=$(git remote)
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
@@ -0,0 +1,50 @@
|
||||
# coding: utf-8
|
||||
|
||||
# flake8: noqa
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
__version__ = "1.0.0"
|
||||
|
||||
# import apis into sdk package
|
||||
from openapi_client.api.auth_api import AuthApi
|
||||
from openapi_client.api.body_api import BodyApi
|
||||
from openapi_client.api.form_api import FormApi
|
||||
from openapi_client.api.header_api import HeaderApi
|
||||
from openapi_client.api.path_api import PathApi
|
||||
from openapi_client.api.query_api import QueryApi
|
||||
|
||||
# import ApiClient
|
||||
from openapi_client.api_response import ApiResponse
|
||||
from openapi_client.api_client import ApiClient
|
||||
from openapi_client.configuration import Configuration
|
||||
from openapi_client.exceptions import OpenApiException
|
||||
from openapi_client.exceptions import ApiTypeError
|
||||
from openapi_client.exceptions import ApiValueError
|
||||
from openapi_client.exceptions import ApiKeyError
|
||||
from openapi_client.exceptions import ApiAttributeError
|
||||
from openapi_client.exceptions import ApiException
|
||||
|
||||
# import models into sdk package
|
||||
from openapi_client.models.bird import Bird
|
||||
from openapi_client.models.category import Category
|
||||
from openapi_client.models.data_query import DataQuery
|
||||
from openapi_client.models.default_value import DefaultValue
|
||||
from openapi_client.models.number_properties_only import NumberPropertiesOnly
|
||||
from openapi_client.models.pet import Pet
|
||||
from openapi_client.models.query import Query
|
||||
from openapi_client.models.string_enum_ref import StringEnumRef
|
||||
from openapi_client.models.tag import Tag
|
||||
from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
|
||||
from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
@@ -0,0 +1,10 @@
|
||||
# flake8: noqa
|
||||
|
||||
# import apis into api package
|
||||
from openapi_client.api.auth_api import AuthApi
|
||||
from openapi_client.api.body_api import BodyApi
|
||||
from openapi_client.api.form_api import FormApi
|
||||
from openapi_client.api.header_api import HeaderApi
|
||||
from openapi_client.api.path_api import PathApi
|
||||
from openapi_client.api.query_api import QueryApi
|
||||
|
||||
@@ -0,0 +1,522 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
import warnings
|
||||
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
from typing_extensions import Annotated
|
||||
|
||||
|
||||
from openapi_client.api_client import ApiClient, RequestSerialized
|
||||
from openapi_client.api_response import ApiResponse
|
||||
from openapi_client.rest import RESTResponseType
|
||||
|
||||
|
||||
class AuthApi:
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator
|
||||
Ref: https://openapi-generator.tech
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, api_client=None) -> None:
|
||||
if api_client is None:
|
||||
api_client = ApiClient.get_default()
|
||||
self.api_client = api_client
|
||||
|
||||
|
||||
@validate_call
|
||||
def test_auth_http_basic(
|
||||
self,
|
||||
_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,
|
||||
) -> str:
|
||||
"""To test HTTP basic authentication
|
||||
|
||||
To test HTTP basic authentication
|
||||
|
||||
: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_auth_http_basic_serialize(
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
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_auth_http_basic_with_http_info(
|
||||
self,
|
||||
_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[str]:
|
||||
"""To test HTTP basic authentication
|
||||
|
||||
To test HTTP basic authentication
|
||||
|
||||
: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_auth_http_basic_serialize(
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
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_auth_http_basic_without_preload_content(
|
||||
self,
|
||||
_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:
|
||||
"""To test HTTP basic authentication
|
||||
|
||||
To test HTTP basic authentication
|
||||
|
||||
: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_auth_http_basic_serialize(
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
return response_data.response
|
||||
|
||||
|
||||
def _test_auth_http_basic_serialize(
|
||||
self,
|
||||
_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, str] = {}
|
||||
_body_params: Optional[bytes] = None
|
||||
|
||||
# process the path parameters
|
||||
# process the query parameters
|
||||
# process the header parameters
|
||||
# process the form parameters
|
||||
# process the body parameter
|
||||
|
||||
|
||||
# set the HTTP header `Accept`
|
||||
_header_params['Accept'] = self.api_client.select_header_accept(
|
||||
[
|
||||
'text/plain'
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# authentication setting
|
||||
_auth_settings: List[str] = [
|
||||
'http_auth'
|
||||
]
|
||||
|
||||
return self.api_client.param_serialize(
|
||||
method='POST',
|
||||
resource_path='/auth/http/basic',
|
||||
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_auth_http_bearer(
|
||||
self,
|
||||
_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,
|
||||
) -> str:
|
||||
"""To test HTTP bearer authentication
|
||||
|
||||
To test HTTP bearer authentication
|
||||
|
||||
: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_auth_http_bearer_serialize(
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
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_auth_http_bearer_with_http_info(
|
||||
self,
|
||||
_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[str]:
|
||||
"""To test HTTP bearer authentication
|
||||
|
||||
To test HTTP bearer authentication
|
||||
|
||||
: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_auth_http_bearer_serialize(
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
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_auth_http_bearer_without_preload_content(
|
||||
self,
|
||||
_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:
|
||||
"""To test HTTP bearer authentication
|
||||
|
||||
To test HTTP bearer authentication
|
||||
|
||||
: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_auth_http_bearer_serialize(
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
return response_data.response
|
||||
|
||||
|
||||
def _test_auth_http_bearer_serialize(
|
||||
self,
|
||||
_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, str] = {}
|
||||
_body_params: Optional[bytes] = None
|
||||
|
||||
# process the path parameters
|
||||
# process the query parameters
|
||||
# process the header parameters
|
||||
# process the form parameters
|
||||
# process the body parameter
|
||||
|
||||
|
||||
# set the HTTP header `Accept`
|
||||
_header_params['Accept'] = self.api_client.select_header_accept(
|
||||
[
|
||||
'text/plain'
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# authentication setting
|
||||
_auth_settings: List[str] = [
|
||||
'http_bearer_auth'
|
||||
]
|
||||
|
||||
return self.api_client.param_serialize(
|
||||
method='POST',
|
||||
resource_path='/auth/http/bearer',
|
||||
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
|
||||
)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,683 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
import warnings
|
||||
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from pydantic import StrictBool, StrictInt, StrictStr
|
||||
from typing import Optional
|
||||
|
||||
from openapi_client.api_client import ApiClient, RequestSerialized
|
||||
from openapi_client.api_response import ApiResponse
|
||||
from openapi_client.rest import RESTResponseType
|
||||
|
||||
|
||||
class FormApi:
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator
|
||||
Ref: https://openapi-generator.tech
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, api_client=None) -> None:
|
||||
if api_client is None:
|
||||
api_client = ApiClient.get_default()
|
||||
self.api_client = api_client
|
||||
|
||||
|
||||
@validate_call
|
||||
def test_form_integer_boolean_string(
|
||||
self,
|
||||
integer_form: Optional[StrictInt] = None,
|
||||
boolean_form: Optional[StrictBool] = None,
|
||||
string_form: Optional[StrictStr] = None,
|
||||
_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,
|
||||
) -> str:
|
||||
"""Test form parameter(s)
|
||||
|
||||
Test form parameter(s)
|
||||
|
||||
:param integer_form:
|
||||
:type integer_form: int
|
||||
:param boolean_form:
|
||||
:type boolean_form: bool
|
||||
:param string_form:
|
||||
:type string_form: str
|
||||
: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_form_integer_boolean_string_serialize(
|
||||
integer_form=integer_form,
|
||||
boolean_form=boolean_form,
|
||||
string_form=string_form,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
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_form_integer_boolean_string_with_http_info(
|
||||
self,
|
||||
integer_form: Optional[StrictInt] = None,
|
||||
boolean_form: Optional[StrictBool] = None,
|
||||
string_form: Optional[StrictStr] = None,
|
||||
_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[str]:
|
||||
"""Test form parameter(s)
|
||||
|
||||
Test form parameter(s)
|
||||
|
||||
:param integer_form:
|
||||
:type integer_form: int
|
||||
:param boolean_form:
|
||||
:type boolean_form: bool
|
||||
:param string_form:
|
||||
:type string_form: str
|
||||
: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_form_integer_boolean_string_serialize(
|
||||
integer_form=integer_form,
|
||||
boolean_form=boolean_form,
|
||||
string_form=string_form,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
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_form_integer_boolean_string_without_preload_content(
|
||||
self,
|
||||
integer_form: Optional[StrictInt] = None,
|
||||
boolean_form: Optional[StrictBool] = None,
|
||||
string_form: Optional[StrictStr] = None,
|
||||
_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 form parameter(s)
|
||||
|
||||
Test form parameter(s)
|
||||
|
||||
:param integer_form:
|
||||
:type integer_form: int
|
||||
:param boolean_form:
|
||||
:type boolean_form: bool
|
||||
:param string_form:
|
||||
:type string_form: str
|
||||
: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_form_integer_boolean_string_serialize(
|
||||
integer_form=integer_form,
|
||||
boolean_form=boolean_form,
|
||||
string_form=string_form,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
return response_data.response
|
||||
|
||||
|
||||
def _test_form_integer_boolean_string_serialize(
|
||||
self,
|
||||
integer_form,
|
||||
boolean_form,
|
||||
string_form,
|
||||
_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, str] = {}
|
||||
_body_params: Optional[bytes] = None
|
||||
|
||||
# process the path parameters
|
||||
# process the query parameters
|
||||
# process the header parameters
|
||||
# process the form parameters
|
||||
if integer_form is not None:
|
||||
_form_params.append(('integer_form', integer_form))
|
||||
if boolean_form is not None:
|
||||
_form_params.append(('boolean_form', boolean_form))
|
||||
if string_form is not None:
|
||||
_form_params.append(('string_form', string_form))
|
||||
# process the body parameter
|
||||
|
||||
|
||||
# set the HTTP header `Accept`
|
||||
_header_params['Accept'] = self.api_client.select_header_accept(
|
||||
[
|
||||
'text/plain'
|
||||
]
|
||||
)
|
||||
|
||||
# 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(
|
||||
[
|
||||
'application/x-www-form-urlencoded'
|
||||
]
|
||||
)
|
||||
)
|
||||
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='/form/integer/boolean/string',
|
||||
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_form_oneof(
|
||||
self,
|
||||
form1: Optional[StrictStr] = None,
|
||||
form2: Optional[StrictInt] = None,
|
||||
form3: Optional[StrictStr] = None,
|
||||
form4: Optional[StrictBool] = None,
|
||||
id: Optional[StrictInt] = None,
|
||||
name: Optional[StrictStr] = None,
|
||||
_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,
|
||||
) -> str:
|
||||
"""Test form parameter(s) for oneOf schema
|
||||
|
||||
Test form parameter(s) for oneOf schema
|
||||
|
||||
:param form1:
|
||||
:type form1: str
|
||||
:param form2:
|
||||
:type form2: int
|
||||
:param form3:
|
||||
:type form3: str
|
||||
:param form4:
|
||||
:type form4: bool
|
||||
:param id:
|
||||
:type id: int
|
||||
:param name:
|
||||
:type name: str
|
||||
: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_form_oneof_serialize(
|
||||
form1=form1,
|
||||
form2=form2,
|
||||
form3=form3,
|
||||
form4=form4,
|
||||
id=id,
|
||||
name=name,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
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_form_oneof_with_http_info(
|
||||
self,
|
||||
form1: Optional[StrictStr] = None,
|
||||
form2: Optional[StrictInt] = None,
|
||||
form3: Optional[StrictStr] = None,
|
||||
form4: Optional[StrictBool] = None,
|
||||
id: Optional[StrictInt] = None,
|
||||
name: Optional[StrictStr] = None,
|
||||
_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[str]:
|
||||
"""Test form parameter(s) for oneOf schema
|
||||
|
||||
Test form parameter(s) for oneOf schema
|
||||
|
||||
:param form1:
|
||||
:type form1: str
|
||||
:param form2:
|
||||
:type form2: int
|
||||
:param form3:
|
||||
:type form3: str
|
||||
:param form4:
|
||||
:type form4: bool
|
||||
:param id:
|
||||
:type id: int
|
||||
:param name:
|
||||
:type name: str
|
||||
: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_form_oneof_serialize(
|
||||
form1=form1,
|
||||
form2=form2,
|
||||
form3=form3,
|
||||
form4=form4,
|
||||
id=id,
|
||||
name=name,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
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_form_oneof_without_preload_content(
|
||||
self,
|
||||
form1: Optional[StrictStr] = None,
|
||||
form2: Optional[StrictInt] = None,
|
||||
form3: Optional[StrictStr] = None,
|
||||
form4: Optional[StrictBool] = None,
|
||||
id: Optional[StrictInt] = None,
|
||||
name: Optional[StrictStr] = None,
|
||||
_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 form parameter(s) for oneOf schema
|
||||
|
||||
Test form parameter(s) for oneOf schema
|
||||
|
||||
:param form1:
|
||||
:type form1: str
|
||||
:param form2:
|
||||
:type form2: int
|
||||
:param form3:
|
||||
:type form3: str
|
||||
:param form4:
|
||||
:type form4: bool
|
||||
:param id:
|
||||
:type id: int
|
||||
:param name:
|
||||
:type name: str
|
||||
: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_form_oneof_serialize(
|
||||
form1=form1,
|
||||
form2=form2,
|
||||
form3=form3,
|
||||
form4=form4,
|
||||
id=id,
|
||||
name=name,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
return response_data.response
|
||||
|
||||
|
||||
def _test_form_oneof_serialize(
|
||||
self,
|
||||
form1,
|
||||
form2,
|
||||
form3,
|
||||
form4,
|
||||
id,
|
||||
name,
|
||||
_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, str] = {}
|
||||
_body_params: Optional[bytes] = None
|
||||
|
||||
# process the path parameters
|
||||
# process the query parameters
|
||||
# process the header parameters
|
||||
# process the form parameters
|
||||
if form1 is not None:
|
||||
_form_params.append(('form1', form1))
|
||||
if form2 is not None:
|
||||
_form_params.append(('form2', form2))
|
||||
if form3 is not None:
|
||||
_form_params.append(('form3', form3))
|
||||
if form4 is not None:
|
||||
_form_params.append(('form4', form4))
|
||||
if id is not None:
|
||||
_form_params.append(('id', id))
|
||||
if name is not None:
|
||||
_form_params.append(('name', name))
|
||||
# process the body parameter
|
||||
|
||||
|
||||
# set the HTTP header `Accept`
|
||||
_header_params['Accept'] = self.api_client.select_header_accept(
|
||||
[
|
||||
'text/plain'
|
||||
]
|
||||
)
|
||||
|
||||
# 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(
|
||||
[
|
||||
'application/x-www-form-urlencoded'
|
||||
]
|
||||
)
|
||||
)
|
||||
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='/form/oneof',
|
||||
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
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,356 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
import warnings
|
||||
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from pydantic import StrictBool, StrictInt, StrictStr, field_validator
|
||||
from typing import Optional
|
||||
from openapi_client.models.string_enum_ref import StringEnumRef
|
||||
|
||||
from openapi_client.api_client import ApiClient, RequestSerialized
|
||||
from openapi_client.api_response import ApiResponse
|
||||
from openapi_client.rest import RESTResponseType
|
||||
|
||||
|
||||
class HeaderApi:
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator
|
||||
Ref: https://openapi-generator.tech
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, api_client=None) -> None:
|
||||
if api_client is None:
|
||||
api_client = ApiClient.get_default()
|
||||
self.api_client = api_client
|
||||
|
||||
|
||||
@validate_call
|
||||
def test_header_integer_boolean_string_enums(
|
||||
self,
|
||||
integer_header: Optional[StrictInt] = None,
|
||||
boolean_header: Optional[StrictBool] = None,
|
||||
string_header: Optional[StrictStr] = None,
|
||||
enum_nonref_string_header: Optional[StrictStr] = None,
|
||||
enum_ref_string_header: Optional[StringEnumRef] = None,
|
||||
_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,
|
||||
) -> str:
|
||||
"""Test header parameter(s)
|
||||
|
||||
Test header parameter(s)
|
||||
|
||||
:param integer_header:
|
||||
:type integer_header: int
|
||||
:param boolean_header:
|
||||
:type boolean_header: bool
|
||||
:param string_header:
|
||||
:type string_header: str
|
||||
:param enum_nonref_string_header:
|
||||
:type enum_nonref_string_header: str
|
||||
:param enum_ref_string_header:
|
||||
:type enum_ref_string_header: StringEnumRef
|
||||
: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_header_integer_boolean_string_enums_serialize(
|
||||
integer_header=integer_header,
|
||||
boolean_header=boolean_header,
|
||||
string_header=string_header,
|
||||
enum_nonref_string_header=enum_nonref_string_header,
|
||||
enum_ref_string_header=enum_ref_string_header,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
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_header_integer_boolean_string_enums_with_http_info(
|
||||
self,
|
||||
integer_header: Optional[StrictInt] = None,
|
||||
boolean_header: Optional[StrictBool] = None,
|
||||
string_header: Optional[StrictStr] = None,
|
||||
enum_nonref_string_header: Optional[StrictStr] = None,
|
||||
enum_ref_string_header: Optional[StringEnumRef] = None,
|
||||
_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[str]:
|
||||
"""Test header parameter(s)
|
||||
|
||||
Test header parameter(s)
|
||||
|
||||
:param integer_header:
|
||||
:type integer_header: int
|
||||
:param boolean_header:
|
||||
:type boolean_header: bool
|
||||
:param string_header:
|
||||
:type string_header: str
|
||||
:param enum_nonref_string_header:
|
||||
:type enum_nonref_string_header: str
|
||||
:param enum_ref_string_header:
|
||||
:type enum_ref_string_header: StringEnumRef
|
||||
: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_header_integer_boolean_string_enums_serialize(
|
||||
integer_header=integer_header,
|
||||
boolean_header=boolean_header,
|
||||
string_header=string_header,
|
||||
enum_nonref_string_header=enum_nonref_string_header,
|
||||
enum_ref_string_header=enum_ref_string_header,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
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_header_integer_boolean_string_enums_without_preload_content(
|
||||
self,
|
||||
integer_header: Optional[StrictInt] = None,
|
||||
boolean_header: Optional[StrictBool] = None,
|
||||
string_header: Optional[StrictStr] = None,
|
||||
enum_nonref_string_header: Optional[StrictStr] = None,
|
||||
enum_ref_string_header: Optional[StringEnumRef] = None,
|
||||
_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 header parameter(s)
|
||||
|
||||
Test header parameter(s)
|
||||
|
||||
:param integer_header:
|
||||
:type integer_header: int
|
||||
:param boolean_header:
|
||||
:type boolean_header: bool
|
||||
:param string_header:
|
||||
:type string_header: str
|
||||
:param enum_nonref_string_header:
|
||||
:type enum_nonref_string_header: str
|
||||
:param enum_ref_string_header:
|
||||
:type enum_ref_string_header: StringEnumRef
|
||||
: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_header_integer_boolean_string_enums_serialize(
|
||||
integer_header=integer_header,
|
||||
boolean_header=boolean_header,
|
||||
string_header=string_header,
|
||||
enum_nonref_string_header=enum_nonref_string_header,
|
||||
enum_ref_string_header=enum_ref_string_header,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
return response_data.response
|
||||
|
||||
|
||||
def _test_header_integer_boolean_string_enums_serialize(
|
||||
self,
|
||||
integer_header,
|
||||
boolean_header,
|
||||
string_header,
|
||||
enum_nonref_string_header,
|
||||
enum_ref_string_header,
|
||||
_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, str] = {}
|
||||
_body_params: Optional[bytes] = None
|
||||
|
||||
# process the path parameters
|
||||
# process the query parameters
|
||||
# process the header parameters
|
||||
if integer_header is not None:
|
||||
_header_params['integer_header'] = integer_header
|
||||
if boolean_header is not None:
|
||||
_header_params['boolean_header'] = boolean_header
|
||||
if string_header is not None:
|
||||
_header_params['string_header'] = string_header
|
||||
if enum_nonref_string_header is not None:
|
||||
_header_params['enum_nonref_string_header'] = enum_nonref_string_header
|
||||
if enum_ref_string_header is not None:
|
||||
_header_params['enum_ref_string_header'] = enum_ref_string_header
|
||||
# process the form parameters
|
||||
# process the body parameter
|
||||
|
||||
|
||||
# set the HTTP header `Accept`
|
||||
_header_params['Accept'] = self.api_client.select_header_accept(
|
||||
[
|
||||
'text/plain'
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# authentication setting
|
||||
_auth_settings: List[str] = [
|
||||
]
|
||||
|
||||
return self.api_client.param_serialize(
|
||||
method='GET',
|
||||
resource_path='/header/integer/boolean/string/enums',
|
||||
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
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,340 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
import warnings
|
||||
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from pydantic import StrictInt, StrictStr, field_validator
|
||||
from openapi_client.models.string_enum_ref import StringEnumRef
|
||||
|
||||
from openapi_client.api_client import ApiClient, RequestSerialized
|
||||
from openapi_client.api_response import ApiResponse
|
||||
from openapi_client.rest import RESTResponseType
|
||||
|
||||
|
||||
class PathApi:
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator
|
||||
Ref: https://openapi-generator.tech
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, api_client=None) -> None:
|
||||
if api_client is None:
|
||||
api_client = ApiClient.get_default()
|
||||
self.api_client = api_client
|
||||
|
||||
|
||||
@validate_call
|
||||
def tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(
|
||||
self,
|
||||
path_string: StrictStr,
|
||||
path_integer: StrictInt,
|
||||
enum_nonref_string_path: StrictStr,
|
||||
enum_ref_string_path: StringEnumRef,
|
||||
_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,
|
||||
) -> str:
|
||||
"""Test path parameter(s)
|
||||
|
||||
Test path parameter(s)
|
||||
|
||||
:param path_string: (required)
|
||||
:type path_string: str
|
||||
:param path_integer: (required)
|
||||
:type path_integer: int
|
||||
:param enum_nonref_string_path: (required)
|
||||
:type enum_nonref_string_path: str
|
||||
:param enum_ref_string_path: (required)
|
||||
:type enum_ref_string_path: StringEnumRef
|
||||
: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._tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_serialize(
|
||||
path_string=path_string,
|
||||
path_integer=path_integer,
|
||||
enum_nonref_string_path=enum_nonref_string_path,
|
||||
enum_ref_string_path=enum_ref_string_path,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
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 tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_with_http_info(
|
||||
self,
|
||||
path_string: StrictStr,
|
||||
path_integer: StrictInt,
|
||||
enum_nonref_string_path: StrictStr,
|
||||
enum_ref_string_path: StringEnumRef,
|
||||
_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[str]:
|
||||
"""Test path parameter(s)
|
||||
|
||||
Test path parameter(s)
|
||||
|
||||
:param path_string: (required)
|
||||
:type path_string: str
|
||||
:param path_integer: (required)
|
||||
:type path_integer: int
|
||||
:param enum_nonref_string_path: (required)
|
||||
:type enum_nonref_string_path: str
|
||||
:param enum_ref_string_path: (required)
|
||||
:type enum_ref_string_path: StringEnumRef
|
||||
: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._tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_serialize(
|
||||
path_string=path_string,
|
||||
path_integer=path_integer,
|
||||
enum_nonref_string_path=enum_nonref_string_path,
|
||||
enum_ref_string_path=enum_ref_string_path,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
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 tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_without_preload_content(
|
||||
self,
|
||||
path_string: StrictStr,
|
||||
path_integer: StrictInt,
|
||||
enum_nonref_string_path: StrictStr,
|
||||
enum_ref_string_path: StringEnumRef,
|
||||
_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 path parameter(s)
|
||||
|
||||
Test path parameter(s)
|
||||
|
||||
:param path_string: (required)
|
||||
:type path_string: str
|
||||
:param path_integer: (required)
|
||||
:type path_integer: int
|
||||
:param enum_nonref_string_path: (required)
|
||||
:type enum_nonref_string_path: str
|
||||
:param enum_ref_string_path: (required)
|
||||
:type enum_ref_string_path: StringEnumRef
|
||||
: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._tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_serialize(
|
||||
path_string=path_string,
|
||||
path_integer=path_integer,
|
||||
enum_nonref_string_path=enum_nonref_string_path,
|
||||
enum_ref_string_path=enum_ref_string_path,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "str",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
return response_data.response
|
||||
|
||||
|
||||
def _tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_serialize(
|
||||
self,
|
||||
path_string,
|
||||
path_integer,
|
||||
enum_nonref_string_path,
|
||||
enum_ref_string_path,
|
||||
_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, str] = {}
|
||||
_body_params: Optional[bytes] = None
|
||||
|
||||
# process the path parameters
|
||||
if path_string is not None:
|
||||
_path_params['path_string'] = path_string
|
||||
if path_integer is not None:
|
||||
_path_params['path_integer'] = path_integer
|
||||
if enum_nonref_string_path is not None:
|
||||
_path_params['enum_nonref_string_path'] = enum_nonref_string_path
|
||||
if enum_ref_string_path is not None:
|
||||
_path_params['enum_ref_string_path'] = enum_ref_string_path.value
|
||||
# process the query parameters
|
||||
# process the header parameters
|
||||
# process the form parameters
|
||||
# process the body parameter
|
||||
|
||||
|
||||
# set the HTTP header `Accept`
|
||||
_header_params['Accept'] = self.api_client.select_header_accept(
|
||||
[
|
||||
'text/plain'
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# authentication setting
|
||||
_auth_settings: List[str] = [
|
||||
]
|
||||
|
||||
return self.api_client.param_serialize(
|
||||
method='GET',
|
||||
resource_path='/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}',
|
||||
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
|
||||
)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,738 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import datetime
|
||||
from dateutil.parser import parse
|
||||
import json
|
||||
import mimetypes
|
||||
import os
|
||||
import re
|
||||
import tempfile
|
||||
|
||||
from urllib.parse import quote
|
||||
from typing import Tuple, Optional, List, Dict
|
||||
|
||||
from openapi_client.configuration import Configuration
|
||||
from openapi_client.api_response import ApiResponse, T as ApiResponseT
|
||||
import openapi_client.models
|
||||
from openapi_client import rest
|
||||
from openapi_client.exceptions import (
|
||||
ApiValueError,
|
||||
ApiException,
|
||||
BadRequestException,
|
||||
UnauthorizedException,
|
||||
ForbiddenException,
|
||||
NotFoundException,
|
||||
ServiceException
|
||||
)
|
||||
|
||||
RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]]
|
||||
|
||||
class ApiClient:
|
||||
"""Generic API client for OpenAPI client library builds.
|
||||
|
||||
OpenAPI generic API client. This client handles the client-
|
||||
server communication, and is invariant across implementations. Specifics of
|
||||
the methods and models for each application are generated from the OpenAPI
|
||||
templates.
|
||||
|
||||
:param configuration: .Configuration object for this client
|
||||
:param header_name: a header to pass when making calls to the API.
|
||||
:param header_value: a header value to pass when making calls to
|
||||
the API.
|
||||
:param cookie: a cookie to include in the header when making calls
|
||||
to the API
|
||||
"""
|
||||
|
||||
PRIMITIVE_TYPES = (float, bool, bytes, str, int)
|
||||
NATIVE_TYPES_MAPPING = {
|
||||
'int': int,
|
||||
'long': int, # TODO remove as only py3 is supported?
|
||||
'float': float,
|
||||
'str': str,
|
||||
'bool': bool,
|
||||
'date': datetime.date,
|
||||
'datetime': datetime.datetime,
|
||||
'object': object,
|
||||
}
|
||||
_pool = None
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
configuration=None,
|
||||
header_name=None,
|
||||
header_value=None,
|
||||
cookie=None
|
||||
) -> None:
|
||||
# use default configuration if none is provided
|
||||
if configuration is None:
|
||||
configuration = Configuration.get_default()
|
||||
self.configuration = configuration
|
||||
|
||||
self.rest_client = rest.RESTClientObject(configuration)
|
||||
self.default_headers = {}
|
||||
if header_name is not None:
|
||||
self.default_headers[header_name] = header_value
|
||||
self.cookie = cookie
|
||||
# Set default User-Agent.
|
||||
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
||||
self.client_side_validation = configuration.client_side_validation
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
pass
|
||||
|
||||
@property
|
||||
def user_agent(self):
|
||||
"""User agent for this API client"""
|
||||
return self.default_headers['User-Agent']
|
||||
|
||||
@user_agent.setter
|
||||
def user_agent(self, value):
|
||||
self.default_headers['User-Agent'] = value
|
||||
|
||||
def set_default_header(self, header_name, header_value):
|
||||
self.default_headers[header_name] = header_value
|
||||
|
||||
|
||||
_default = None
|
||||
|
||||
@classmethod
|
||||
def get_default(cls):
|
||||
"""Return new instance of ApiClient.
|
||||
|
||||
This method returns newly created, based on default constructor,
|
||||
object of ApiClient class or returns a copy of default
|
||||
ApiClient.
|
||||
|
||||
:return: The ApiClient object.
|
||||
"""
|
||||
if cls._default is None:
|
||||
cls._default = ApiClient()
|
||||
return cls._default
|
||||
|
||||
@classmethod
|
||||
def set_default(cls, default):
|
||||
"""Set default instance of ApiClient.
|
||||
|
||||
It stores default ApiClient.
|
||||
|
||||
:param default: object of ApiClient.
|
||||
"""
|
||||
cls._default = default
|
||||
|
||||
def param_serialize(
|
||||
self,
|
||||
method,
|
||||
resource_path,
|
||||
path_params=None,
|
||||
query_params=None,
|
||||
header_params=None,
|
||||
body=None,
|
||||
post_params=None,
|
||||
files=None, auth_settings=None,
|
||||
collection_formats=None,
|
||||
_host=None,
|
||||
_request_auth=None
|
||||
) -> RequestSerialized:
|
||||
|
||||
"""Builds the HTTP request params needed by the request.
|
||||
:param method: Method to call.
|
||||
:param resource_path: Path to method endpoint.
|
||||
:param path_params: Path parameters in the url.
|
||||
:param query_params: Query parameters in the url.
|
||||
:param header_params: Header parameters to be
|
||||
placed in the request header.
|
||||
:param body: Request body.
|
||||
:param post_params dict: Request post form parameters,
|
||||
for `application/x-www-form-urlencoded`, `multipart/form-data`.
|
||||
:param auth_settings list: Auth Settings names for the request.
|
||||
:param files dict: key -> filename, value -> filepath,
|
||||
for `multipart/form-data`.
|
||||
:param collection_formats: dict of collection formats for path, query,
|
||||
header, and post parameters.
|
||||
: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.
|
||||
:return: tuple of form (path, http_method, query_params, header_params,
|
||||
body, post_params, files)
|
||||
"""
|
||||
|
||||
config = self.configuration
|
||||
|
||||
# header parameters
|
||||
header_params = header_params or {}
|
||||
header_params.update(self.default_headers)
|
||||
if self.cookie:
|
||||
header_params['Cookie'] = self.cookie
|
||||
if header_params:
|
||||
header_params = self.sanitize_for_serialization(header_params)
|
||||
header_params = dict(
|
||||
self.parameters_to_tuples(header_params,collection_formats)
|
||||
)
|
||||
|
||||
# path parameters
|
||||
if path_params:
|
||||
path_params = self.sanitize_for_serialization(path_params)
|
||||
path_params = self.parameters_to_tuples(
|
||||
path_params,
|
||||
collection_formats
|
||||
)
|
||||
for k, v in path_params:
|
||||
# specified safe chars, encode everything
|
||||
resource_path = resource_path.replace(
|
||||
'{%s}' % k,
|
||||
quote(str(v), safe=config.safe_chars_for_path_param)
|
||||
)
|
||||
|
||||
# post parameters
|
||||
if post_params or files:
|
||||
post_params = post_params if post_params else []
|
||||
post_params = self.sanitize_for_serialization(post_params)
|
||||
post_params = self.parameters_to_tuples(
|
||||
post_params,
|
||||
collection_formats
|
||||
)
|
||||
post_params.extend(self.files_parameters(files))
|
||||
|
||||
# auth setting
|
||||
self.update_params_for_auth(
|
||||
header_params,
|
||||
query_params,
|
||||
auth_settings,
|
||||
resource_path,
|
||||
method,
|
||||
body,
|
||||
request_auth=_request_auth
|
||||
)
|
||||
|
||||
# body
|
||||
if body:
|
||||
body = self.sanitize_for_serialization(body)
|
||||
|
||||
# request url
|
||||
if _host is None:
|
||||
url = self.configuration.host + resource_path
|
||||
else:
|
||||
# use server/host defined in path or operation instead
|
||||
url = _host + resource_path
|
||||
|
||||
# query parameters
|
||||
if query_params:
|
||||
query_params = self.sanitize_for_serialization(query_params)
|
||||
url_query = self.parameters_to_url_query(
|
||||
query_params,
|
||||
collection_formats
|
||||
)
|
||||
url += "?" + url_query
|
||||
|
||||
return method, url, header_params, body, post_params
|
||||
|
||||
|
||||
def call_api(
|
||||
self,
|
||||
method,
|
||||
url,
|
||||
header_params=None,
|
||||
body=None,
|
||||
post_params=None,
|
||||
_request_timeout=None
|
||||
) -> rest.RESTResponse:
|
||||
"""Makes the HTTP request (synchronous)
|
||||
:param method: Method to call.
|
||||
:param url: Path to method endpoint.
|
||||
:param header_params: Header parameters to be
|
||||
placed in the request header.
|
||||
:param body: Request body.
|
||||
:param post_params dict: Request post form parameters,
|
||||
for `application/x-www-form-urlencoded`, `multipart/form-data`.
|
||||
:param _request_timeout: timeout setting for this request.
|
||||
:return: RESTResponse
|
||||
"""
|
||||
|
||||
try:
|
||||
# perform request and return response
|
||||
response_data = self.rest_client.request(
|
||||
method, url,
|
||||
headers=header_params,
|
||||
body=body, post_params=post_params,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
|
||||
except ApiException as e:
|
||||
raise e
|
||||
|
||||
return response_data
|
||||
|
||||
def response_deserialize(
|
||||
self,
|
||||
response_data: rest.RESTResponse,
|
||||
response_types_map: Optional[Dict[str, ApiResponseT]]=None
|
||||
) -> ApiResponse[ApiResponseT]:
|
||||
"""Deserializes response into an object.
|
||||
:param response_data: RESTResponse object to be deserialized.
|
||||
:param response_types_map: dict of response types.
|
||||
:return: ApiResponse
|
||||
"""
|
||||
|
||||
msg = "RESTResponse.read() must be called before passing it to response_deserialize()"
|
||||
assert response_data.data is not None, msg
|
||||
|
||||
response_type = response_types_map.get(str(response_data.status), None)
|
||||
if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599:
|
||||
# if not found, look for '1XX', '2XX', etc.
|
||||
response_type = response_types_map.get(str(response_data.status)[0] + "XX", None)
|
||||
|
||||
# deserialize response data
|
||||
response_text = None
|
||||
return_data = None
|
||||
try:
|
||||
if response_type == "bytearray":
|
||||
return_data = response_data.data
|
||||
elif response_type == "file":
|
||||
return_data = self.__deserialize_file(response_data)
|
||||
elif response_type is not None:
|
||||
match = None
|
||||
content_type = response_data.getheader('content-type')
|
||||
if content_type is not None:
|
||||
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
|
||||
encoding = match.group(1) if match else "utf-8"
|
||||
response_text = response_data.data.decode(encoding)
|
||||
return_data = self.deserialize(response_text, response_type)
|
||||
finally:
|
||||
if not 200 <= response_data.status <= 299:
|
||||
raise ApiException.from_response(
|
||||
http_resp=response_data,
|
||||
body=response_text,
|
||||
data=return_data,
|
||||
)
|
||||
|
||||
return ApiResponse(
|
||||
status_code = response_data.status,
|
||||
data = return_data,
|
||||
headers = response_data.getheaders(),
|
||||
raw_data = response_data.data
|
||||
)
|
||||
|
||||
def sanitize_for_serialization(self, obj):
|
||||
"""Builds a JSON POST object.
|
||||
|
||||
If obj is None, return None.
|
||||
If obj is str, int, long, float, bool, return directly.
|
||||
If obj is datetime.datetime, datetime.date
|
||||
convert to string in iso8601 format.
|
||||
If obj is list, sanitize each element in the list.
|
||||
If obj is dict, return the dict.
|
||||
If obj is OpenAPI model, return the properties dict.
|
||||
|
||||
:param obj: The data to serialize.
|
||||
:return: The serialized form of data.
|
||||
"""
|
||||
if obj is None:
|
||||
return None
|
||||
elif isinstance(obj, self.PRIMITIVE_TYPES):
|
||||
return obj
|
||||
elif isinstance(obj, list):
|
||||
return [
|
||||
self.sanitize_for_serialization(sub_obj) for sub_obj in obj
|
||||
]
|
||||
elif isinstance(obj, tuple):
|
||||
return tuple(
|
||||
self.sanitize_for_serialization(sub_obj) for sub_obj in obj
|
||||
)
|
||||
elif isinstance(obj, (datetime.datetime, datetime.date)):
|
||||
return obj.isoformat()
|
||||
|
||||
elif isinstance(obj, dict):
|
||||
obj_dict = obj
|
||||
else:
|
||||
# Convert model obj to dict except
|
||||
# attributes `openapi_types`, `attribute_map`
|
||||
# and attributes which value is not None.
|
||||
# Convert attribute name to json key in
|
||||
# model definition for request.
|
||||
obj_dict = obj.to_dict()
|
||||
|
||||
return {
|
||||
key: self.sanitize_for_serialization(val)
|
||||
for key, val in obj_dict.items()
|
||||
}
|
||||
|
||||
def deserialize(self, response_text, response_type):
|
||||
"""Deserializes response into an object.
|
||||
|
||||
:param response: RESTResponse object to be deserialized.
|
||||
:param response_type: class literal for
|
||||
deserialized object, or string of class name.
|
||||
|
||||
:return: deserialized object.
|
||||
"""
|
||||
|
||||
# fetch data from response object
|
||||
try:
|
||||
data = json.loads(response_text)
|
||||
except ValueError:
|
||||
data = response_text
|
||||
|
||||
return self.__deserialize(data, response_type)
|
||||
|
||||
def __deserialize(self, data, klass):
|
||||
"""Deserializes dict, list, str into an object.
|
||||
|
||||
:param data: dict, list or str.
|
||||
:param klass: class literal, or string of class name.
|
||||
|
||||
:return: object.
|
||||
"""
|
||||
if data is None:
|
||||
return None
|
||||
|
||||
if isinstance(klass, str):
|
||||
if klass.startswith('List['):
|
||||
m = re.match(r'List\[(.*)]', klass)
|
||||
assert m is not None, "Malformed List type definition"
|
||||
sub_kls = m.group(1)
|
||||
return [self.__deserialize(sub_data, sub_kls)
|
||||
for sub_data in data]
|
||||
|
||||
if klass.startswith('Dict['):
|
||||
m = re.match(r'Dict\[([^,]*), (.*)]', klass)
|
||||
assert m is not None, "Malformed Dict type definition"
|
||||
sub_kls = m.group(2)
|
||||
return {k: self.__deserialize(v, sub_kls)
|
||||
for k, v in data.items()}
|
||||
|
||||
# convert str to class
|
||||
if klass in self.NATIVE_TYPES_MAPPING:
|
||||
klass = self.NATIVE_TYPES_MAPPING[klass]
|
||||
else:
|
||||
klass = getattr(openapi_client.models, klass)
|
||||
|
||||
if klass in self.PRIMITIVE_TYPES:
|
||||
return self.__deserialize_primitive(data, klass)
|
||||
elif klass == object:
|
||||
return self.__deserialize_object(data)
|
||||
elif klass == datetime.date:
|
||||
return self.__deserialize_date(data)
|
||||
elif klass == datetime.datetime:
|
||||
return self.__deserialize_datetime(data)
|
||||
else:
|
||||
return self.__deserialize_model(data, klass)
|
||||
|
||||
def parameters_to_tuples(self, params, collection_formats):
|
||||
"""Get parameters as list of tuples, formatting collections.
|
||||
|
||||
:param params: Parameters as dict or list of two-tuples
|
||||
:param dict collection_formats: Parameter collection formats
|
||||
:return: Parameters as list of tuples, collections formatted
|
||||
"""
|
||||
new_params: List[Tuple[str, str]] = []
|
||||
if collection_formats is None:
|
||||
collection_formats = {}
|
||||
for k, v in params.items() if isinstance(params, dict) else params:
|
||||
if k in collection_formats:
|
||||
collection_format = collection_formats[k]
|
||||
if collection_format == 'multi':
|
||||
new_params.extend((k, value) for value in v)
|
||||
else:
|
||||
if collection_format == 'ssv':
|
||||
delimiter = ' '
|
||||
elif collection_format == 'tsv':
|
||||
delimiter = '\t'
|
||||
elif collection_format == 'pipes':
|
||||
delimiter = '|'
|
||||
else: # csv is the default
|
||||
delimiter = ','
|
||||
new_params.append(
|
||||
(k, delimiter.join(str(value) for value in v)))
|
||||
else:
|
||||
new_params.append((k, v))
|
||||
return new_params
|
||||
|
||||
def parameters_to_url_query(self, params, collection_formats):
|
||||
"""Get parameters as list of tuples, formatting collections.
|
||||
|
||||
:param params: Parameters as dict or list of two-tuples
|
||||
:param dict collection_formats: Parameter collection formats
|
||||
:return: URL query string (e.g. a=Hello%20World&b=123)
|
||||
"""
|
||||
new_params: List[Tuple[str, str]] = []
|
||||
if collection_formats is None:
|
||||
collection_formats = {}
|
||||
for k, v in params.items() if isinstance(params, dict) else params:
|
||||
if isinstance(v, bool):
|
||||
v = str(v).lower()
|
||||
if isinstance(v, (int, float)):
|
||||
v = str(v)
|
||||
if isinstance(v, dict):
|
||||
v = json.dumps(v)
|
||||
|
||||
if k in collection_formats:
|
||||
collection_format = collection_formats[k]
|
||||
if collection_format == 'multi':
|
||||
new_params.extend((k, str(value)) for value in v)
|
||||
else:
|
||||
if collection_format == 'ssv':
|
||||
delimiter = ' '
|
||||
elif collection_format == 'tsv':
|
||||
delimiter = '\t'
|
||||
elif collection_format == 'pipes':
|
||||
delimiter = '|'
|
||||
else: # csv is the default
|
||||
delimiter = ','
|
||||
new_params.append(
|
||||
(k, delimiter.join(quote(str(value)) for value in v))
|
||||
)
|
||||
else:
|
||||
new_params.append((k, quote(str(v))))
|
||||
|
||||
return "&".join(["=".join(item) for item in new_params])
|
||||
|
||||
def files_parameters(self, files=None):
|
||||
"""Builds form parameters.
|
||||
|
||||
:param files: File parameters.
|
||||
:return: Form parameters with files.
|
||||
"""
|
||||
params = []
|
||||
|
||||
if files:
|
||||
for k, v in files.items():
|
||||
if not v:
|
||||
continue
|
||||
file_names = v if type(v) is list else [v]
|
||||
for n in file_names:
|
||||
with open(n, 'rb') as f:
|
||||
filename = os.path.basename(f.name)
|
||||
filedata = f.read()
|
||||
mimetype = (
|
||||
mimetypes.guess_type(filename)[0]
|
||||
or 'application/octet-stream'
|
||||
)
|
||||
params.append(
|
||||
tuple([k, tuple([filename, filedata, mimetype])])
|
||||
)
|
||||
|
||||
return params
|
||||
|
||||
def select_header_accept(self, accepts: List[str]) -> Optional[str]:
|
||||
"""Returns `Accept` based on an array of accepts provided.
|
||||
|
||||
:param accepts: List of headers.
|
||||
:return: Accept (e.g. application/json).
|
||||
"""
|
||||
if not accepts:
|
||||
return None
|
||||
|
||||
for accept in accepts:
|
||||
if re.search('json', accept, re.IGNORECASE):
|
||||
return accept
|
||||
|
||||
return accepts[0]
|
||||
|
||||
def select_header_content_type(self, content_types):
|
||||
"""Returns `Content-Type` based on an array of content_types provided.
|
||||
|
||||
:param content_types: List of content-types.
|
||||
:return: Content-Type (e.g. application/json).
|
||||
"""
|
||||
if not content_types:
|
||||
return None
|
||||
|
||||
for content_type in content_types:
|
||||
if re.search('json', content_type, re.IGNORECASE):
|
||||
return content_type
|
||||
|
||||
return content_types[0]
|
||||
|
||||
def update_params_for_auth(
|
||||
self,
|
||||
headers,
|
||||
queries,
|
||||
auth_settings,
|
||||
resource_path,
|
||||
method,
|
||||
body,
|
||||
request_auth=None
|
||||
) -> None:
|
||||
"""Updates header and query params based on authentication setting.
|
||||
|
||||
:param headers: Header parameters dict to be updated.
|
||||
:param queries: Query parameters tuple list to be updated.
|
||||
:param auth_settings: Authentication setting identifiers list.
|
||||
:resource_path: A string representation of the HTTP request resource path.
|
||||
:method: A string representation of the HTTP request method.
|
||||
:body: A object representing the body of the HTTP request.
|
||||
The object type is the return value of sanitize_for_serialization().
|
||||
:param request_auth: if set, the provided settings will
|
||||
override the token in the configuration.
|
||||
"""
|
||||
if not auth_settings:
|
||||
return
|
||||
|
||||
if request_auth:
|
||||
self._apply_auth_params(
|
||||
headers,
|
||||
queries,
|
||||
resource_path,
|
||||
method,
|
||||
body,
|
||||
request_auth
|
||||
)
|
||||
else:
|
||||
for auth in auth_settings:
|
||||
auth_setting = self.configuration.auth_settings().get(auth)
|
||||
if auth_setting:
|
||||
self._apply_auth_params(
|
||||
headers,
|
||||
queries,
|
||||
resource_path,
|
||||
method,
|
||||
body,
|
||||
auth_setting
|
||||
)
|
||||
|
||||
def _apply_auth_params(
|
||||
self,
|
||||
headers,
|
||||
queries,
|
||||
resource_path,
|
||||
method,
|
||||
body,
|
||||
auth_setting
|
||||
) -> None:
|
||||
"""Updates the request parameters based on a single auth_setting
|
||||
|
||||
:param headers: Header parameters dict to be updated.
|
||||
:param queries: Query parameters tuple list to be updated.
|
||||
:resource_path: A string representation of the HTTP request resource path.
|
||||
:method: A string representation of the HTTP request method.
|
||||
:body: A object representing the body of the HTTP request.
|
||||
The object type is the return value of sanitize_for_serialization().
|
||||
:param auth_setting: auth settings for the endpoint
|
||||
"""
|
||||
if auth_setting['in'] == 'cookie':
|
||||
headers['Cookie'] = auth_setting['value']
|
||||
elif auth_setting['in'] == 'header':
|
||||
if auth_setting['type'] != 'http-signature':
|
||||
headers[auth_setting['key']] = auth_setting['value']
|
||||
elif auth_setting['in'] == 'query':
|
||||
queries.append((auth_setting['key'], auth_setting['value']))
|
||||
else:
|
||||
raise ApiValueError(
|
||||
'Authentication token must be in `query` or `header`'
|
||||
)
|
||||
|
||||
def __deserialize_file(self, response):
|
||||
"""Deserializes body to file
|
||||
|
||||
Saves response body into a file in a temporary folder,
|
||||
using the filename from the `Content-Disposition` header if provided.
|
||||
|
||||
handle file downloading
|
||||
save response body into a tmp file and return the instance
|
||||
|
||||
:param response: RESTResponse.
|
||||
:return: file path.
|
||||
"""
|
||||
fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
|
||||
os.close(fd)
|
||||
os.remove(path)
|
||||
|
||||
content_disposition = response.getheader("Content-Disposition")
|
||||
if content_disposition:
|
||||
m = re.search(
|
||||
r'filename=[\'"]?([^\'"\s]+)[\'"]?',
|
||||
content_disposition
|
||||
)
|
||||
assert m is not None, "Unexpected 'content-disposition' header value"
|
||||
filename = m.group(1)
|
||||
path = os.path.join(os.path.dirname(path), filename)
|
||||
|
||||
with open(path, "wb") as f:
|
||||
f.write(response.data)
|
||||
|
||||
return path
|
||||
|
||||
def __deserialize_primitive(self, data, klass):
|
||||
"""Deserializes string to primitive type.
|
||||
|
||||
:param data: str.
|
||||
:param klass: class literal.
|
||||
|
||||
:return: int, long, float, str, bool.
|
||||
"""
|
||||
try:
|
||||
return klass(data)
|
||||
except UnicodeEncodeError:
|
||||
return str(data)
|
||||
except TypeError:
|
||||
return data
|
||||
|
||||
def __deserialize_object(self, value):
|
||||
"""Return an original value.
|
||||
|
||||
:return: object.
|
||||
"""
|
||||
return value
|
||||
|
||||
def __deserialize_date(self, string):
|
||||
"""Deserializes string to date.
|
||||
|
||||
:param string: str.
|
||||
:return: date.
|
||||
"""
|
||||
try:
|
||||
return parse(string).date()
|
||||
except ImportError:
|
||||
return string
|
||||
except ValueError:
|
||||
raise rest.ApiException(
|
||||
status=0,
|
||||
reason="Failed to parse `{0}` as date object".format(string)
|
||||
)
|
||||
|
||||
def __deserialize_datetime(self, string):
|
||||
"""Deserializes string to datetime.
|
||||
|
||||
The string should be in iso8601 datetime format.
|
||||
|
||||
:param string: str.
|
||||
:return: datetime.
|
||||
"""
|
||||
try:
|
||||
return parse(string)
|
||||
except ImportError:
|
||||
return string
|
||||
except ValueError:
|
||||
raise rest.ApiException(
|
||||
status=0,
|
||||
reason=(
|
||||
"Failed to parse `{0}` as datetime object"
|
||||
.format(string)
|
||||
)
|
||||
)
|
||||
|
||||
def __deserialize_model(self, data, klass):
|
||||
"""Deserializes list or dict to model.
|
||||
|
||||
:param data: dict, list.
|
||||
:param klass: class literal.
|
||||
:return: model object.
|
||||
"""
|
||||
|
||||
return klass.from_dict(data)
|
||||
@@ -0,0 +1,21 @@
|
||||
"""API response object."""
|
||||
|
||||
from __future__ import annotations
|
||||
from typing import Optional, Generic, Mapping, TypeVar
|
||||
from pydantic import Field, StrictInt, StrictBytes, BaseModel
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
class ApiResponse(BaseModel, Generic[T]):
|
||||
"""
|
||||
API response object
|
||||
"""
|
||||
|
||||
status_code: StrictInt = Field(description="HTTP status code")
|
||||
headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers")
|
||||
data: T = Field(description="Deserialized data given the data type")
|
||||
raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
|
||||
|
||||
model_config = {
|
||||
"arbitrary_types_allowed": True
|
||||
}
|
||||
@@ -0,0 +1,468 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import copy
|
||||
import logging
|
||||
from logging import FileHandler
|
||||
import multiprocessing
|
||||
import sys
|
||||
from typing import Optional
|
||||
import urllib3
|
||||
|
||||
import http.client as httplib
|
||||
|
||||
JSON_SCHEMA_VALIDATION_KEYWORDS = {
|
||||
'multipleOf', 'maximum', 'exclusiveMaximum',
|
||||
'minimum', 'exclusiveMinimum', 'maxLength',
|
||||
'minLength', 'pattern', 'maxItems', 'minItems'
|
||||
}
|
||||
|
||||
class Configuration:
|
||||
"""This class contains various settings of the API client.
|
||||
|
||||
:param host: Base url.
|
||||
:param api_key: Dict to store API key(s).
|
||||
Each entry in the dict specifies an API key.
|
||||
The dict key is the name of the security scheme in the OAS specification.
|
||||
The dict value is the API key secret.
|
||||
:param api_key_prefix: Dict to store API prefix (e.g. Bearer).
|
||||
The dict key is the name of the security scheme in the OAS specification.
|
||||
The dict value is an API key prefix when generating the auth data.
|
||||
:param username: Username for HTTP basic authentication.
|
||||
:param password: Password for HTTP basic authentication.
|
||||
:param access_token: Access token.
|
||||
:param server_index: Index to servers configuration.
|
||||
:param server_variables: Mapping with string values to replace variables in
|
||||
templated server configuration. The validation of enums is performed for
|
||||
variables with defined enum values before.
|
||||
:param server_operation_index: Mapping from operation ID to an index to server
|
||||
configuration.
|
||||
:param server_operation_variables: Mapping from operation ID to a mapping with
|
||||
string values to replace variables in templated server configuration.
|
||||
The validation of enums is performed for variables with defined enum
|
||||
values before.
|
||||
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
|
||||
in PEM format.
|
||||
|
||||
:Example:
|
||||
|
||||
HTTP Basic Authentication Example.
|
||||
Given the following security scheme in the OpenAPI specification:
|
||||
components:
|
||||
securitySchemes:
|
||||
http_basic_auth:
|
||||
type: http
|
||||
scheme: basic
|
||||
|
||||
Configure API client with HTTP basic authentication:
|
||||
|
||||
conf = openapi_client.Configuration(
|
||||
username='the-user',
|
||||
password='the-password',
|
||||
)
|
||||
|
||||
"""
|
||||
|
||||
_default = None
|
||||
|
||||
def __init__(self, host=None,
|
||||
api_key=None, api_key_prefix=None,
|
||||
username=None, password=None,
|
||||
access_token=None,
|
||||
server_index=None, server_variables=None,
|
||||
server_operation_index=None, server_operation_variables=None,
|
||||
ssl_ca_cert=None,
|
||||
) -> None:
|
||||
"""Constructor
|
||||
"""
|
||||
self._base_path = "http://localhost:3000" if host is None else host
|
||||
"""Default Base url
|
||||
"""
|
||||
self.server_index = 0 if server_index is None and host is None else server_index
|
||||
self.server_operation_index = server_operation_index or {}
|
||||
"""Default server index
|
||||
"""
|
||||
self.server_variables = server_variables or {}
|
||||
self.server_operation_variables = server_operation_variables or {}
|
||||
"""Default server variables
|
||||
"""
|
||||
self.temp_folder_path = None
|
||||
"""Temp file folder for downloading files
|
||||
"""
|
||||
# Authentication Settings
|
||||
self.api_key = {}
|
||||
if api_key:
|
||||
self.api_key = api_key
|
||||
"""dict to store API key(s)
|
||||
"""
|
||||
self.api_key_prefix = {}
|
||||
if api_key_prefix:
|
||||
self.api_key_prefix = api_key_prefix
|
||||
"""dict to store API prefix (e.g. Bearer)
|
||||
"""
|
||||
self.refresh_api_key_hook = None
|
||||
"""function hook to refresh API key if expired
|
||||
"""
|
||||
self.username = username
|
||||
"""Username for HTTP basic authentication
|
||||
"""
|
||||
self.password = password
|
||||
"""Password for HTTP basic authentication
|
||||
"""
|
||||
self.access_token = access_token
|
||||
"""Access token
|
||||
"""
|
||||
self.logger = {}
|
||||
"""Logging Settings
|
||||
"""
|
||||
self.logger["package_logger"] = logging.getLogger("openapi_client")
|
||||
self.logger["urllib3_logger"] = logging.getLogger("urllib3")
|
||||
self.logger_format = '%(asctime)s %(levelname)s %(message)s'
|
||||
"""Log format
|
||||
"""
|
||||
self.logger_stream_handler = None
|
||||
"""Log stream handler
|
||||
"""
|
||||
self.logger_file_handler: Optional[FileHandler] = None
|
||||
"""Log file handler
|
||||
"""
|
||||
self.logger_file = None
|
||||
"""Debug file location
|
||||
"""
|
||||
self.debug = False
|
||||
"""Debug switch
|
||||
"""
|
||||
|
||||
self.verify_ssl = True
|
||||
"""SSL/TLS verification
|
||||
Set this to false to skip verifying SSL certificate when calling API
|
||||
from https server.
|
||||
"""
|
||||
self.ssl_ca_cert = ssl_ca_cert
|
||||
"""Set this to customize the certificate file to verify the peer.
|
||||
"""
|
||||
self.cert_file = None
|
||||
"""client certificate file
|
||||
"""
|
||||
self.key_file = None
|
||||
"""client key file
|
||||
"""
|
||||
self.assert_hostname = None
|
||||
"""Set this to True/False to enable/disable SSL hostname verification.
|
||||
"""
|
||||
self.tls_server_name = None
|
||||
"""SSL/TLS Server Name Indication (SNI)
|
||||
Set this to the SNI value expected by the server.
|
||||
"""
|
||||
|
||||
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
|
||||
"""urllib3 connection pool's maximum number of connections saved
|
||||
per pool. urllib3 uses 1 connection as default value, but this is
|
||||
not the best value when you are making a lot of possibly parallel
|
||||
requests to the same host, which is often the case here.
|
||||
cpu_count * 5 is used as default value to increase performance.
|
||||
"""
|
||||
|
||||
self.proxy: Optional[str] = None
|
||||
"""Proxy URL
|
||||
"""
|
||||
self.proxy_headers = None
|
||||
"""Proxy headers
|
||||
"""
|
||||
self.safe_chars_for_path_param = ''
|
||||
"""Safe chars for path_param
|
||||
"""
|
||||
self.retries = None
|
||||
"""Adding retries to override urllib3 default value 3
|
||||
"""
|
||||
# Enable client side validation
|
||||
self.client_side_validation = True
|
||||
|
||||
self.socket_options = None
|
||||
"""Options to pass down to the underlying urllib3 socket
|
||||
"""
|
||||
|
||||
self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
|
||||
"""datetime format
|
||||
"""
|
||||
|
||||
self.date_format = "%Y-%m-%d"
|
||||
"""date format
|
||||
"""
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
cls = self.__class__
|
||||
result = cls.__new__(cls)
|
||||
memo[id(self)] = result
|
||||
for k, v in self.__dict__.items():
|
||||
if k not in ('logger', 'logger_file_handler'):
|
||||
setattr(result, k, copy.deepcopy(v, memo))
|
||||
# shallow copy of loggers
|
||||
result.logger = copy.copy(self.logger)
|
||||
# use setters to configure loggers
|
||||
result.logger_file = self.logger_file
|
||||
result.debug = self.debug
|
||||
return result
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
object.__setattr__(self, name, value)
|
||||
|
||||
@classmethod
|
||||
def set_default(cls, default):
|
||||
"""Set default instance of configuration.
|
||||
|
||||
It stores default configuration, which can be
|
||||
returned by get_default_copy method.
|
||||
|
||||
:param default: object of Configuration
|
||||
"""
|
||||
cls._default = default
|
||||
|
||||
@classmethod
|
||||
def get_default_copy(cls):
|
||||
"""Deprecated. Please use `get_default` instead.
|
||||
|
||||
Deprecated. Please use `get_default` instead.
|
||||
|
||||
:return: The configuration object.
|
||||
"""
|
||||
return cls.get_default()
|
||||
|
||||
@classmethod
|
||||
def get_default(cls):
|
||||
"""Return the default configuration.
|
||||
|
||||
This method returns newly created, based on default constructor,
|
||||
object of Configuration class or returns a copy of default
|
||||
configuration.
|
||||
|
||||
:return: The configuration object.
|
||||
"""
|
||||
if cls._default is None:
|
||||
cls._default = Configuration()
|
||||
return cls._default
|
||||
|
||||
@property
|
||||
def logger_file(self):
|
||||
"""The logger file.
|
||||
|
||||
If the logger_file is None, then add stream handler and remove file
|
||||
handler. Otherwise, add file handler and remove stream handler.
|
||||
|
||||
:param value: The logger_file path.
|
||||
:type: str
|
||||
"""
|
||||
return self.__logger_file
|
||||
|
||||
@logger_file.setter
|
||||
def logger_file(self, value):
|
||||
"""The logger file.
|
||||
|
||||
If the logger_file is None, then add stream handler and remove file
|
||||
handler. Otherwise, add file handler and remove stream handler.
|
||||
|
||||
:param value: The logger_file path.
|
||||
:type: str
|
||||
"""
|
||||
self.__logger_file = value
|
||||
if self.__logger_file:
|
||||
# If set logging file,
|
||||
# then add file handler and remove stream handler.
|
||||
self.logger_file_handler = logging.FileHandler(self.__logger_file)
|
||||
self.logger_file_handler.setFormatter(self.logger_formatter)
|
||||
for _, logger in self.logger.items():
|
||||
logger.addHandler(self.logger_file_handler)
|
||||
|
||||
@property
|
||||
def debug(self):
|
||||
"""Debug status
|
||||
|
||||
:param value: The debug status, True or False.
|
||||
:type: bool
|
||||
"""
|
||||
return self.__debug
|
||||
|
||||
@debug.setter
|
||||
def debug(self, value):
|
||||
"""Debug status
|
||||
|
||||
:param value: The debug status, True or False.
|
||||
:type: bool
|
||||
"""
|
||||
self.__debug = value
|
||||
if self.__debug:
|
||||
# if debug status is True, turn on debug logging
|
||||
for _, logger in self.logger.items():
|
||||
logger.setLevel(logging.DEBUG)
|
||||
# turn on httplib debug
|
||||
httplib.HTTPConnection.debuglevel = 1
|
||||
else:
|
||||
# if debug status is False, turn off debug logging,
|
||||
# setting log level to default `logging.WARNING`
|
||||
for _, logger in self.logger.items():
|
||||
logger.setLevel(logging.WARNING)
|
||||
# turn off httplib debug
|
||||
httplib.HTTPConnection.debuglevel = 0
|
||||
|
||||
@property
|
||||
def logger_format(self):
|
||||
"""The logger format.
|
||||
|
||||
The logger_formatter will be updated when sets logger_format.
|
||||
|
||||
:param value: The format string.
|
||||
:type: str
|
||||
"""
|
||||
return self.__logger_format
|
||||
|
||||
@logger_format.setter
|
||||
def logger_format(self, value):
|
||||
"""The logger format.
|
||||
|
||||
The logger_formatter will be updated when sets logger_format.
|
||||
|
||||
:param value: The format string.
|
||||
:type: str
|
||||
"""
|
||||
self.__logger_format = value
|
||||
self.logger_formatter = logging.Formatter(self.__logger_format)
|
||||
|
||||
def get_api_key_with_prefix(self, identifier, alias=None):
|
||||
"""Gets API key (with prefix if set).
|
||||
|
||||
:param identifier: The identifier of apiKey.
|
||||
:param alias: The alternative identifier of apiKey.
|
||||
:return: The token for api key authentication.
|
||||
"""
|
||||
if self.refresh_api_key_hook is not None:
|
||||
self.refresh_api_key_hook(self)
|
||||
key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None)
|
||||
if key:
|
||||
prefix = self.api_key_prefix.get(identifier)
|
||||
if prefix:
|
||||
return "%s %s" % (prefix, key)
|
||||
else:
|
||||
return key
|
||||
|
||||
def get_basic_auth_token(self):
|
||||
"""Gets HTTP basic authentication header (string).
|
||||
|
||||
:return: The token for basic HTTP authentication.
|
||||
"""
|
||||
username = ""
|
||||
if self.username is not None:
|
||||
username = self.username
|
||||
password = ""
|
||||
if self.password is not None:
|
||||
password = self.password
|
||||
return urllib3.util.make_headers(
|
||||
basic_auth=username + ':' + password
|
||||
).get('authorization')
|
||||
|
||||
def auth_settings(self):
|
||||
"""Gets Auth Settings dict for api client.
|
||||
|
||||
:return: The Auth Settings information dict.
|
||||
"""
|
||||
auth = {}
|
||||
if self.username is not None and self.password is not None:
|
||||
auth['http_auth'] = {
|
||||
'type': 'basic',
|
||||
'in': 'header',
|
||||
'key': 'Authorization',
|
||||
'value': self.get_basic_auth_token()
|
||||
}
|
||||
if self.access_token is not None:
|
||||
auth['http_bearer_auth'] = {
|
||||
'type': 'bearer',
|
||||
'in': 'header',
|
||||
'key': 'Authorization',
|
||||
'value': 'Bearer ' + self.access_token
|
||||
}
|
||||
return auth
|
||||
|
||||
def to_debug_report(self):
|
||||
"""Gets the essential information for debugging.
|
||||
|
||||
:return: The report for debugging.
|
||||
"""
|
||||
return "Python SDK Debug Report:\n"\
|
||||
"OS: {env}\n"\
|
||||
"Python Version: {pyversion}\n"\
|
||||
"Version of the API: 0.1.0\n"\
|
||||
"SDK Package Version: 1.0.0".\
|
||||
format(env=sys.platform, pyversion=sys.version)
|
||||
|
||||
def get_host_settings(self):
|
||||
"""Gets an array of host settings
|
||||
|
||||
:return: An array of host settings
|
||||
"""
|
||||
return [
|
||||
{
|
||||
'url': "http://localhost:3000",
|
||||
'description': "No description provided",
|
||||
}
|
||||
]
|
||||
|
||||
def get_host_from_settings(self, index, variables=None, servers=None):
|
||||
"""Gets host URL based on the index and variables
|
||||
:param index: array index of the host settings
|
||||
:param variables: hash of variable and the corresponding value
|
||||
:param servers: an array of host settings or None
|
||||
:return: URL based on host settings
|
||||
"""
|
||||
if index is None:
|
||||
return self._base_path
|
||||
|
||||
variables = {} if variables is None else variables
|
||||
servers = self.get_host_settings() if servers is None else servers
|
||||
|
||||
try:
|
||||
server = servers[index]
|
||||
except IndexError:
|
||||
raise ValueError(
|
||||
"Invalid index {0} when selecting the host settings. "
|
||||
"Must be less than {1}".format(index, len(servers)))
|
||||
|
||||
url = server['url']
|
||||
|
||||
# go through variables and replace placeholders
|
||||
for variable_name, variable in server.get('variables', {}).items():
|
||||
used_value = variables.get(
|
||||
variable_name, variable['default_value'])
|
||||
|
||||
if 'enum_values' in variable \
|
||||
and used_value not in variable['enum_values']:
|
||||
raise ValueError(
|
||||
"The variable `{0}` in the host URL has invalid value "
|
||||
"{1}. Must be {2}.".format(
|
||||
variable_name, variables[variable_name],
|
||||
variable['enum_values']))
|
||||
|
||||
url = url.replace("{" + variable_name + "}", used_value)
|
||||
|
||||
return url
|
||||
|
||||
@property
|
||||
def host(self):
|
||||
"""Return generated host."""
|
||||
return self.get_host_from_settings(self.server_index, variables=self.server_variables)
|
||||
|
||||
@host.setter
|
||||
def host(self, value):
|
||||
"""Fix base path."""
|
||||
self._base_path = value
|
||||
self.server_index = None
|
||||
@@ -0,0 +1,200 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
from typing import Any, Optional
|
||||
from typing_extensions import Self
|
||||
|
||||
class OpenApiException(Exception):
|
||||
"""The base exception class for all OpenAPIExceptions"""
|
||||
|
||||
|
||||
class ApiTypeError(OpenApiException, TypeError):
|
||||
def __init__(self, msg, path_to_item=None, valid_classes=None,
|
||||
key_type=None) -> None:
|
||||
""" Raises an exception for TypeErrors
|
||||
|
||||
Args:
|
||||
msg (str): the exception message
|
||||
|
||||
Keyword Args:
|
||||
path_to_item (list): a list of keys an indices to get to the
|
||||
current_item
|
||||
None if unset
|
||||
valid_classes (tuple): the primitive classes that current item
|
||||
should be an instance of
|
||||
None if unset
|
||||
key_type (bool): False if our value is a value in a dict
|
||||
True if it is a key in a dict
|
||||
False if our item is an item in a list
|
||||
None if unset
|
||||
"""
|
||||
self.path_to_item = path_to_item
|
||||
self.valid_classes = valid_classes
|
||||
self.key_type = key_type
|
||||
full_msg = msg
|
||||
if path_to_item:
|
||||
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
||||
super(ApiTypeError, self).__init__(full_msg)
|
||||
|
||||
|
||||
class ApiValueError(OpenApiException, ValueError):
|
||||
def __init__(self, msg, path_to_item=None) -> None:
|
||||
"""
|
||||
Args:
|
||||
msg (str): the exception message
|
||||
|
||||
Keyword Args:
|
||||
path_to_item (list) the path to the exception in the
|
||||
received_data dict. None if unset
|
||||
"""
|
||||
|
||||
self.path_to_item = path_to_item
|
||||
full_msg = msg
|
||||
if path_to_item:
|
||||
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
||||
super(ApiValueError, self).__init__(full_msg)
|
||||
|
||||
|
||||
class ApiAttributeError(OpenApiException, AttributeError):
|
||||
def __init__(self, msg, path_to_item=None) -> None:
|
||||
"""
|
||||
Raised when an attribute reference or assignment fails.
|
||||
|
||||
Args:
|
||||
msg (str): the exception message
|
||||
|
||||
Keyword Args:
|
||||
path_to_item (None/list) the path to the exception in the
|
||||
received_data dict
|
||||
"""
|
||||
self.path_to_item = path_to_item
|
||||
full_msg = msg
|
||||
if path_to_item:
|
||||
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
||||
super(ApiAttributeError, self).__init__(full_msg)
|
||||
|
||||
|
||||
class ApiKeyError(OpenApiException, KeyError):
|
||||
def __init__(self, msg, path_to_item=None) -> None:
|
||||
"""
|
||||
Args:
|
||||
msg (str): the exception message
|
||||
|
||||
Keyword Args:
|
||||
path_to_item (None/list) the path to the exception in the
|
||||
received_data dict
|
||||
"""
|
||||
self.path_to_item = path_to_item
|
||||
full_msg = msg
|
||||
if path_to_item:
|
||||
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
||||
super(ApiKeyError, self).__init__(full_msg)
|
||||
|
||||
|
||||
class ApiException(OpenApiException):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
status=None,
|
||||
reason=None,
|
||||
http_resp=None,
|
||||
*,
|
||||
body: Optional[str] = None,
|
||||
data: Optional[Any] = None,
|
||||
) -> None:
|
||||
self.status = status
|
||||
self.reason = reason
|
||||
self.body = body
|
||||
self.data = data
|
||||
self.headers = None
|
||||
|
||||
if http_resp:
|
||||
if self.status is None:
|
||||
self.status = http_resp.status
|
||||
if self.reason is None:
|
||||
self.reason = http_resp.reason
|
||||
if self.body is None:
|
||||
try:
|
||||
self.body = http_resp.data.decode('utf-8')
|
||||
except Exception:
|
||||
pass
|
||||
self.headers = http_resp.getheaders()
|
||||
|
||||
@classmethod
|
||||
def from_response(
|
||||
cls,
|
||||
*,
|
||||
http_resp,
|
||||
body: Optional[str],
|
||||
data: Optional[Any],
|
||||
) -> Self:
|
||||
if http_resp.status == 400:
|
||||
raise BadRequestException(http_resp=http_resp, body=body, data=data)
|
||||
|
||||
if http_resp.status == 401:
|
||||
raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
|
||||
|
||||
if http_resp.status == 403:
|
||||
raise ForbiddenException(http_resp=http_resp, body=body, data=data)
|
||||
|
||||
if http_resp.status == 404:
|
||||
raise NotFoundException(http_resp=http_resp, body=body, data=data)
|
||||
|
||||
if 500 <= http_resp.status <= 599:
|
||||
raise ServiceException(http_resp=http_resp, body=body, data=data)
|
||||
raise ApiException(http_resp=http_resp, body=body, data=data)
|
||||
|
||||
def __str__(self):
|
||||
"""Custom error messages for exception"""
|
||||
error_message = "({0})\n"\
|
||||
"Reason: {1}\n".format(self.status, self.reason)
|
||||
if self.headers:
|
||||
error_message += "HTTP response headers: {0}\n".format(
|
||||
self.headers)
|
||||
|
||||
if self.data or self.body:
|
||||
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
|
||||
|
||||
return error_message
|
||||
|
||||
|
||||
class BadRequestException(ApiException):
|
||||
pass
|
||||
|
||||
|
||||
class NotFoundException(ApiException):
|
||||
pass
|
||||
|
||||
|
||||
class UnauthorizedException(ApiException):
|
||||
pass
|
||||
|
||||
|
||||
class ForbiddenException(ApiException):
|
||||
pass
|
||||
|
||||
|
||||
class ServiceException(ApiException):
|
||||
pass
|
||||
|
||||
|
||||
def render_path(path_to_item):
|
||||
"""Returns a string representation of a path"""
|
||||
result = ""
|
||||
for pth in path_to_item:
|
||||
if isinstance(pth, int):
|
||||
result += "[{0}]".format(pth)
|
||||
else:
|
||||
result += "['{0}']".format(pth)
|
||||
return result
|
||||
@@ -0,0 +1,28 @@
|
||||
# coding: utf-8
|
||||
|
||||
# flake8: noqa
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
# import models into model package
|
||||
from openapi_client.models.bird import Bird
|
||||
from openapi_client.models.category import Category
|
||||
from openapi_client.models.data_query import DataQuery
|
||||
from openapi_client.models.default_value import DefaultValue
|
||||
from openapi_client.models.number_properties_only import NumberPropertiesOnly
|
||||
from openapi_client.models.pet import Pet
|
||||
from openapi_client.models.query import Query
|
||||
from openapi_client.models.string_enum_ref import StringEnumRef
|
||||
from openapi_client.models.tag import Tag
|
||||
from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
|
||||
from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
@@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
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, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class Bird(BaseModel):
|
||||
"""
|
||||
Bird
|
||||
""" # noqa: E501
|
||||
size: Optional[StrictStr] = None
|
||||
color: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["size", "color"]
|
||||
|
||||
model_config = {
|
||||
"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 Bird 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 Bird from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
# raise errors for additional fields in the input
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
raise ValueError("Error due to additional fields (not defined in Bird) in the input: " + _key)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"size": obj.get("size"),
|
||||
"color": obj.get("color")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
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, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class Category(BaseModel):
|
||||
"""
|
||||
Category
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictInt] = None
|
||||
name: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "name"]
|
||||
|
||||
model_config = {
|
||||
"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 Category 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 Category from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
# raise errors for additional fields in the input
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
raise ValueError("Error due to additional fields (not defined in Category) in the input: " + _key)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"name": obj.get("name")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
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 datetime import datetime
|
||||
from pydantic import Field, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from openapi_client.models.query import Query
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class DataQuery(Query):
|
||||
"""
|
||||
DataQuery
|
||||
""" # noqa: E501
|
||||
suffix: Optional[StrictStr] = Field(default=None, description="test suffix")
|
||||
text: Optional[StrictStr] = Field(default=None, description="Some text containing white spaces")
|
||||
var_date: Optional[datetime] = Field(default=None, description="A date", alias="date")
|
||||
__properties: ClassVar[List[str]] = ["id", "outcomes", "suffix", "text", "date"]
|
||||
|
||||
model_config = {
|
||||
"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 DataQuery 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 DataQuery from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
# raise errors for additional fields in the input
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
raise ValueError("Error due to additional fields (not defined in DataQuery) in the input: " + _key)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"outcomes": obj.get("outcomes"),
|
||||
"suffix": obj.get("suffix"),
|
||||
"text": obj.get("text"),
|
||||
"date": obj.get("date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
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, StrictInt, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from openapi_client.models.string_enum_ref import StringEnumRef
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class DefaultValue(BaseModel):
|
||||
"""
|
||||
to test the default value of properties
|
||||
""" # noqa: E501
|
||||
array_string_enum_ref_default: Optional[List[StringEnumRef]] = None
|
||||
array_string_enum_default: Optional[List[StrictStr]] = None
|
||||
array_string_default: Optional[List[StrictStr]] = None
|
||||
array_integer_default: Optional[List[StrictInt]] = None
|
||||
array_string: Optional[List[StrictStr]] = None
|
||||
array_string_nullable: Optional[List[StrictStr]] = None
|
||||
array_string_extension_nullable: Optional[List[StrictStr]] = None
|
||||
string_nullable: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["array_string_enum_ref_default", "array_string_enum_default", "array_string_default", "array_integer_default", "array_string", "array_string_nullable", "array_string_extension_nullable", "string_nullable"]
|
||||
|
||||
@field_validator('array_string_enum_default')
|
||||
def array_string_enum_default_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
for i in value:
|
||||
if i not in ('success', 'failure', 'unclassified'):
|
||||
raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')")
|
||||
return value
|
||||
|
||||
model_config = {
|
||||
"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 DefaultValue 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,
|
||||
)
|
||||
# set to None if array_string_nullable (nullable) is None
|
||||
# and model_fields_set contains the field
|
||||
if self.array_string_nullable is None and "array_string_nullable" in self.model_fields_set:
|
||||
_dict['array_string_nullable'] = None
|
||||
|
||||
# set to None if array_string_extension_nullable (nullable) is None
|
||||
# and model_fields_set contains the field
|
||||
if self.array_string_extension_nullable is None and "array_string_extension_nullable" in self.model_fields_set:
|
||||
_dict['array_string_extension_nullable'] = None
|
||||
|
||||
# set to None if string_nullable (nullable) is None
|
||||
# and model_fields_set contains the field
|
||||
if self.string_nullable is None and "string_nullable" in self.model_fields_set:
|
||||
_dict['string_nullable'] = None
|
||||
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DefaultValue from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
# raise errors for additional fields in the input
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
raise ValueError("Error due to additional fields (not defined in DefaultValue) in the input: " + _key)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"array_string_enum_ref_default": obj.get("array_string_enum_ref_default"),
|
||||
"array_string_enum_default": obj.get("array_string_enum_default"),
|
||||
"array_string_default": obj.get("array_string_default"),
|
||||
"array_integer_default": obj.get("array_integer_default"),
|
||||
"array_string": obj.get("array_string"),
|
||||
"array_string_nullable": obj.get("array_string_nullable"),
|
||||
"array_string_extension_nullable": obj.get("array_string_extension_nullable"),
|
||||
"string_nullable": obj.get("string_nullable")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
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, Field, StrictFloat, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class NumberPropertiesOnly(BaseModel):
|
||||
"""
|
||||
NumberPropertiesOnly
|
||||
""" # noqa: E501
|
||||
number: Optional[Union[StrictFloat, StrictInt]] = None
|
||||
var_float: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="float")
|
||||
double: Optional[Union[Annotated[float, Field(le=50.2, strict=True, ge=0.8)], Annotated[int, Field(le=50, strict=True, ge=1)]]] = None
|
||||
__properties: ClassVar[List[str]] = ["number", "float", "double"]
|
||||
|
||||
model_config = {
|
||||
"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 NumberPropertiesOnly 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 NumberPropertiesOnly from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
# raise errors for additional fields in the input
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
raise ValueError("Error due to additional fields (not defined in NumberPropertiesOnly) in the input: " + _key)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"number": obj.get("number"),
|
||||
"float": obj.get("float"),
|
||||
"double": obj.get("double")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
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, Field, StrictInt, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from openapi_client.models.category import Category
|
||||
from openapi_client.models.tag import Tag
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class Pet(BaseModel):
|
||||
"""
|
||||
Pet
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictInt] = None
|
||||
name: StrictStr
|
||||
category: Optional[Category] = None
|
||||
photo_urls: List[StrictStr] = Field(alias="photoUrls")
|
||||
tags: Optional[List[Tag]] = None
|
||||
status: Optional[StrictStr] = Field(default=None, description="pet status in the store")
|
||||
__properties: ClassVar[List[str]] = ["id", "name", "category", "photoUrls", "tags", "status"]
|
||||
|
||||
@field_validator('status')
|
||||
def status_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if value not in ('available', 'pending', 'sold'):
|
||||
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
||||
return value
|
||||
|
||||
model_config = {
|
||||
"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 Pet 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,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of category
|
||||
if self.category:
|
||||
_dict['category'] = self.category.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in tags (list)
|
||||
_items = []
|
||||
if self.tags:
|
||||
for _item in self.tags:
|
||||
if _item:
|
||||
_items.append(_item.to_dict())
|
||||
_dict['tags'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Pet from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
# raise errors for additional fields in the input
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
raise ValueError("Error due to additional fields (not defined in Pet) in the input: " + _key)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"name": obj.get("name"),
|
||||
"category": Category.from_dict(obj["category"]) if obj.get("category") is not None else None,
|
||||
"photoUrls": obj.get("photoUrls"),
|
||||
"tags": [Tag.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None,
|
||||
"status": obj.get("status")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
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, Field, StrictInt, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class Query(BaseModel):
|
||||
"""
|
||||
Query
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictInt] = Field(default=None, description="Query")
|
||||
outcomes: Optional[List[StrictStr]] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "outcomes"]
|
||||
|
||||
@field_validator('outcomes')
|
||||
def outcomes_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
for i in value:
|
||||
if i not in ('SUCCESS', 'FAILURE', 'SKIPPED'):
|
||||
raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')")
|
||||
return value
|
||||
|
||||
model_config = {
|
||||
"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 Query 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: Dict[str, Any]) -> Optional[Self]:
|
||||
"""Create an instance of Query from a dict"""
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import json
|
||||
from enum import Enum
|
||||
from typing_extensions import Self
|
||||
|
||||
|
||||
class StringEnumRef(str, Enum):
|
||||
"""
|
||||
StringEnumRef
|
||||
"""
|
||||
|
||||
"""
|
||||
allowed enum values
|
||||
"""
|
||||
SUCCESS = 'success'
|
||||
FAILURE = 'failure'
|
||||
UNCLASSIFIED = 'unclassified'
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Self:
|
||||
"""Create an instance of StringEnumRef from a JSON string"""
|
||||
return cls(json.loads(json_str))
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
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, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class Tag(BaseModel):
|
||||
"""
|
||||
Tag
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictInt] = None
|
||||
name: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "name"]
|
||||
|
||||
model_config = {
|
||||
"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 Tag 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 Tag from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
# raise errors for additional fields in the input
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
raise ValueError("Error due to additional fields (not defined in Tag) in the input: " + _key)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"name": obj.get("name")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
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, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseModel):
|
||||
"""
|
||||
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
|
||||
""" # noqa: E501
|
||||
size: Optional[StrictStr] = None
|
||||
color: Optional[StrictStr] = None
|
||||
id: Optional[StrictInt] = None
|
||||
name: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["size", "color", "id", "name"]
|
||||
|
||||
model_config = {
|
||||
"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 TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter 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 TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
# raise errors for additional fields in the input
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
raise ValueError("Error due to additional fields (not defined in TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) in the input: " + _key)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"size": obj.get("size"),
|
||||
"color": obj.get("color"),
|
||||
"id": obj.get("id"),
|
||||
"name": obj.get("name")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
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, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel):
|
||||
"""
|
||||
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
""" # noqa: E501
|
||||
values: Optional[List[StrictStr]] = None
|
||||
__properties: ClassVar[List[str]] = ["values"]
|
||||
|
||||
model_config = {
|
||||
"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 TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter 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 TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
# raise errors for additional fields in the input
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
raise ValueError("Error due to additional fields (not defined in TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) in the input: " + _key)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"values": obj.get("values")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import io
|
||||
import json
|
||||
import re
|
||||
import ssl
|
||||
|
||||
import urllib3
|
||||
|
||||
from openapi_client.exceptions import ApiException, ApiValueError
|
||||
|
||||
SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"}
|
||||
RESTResponseType = urllib3.HTTPResponse
|
||||
|
||||
|
||||
def is_socks_proxy_url(url):
|
||||
if url is None:
|
||||
return False
|
||||
split_section = url.split("://")
|
||||
if len(split_section) < 2:
|
||||
return False
|
||||
else:
|
||||
return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES
|
||||
|
||||
|
||||
class RESTResponse(io.IOBase):
|
||||
|
||||
def __init__(self, resp) -> None:
|
||||
self.response = resp
|
||||
self.status = resp.status
|
||||
self.reason = resp.reason
|
||||
self.data = None
|
||||
|
||||
def read(self):
|
||||
if self.data is None:
|
||||
self.data = self.response.data
|
||||
return self.data
|
||||
|
||||
def getheaders(self):
|
||||
"""Returns a dictionary of the response headers."""
|
||||
return self.response.headers
|
||||
|
||||
def getheader(self, name, default=None):
|
||||
"""Returns a given response header."""
|
||||
return self.response.headers.get(name, default)
|
||||
|
||||
|
||||
class RESTClientObject:
|
||||
|
||||
def __init__(self, configuration) -> None:
|
||||
# urllib3.PoolManager will pass all kw parameters to connectionpool
|
||||
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
|
||||
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
|
||||
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
|
||||
|
||||
# cert_reqs
|
||||
if configuration.verify_ssl:
|
||||
cert_reqs = ssl.CERT_REQUIRED
|
||||
else:
|
||||
cert_reqs = ssl.CERT_NONE
|
||||
|
||||
pool_args = {
|
||||
"cert_reqs": cert_reqs,
|
||||
"ca_certs": configuration.ssl_ca_cert,
|
||||
"cert_file": configuration.cert_file,
|
||||
"key_file": configuration.key_file,
|
||||
}
|
||||
if configuration.assert_hostname is not None:
|
||||
pool_args['assert_hostname'] = (
|
||||
configuration.assert_hostname
|
||||
)
|
||||
|
||||
if configuration.retries is not None:
|
||||
pool_args['retries'] = configuration.retries
|
||||
|
||||
if configuration.tls_server_name:
|
||||
pool_args['server_hostname'] = configuration.tls_server_name
|
||||
|
||||
|
||||
if configuration.socket_options is not None:
|
||||
pool_args['socket_options'] = configuration.socket_options
|
||||
|
||||
if configuration.connection_pool_maxsize is not None:
|
||||
pool_args['maxsize'] = configuration.connection_pool_maxsize
|
||||
|
||||
# https pool manager
|
||||
self.pool_manager: urllib3.PoolManager
|
||||
|
||||
if configuration.proxy:
|
||||
if is_socks_proxy_url(configuration.proxy):
|
||||
from urllib3.contrib.socks import SOCKSProxyManager
|
||||
pool_args["proxy_url"] = configuration.proxy
|
||||
pool_args["headers"] = configuration.proxy_headers
|
||||
self.pool_manager = SOCKSProxyManager(**pool_args)
|
||||
else:
|
||||
pool_args["proxy_url"] = configuration.proxy
|
||||
pool_args["proxy_headers"] = configuration.proxy_headers
|
||||
self.pool_manager = urllib3.ProxyManager(**pool_args)
|
||||
else:
|
||||
self.pool_manager = urllib3.PoolManager(**pool_args)
|
||||
|
||||
def request(
|
||||
self,
|
||||
method,
|
||||
url,
|
||||
headers=None,
|
||||
body=None,
|
||||
post_params=None,
|
||||
_request_timeout=None
|
||||
):
|
||||
"""Perform requests.
|
||||
|
||||
:param method: http request method
|
||||
:param url: http request url
|
||||
:param headers: http request headers
|
||||
:param body: request json body, for `application/json`
|
||||
:param post_params: request post parameters,
|
||||
`application/x-www-form-urlencoded`
|
||||
and `multipart/form-data`
|
||||
: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.
|
||||
"""
|
||||
method = method.upper()
|
||||
assert method in [
|
||||
'GET',
|
||||
'HEAD',
|
||||
'DELETE',
|
||||
'POST',
|
||||
'PUT',
|
||||
'PATCH',
|
||||
'OPTIONS'
|
||||
]
|
||||
|
||||
if post_params and body:
|
||||
raise ApiValueError(
|
||||
"body parameter cannot be used with post_params parameter."
|
||||
)
|
||||
|
||||
post_params = post_params or {}
|
||||
headers = headers or {}
|
||||
|
||||
timeout = None
|
||||
if _request_timeout:
|
||||
if isinstance(_request_timeout, (int, float)):
|
||||
timeout = urllib3.Timeout(total=_request_timeout)
|
||||
elif (
|
||||
isinstance(_request_timeout, tuple)
|
||||
and len(_request_timeout) == 2
|
||||
):
|
||||
timeout = urllib3.Timeout(
|
||||
connect=_request_timeout[0],
|
||||
read=_request_timeout[1]
|
||||
)
|
||||
|
||||
try:
|
||||
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
||||
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
|
||||
|
||||
# no content type provided or payload is json
|
||||
content_type = headers.get('Content-Type')
|
||||
if (
|
||||
not content_type
|
||||
or re.search('json', content_type, re.IGNORECASE)
|
||||
):
|
||||
request_body = None
|
||||
if body is not None:
|
||||
request_body = json.dumps(body)
|
||||
r = self.pool_manager.request(
|
||||
method,
|
||||
url,
|
||||
body=request_body,
|
||||
timeout=timeout,
|
||||
headers=headers,
|
||||
preload_content=False
|
||||
)
|
||||
elif content_type == 'application/x-www-form-urlencoded':
|
||||
r = self.pool_manager.request(
|
||||
method,
|
||||
url,
|
||||
fields=post_params,
|
||||
encode_multipart=False,
|
||||
timeout=timeout,
|
||||
headers=headers,
|
||||
preload_content=False
|
||||
)
|
||||
elif content_type == 'multipart/form-data':
|
||||
# must del headers['Content-Type'], or the correct
|
||||
# Content-Type which generated by urllib3 will be
|
||||
# overwritten.
|
||||
del headers['Content-Type']
|
||||
r = self.pool_manager.request(
|
||||
method,
|
||||
url,
|
||||
fields=post_params,
|
||||
encode_multipart=True,
|
||||
timeout=timeout,
|
||||
headers=headers,
|
||||
preload_content=False
|
||||
)
|
||||
# Pass a `string` parameter directly in the body to support
|
||||
# other content types than JSON when `body` argument is
|
||||
# provided in serialized form.
|
||||
elif isinstance(body, str) or isinstance(body, bytes):
|
||||
r = self.pool_manager.request(
|
||||
method,
|
||||
url,
|
||||
body=body,
|
||||
timeout=timeout,
|
||||
headers=headers,
|
||||
preload_content=False
|
||||
)
|
||||
elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool):
|
||||
request_body = "true" if body else "false"
|
||||
r = self.pool_manager.request(
|
||||
method,
|
||||
url,
|
||||
body=request_body,
|
||||
preload_content=False,
|
||||
timeout=timeout,
|
||||
headers=headers)
|
||||
else:
|
||||
# Cannot generate the request from given parameters
|
||||
msg = """Cannot prepare a request message for provided
|
||||
arguments. Please check that your arguments match
|
||||
declared content type."""
|
||||
raise ApiException(status=0, reason=msg)
|
||||
# For `GET`, `HEAD`
|
||||
else:
|
||||
r = self.pool_manager.request(
|
||||
method,
|
||||
url,
|
||||
fields={},
|
||||
timeout=timeout,
|
||||
headers=headers,
|
||||
preload_content=False
|
||||
)
|
||||
except urllib3.exceptions.SSLError as e:
|
||||
msg = "\n".join([type(e).__name__, str(e)])
|
||||
raise ApiException(status=0, reason=msg)
|
||||
|
||||
return RESTResponse(r)
|
||||
@@ -0,0 +1,71 @@
|
||||
[tool.poetry]
|
||||
name = "openapi_client"
|
||||
version = "1.0.0"
|
||||
description = "Echo Server API"
|
||||
authors = ["OpenAPI Generator Community <team@openapitools.org>"]
|
||||
license = "Apache 2.0"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
keywords = ["OpenAPI", "OpenAPI-Generator", "Echo Server API"]
|
||||
include = ["openapi_client/py.typed"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.7"
|
||||
|
||||
urllib3 = ">= 1.25.3"
|
||||
python-dateutil = ">=2.8.2"
|
||||
pydantic = ">=2"
|
||||
typing-extensions = ">=4.7.1"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
pytest = ">=7.2.1"
|
||||
tox = ">=3.9.0"
|
||||
flake8 = ">=4.0.0"
|
||||
types-python-dateutil = ">=2.8.19.14"
|
||||
mypy = "1.4.1"
|
||||
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.pylint.'MESSAGES CONTROL']
|
||||
extension-pkg-whitelist = "pydantic"
|
||||
|
||||
[tool.mypy]
|
||||
files = [
|
||||
"openapi_client",
|
||||
#"test", # auto-generated tests
|
||||
"tests", # hand-written tests
|
||||
]
|
||||
# TODO: enable "strict" once all these individual checks are passing
|
||||
# strict = true
|
||||
|
||||
# List from: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options
|
||||
warn_unused_configs = true
|
||||
warn_redundant_casts = true
|
||||
warn_unused_ignores = true
|
||||
|
||||
## Getting these passing should be easy
|
||||
strict_equality = true
|
||||
strict_concatenate = true
|
||||
|
||||
## Strongly recommend enabling this one as soon as you can
|
||||
check_untyped_defs = true
|
||||
|
||||
## These shouldn't be too much additional work, but may be tricky to
|
||||
## get passing if you use a lot of untyped libraries
|
||||
disallow_subclassing_any = true
|
||||
disallow_untyped_decorators = true
|
||||
disallow_any_generics = true
|
||||
|
||||
### These next few are various gradations of forcing use of type annotations
|
||||
#disallow_untyped_calls = true
|
||||
#disallow_incomplete_defs = true
|
||||
#disallow_untyped_defs = true
|
||||
#
|
||||
### This one isn't too hard to get passing, but return on investment is lower
|
||||
#no_implicit_reexport = true
|
||||
#
|
||||
### This one can be tricky to get passing if you use a lot of untyped libraries
|
||||
#warn_return_any = true
|
||||
@@ -0,0 +1,5 @@
|
||||
python_dateutil >= 2.5.3
|
||||
setuptools >= 21.0.0
|
||||
urllib3 >= 1.25.3, < 2.1.0
|
||||
pydantic >= 2
|
||||
typing-extensions >= 4.7.1
|
||||
@@ -0,0 +1,2 @@
|
||||
[flake8]
|
||||
max-line-length=99
|
||||
@@ -0,0 +1,51 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from setuptools import setup, find_packages # noqa: H301
|
||||
|
||||
# To install the library, run the following
|
||||
#
|
||||
# python setup.py install
|
||||
#
|
||||
# prerequisite: setuptools
|
||||
# http://pypi.python.org/pypi/setuptools
|
||||
NAME = "openapi-client"
|
||||
VERSION = "1.0.0"
|
||||
PYTHON_REQUIRES = ">=3.7"
|
||||
REQUIRES = [
|
||||
"urllib3 >= 1.25.3, < 2.1.0",
|
||||
"python-dateutil",
|
||||
"pydantic >= 2",
|
||||
"typing-extensions >= 4.7.1",
|
||||
]
|
||||
|
||||
setup(
|
||||
name=NAME,
|
||||
version=VERSION,
|
||||
description="Echo Server API",
|
||||
author="OpenAPI Generator community",
|
||||
author_email="team@openapitools.org",
|
||||
url="",
|
||||
keywords=["OpenAPI", "OpenAPI-Generator", "Echo Server API"],
|
||||
install_requires=REQUIRES,
|
||||
packages=find_packages(exclude=["test", "tests"]),
|
||||
include_package_data=True,
|
||||
license="Apache 2.0",
|
||||
long_description_content_type='text/markdown',
|
||||
long_description="""\
|
||||
Echo Server API
|
||||
""", # noqa: E501
|
||||
package_data={"openapi_client": ["py.typed"]},
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
pytest~=7.1.3
|
||||
pytest-cov>=2.8.1
|
||||
pytest-randomly>=3.12.0
|
||||
mypy>=1.4.1
|
||||
types-python-dateutil>=2.8.19
|
||||
@@ -0,0 +1,39 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import unittest
|
||||
|
||||
from openapi_client.api.auth_api import AuthApi # noqa: E501
|
||||
|
||||
|
||||
class TestAuthApi(unittest.TestCase):
|
||||
"""AuthApi unit test stubs"""
|
||||
|
||||
def setUp(self) -> None:
|
||||
self.api = AuthApi() # noqa: E501
|
||||
|
||||
def tearDown(self) -> None:
|
||||
pass
|
||||
|
||||
def test_test_auth_http_basic(self) -> None:
|
||||
"""Test case for test_auth_http_basic
|
||||
|
||||
To test HTTP basic authentication # noqa: E501
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,56 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.models.bird import Bird # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
class TestBird(unittest.TestCase):
|
||||
"""Bird unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test Bird
|
||||
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 `Bird`
|
||||
"""
|
||||
model = openapi_client.models.bird.Bird() # noqa: E501
|
||||
if include_optional :
|
||||
return Bird(
|
||||
size = '',
|
||||
color = ''
|
||||
)
|
||||
else :
|
||||
return Bird(
|
||||
)
|
||||
"""
|
||||
|
||||
def testBird(self):
|
||||
"""Test Bird"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,41 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.api.body_api import BodyApi # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
|
||||
class TestBodyApi(unittest.TestCase):
|
||||
"""BodyApi unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
self.api = openapi_client.api.body_api.BodyApi() # noqa: E501
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def test_test_echo_body_pet(self):
|
||||
"""Test case for test_echo_body_pet
|
||||
|
||||
Test body parameter(s) # noqa: E501
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,56 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.models.category import Category # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
class TestCategory(unittest.TestCase):
|
||||
"""Category unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test Category
|
||||
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 `Category`
|
||||
"""
|
||||
model = openapi_client.models.category.Category() # noqa: E501
|
||||
if include_optional :
|
||||
return Category(
|
||||
id = 1,
|
||||
name = 'Dogs'
|
||||
)
|
||||
else :
|
||||
return Category(
|
||||
)
|
||||
"""
|
||||
|
||||
def testCategory(self):
|
||||
"""Test Category"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,57 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.models.data_query import DataQuery # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
class TestDataQuery(unittest.TestCase):
|
||||
"""DataQuery unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test DataQuery
|
||||
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 `DataQuery`
|
||||
"""
|
||||
model = openapi_client.models.data_query.DataQuery() # noqa: E501
|
||||
if include_optional :
|
||||
return DataQuery(
|
||||
suffix = '',
|
||||
text = 'Some text',
|
||||
var_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f')
|
||||
)
|
||||
else :
|
||||
return DataQuery(
|
||||
)
|
||||
"""
|
||||
|
||||
def testDataQuery(self):
|
||||
"""Test DataQuery"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,70 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.models.default_value import DefaultValue # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
class TestDefaultValue(unittest.TestCase):
|
||||
"""DefaultValue unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test DefaultValue
|
||||
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 `DefaultValue`
|
||||
"""
|
||||
model = openapi_client.models.default_value.DefaultValue() # noqa: E501
|
||||
if include_optional :
|
||||
return DefaultValue(
|
||||
array_string_enum_default = [
|
||||
'success'
|
||||
],
|
||||
array_string_default = [
|
||||
''
|
||||
],
|
||||
array_integer_default = [
|
||||
56
|
||||
],
|
||||
array_string = [
|
||||
''
|
||||
],
|
||||
array_string_nullable = [
|
||||
''
|
||||
],
|
||||
string_nullable = ''
|
||||
)
|
||||
else :
|
||||
return DefaultValue(
|
||||
)
|
||||
"""
|
||||
|
||||
def testDefaultValue(self):
|
||||
"""Test DefaultValue"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,41 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.api.form_api import FormApi # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
|
||||
class TestFormApi(unittest.TestCase):
|
||||
"""FormApi unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
self.api = openapi_client.api.form_api.FormApi() # noqa: E501
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def test_test_form_integer_boolean_string(self):
|
||||
"""Test case for test_form_integer_boolean_string
|
||||
|
||||
Test form parameter(s) # noqa: E501
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,41 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.api.header_api import HeaderApi # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
|
||||
class TestHeaderApi(unittest.TestCase):
|
||||
"""HeaderApi unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
self.api = openapi_client.api.header_api.HeaderApi() # noqa: E501
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def test_test_header_integer_boolean_string(self):
|
||||
"""Test case for test_header_integer_boolean_string
|
||||
|
||||
Test header parameter(s) # noqa: E501
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,57 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.models.number_properties_only import NumberPropertiesOnly # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
class TestNumberPropertiesOnly(unittest.TestCase):
|
||||
"""NumberPropertiesOnly unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test NumberPropertiesOnly
|
||||
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 `NumberPropertiesOnly`
|
||||
"""
|
||||
model = openapi_client.models.number_properties_only.NumberPropertiesOnly() # noqa: E501
|
||||
if include_optional :
|
||||
return NumberPropertiesOnly(
|
||||
number = 1.337,
|
||||
float = 1.337,
|
||||
double = ''
|
||||
)
|
||||
else :
|
||||
return NumberPropertiesOnly(
|
||||
)
|
||||
"""
|
||||
|
||||
def testNumberPropertiesOnly(self):
|
||||
"""Test NumberPropertiesOnly"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,41 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.api.path_api import PathApi # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
|
||||
class TestPathApi(unittest.TestCase):
|
||||
"""PathApi unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
self.api = openapi_client.api.path_api.PathApi() # noqa: E501
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def test_tests_path_string_path_string_integer_path_integer(self):
|
||||
"""Test case for tests_path_string_path_string_integer_path_integer
|
||||
|
||||
Test path parameter(s) # noqa: E501
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,72 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.models.pet import Pet # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
class TestPet(unittest.TestCase):
|
||||
"""Pet unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test Pet
|
||||
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 `Pet`
|
||||
"""
|
||||
model = openapi_client.models.pet.Pet() # noqa: E501
|
||||
if include_optional :
|
||||
return Pet(
|
||||
id = 10,
|
||||
name = 'doggie',
|
||||
category = openapi_client.models.category.Category(
|
||||
id = 1,
|
||||
name = 'Dogs', ),
|
||||
photo_urls = [
|
||||
''
|
||||
],
|
||||
tags = [
|
||||
openapi_client.models.tag.Tag(
|
||||
id = 56,
|
||||
name = '', )
|
||||
],
|
||||
status = 'available'
|
||||
)
|
||||
else :
|
||||
return Pet(
|
||||
name = 'doggie',
|
||||
photo_urls = [
|
||||
''
|
||||
],
|
||||
)
|
||||
"""
|
||||
|
||||
def testPet(self):
|
||||
"""Test Pet"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,58 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.models.query import Query # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
class TestQuery(unittest.TestCase):
|
||||
"""Query unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test Query
|
||||
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 `Query`
|
||||
"""
|
||||
model = openapi_client.models.query.Query() # noqa: E501
|
||||
if include_optional :
|
||||
return Query(
|
||||
id = 56,
|
||||
outcomes = [
|
||||
'SUCCESS'
|
||||
]
|
||||
)
|
||||
else :
|
||||
return Query(
|
||||
)
|
||||
"""
|
||||
|
||||
def testQuery(self):
|
||||
"""Test Query"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,55 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.api.query_api import QueryApi # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
|
||||
class TestQueryApi(unittest.TestCase):
|
||||
"""QueryApi unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
self.api = openapi_client.api.query_api.QueryApi() # noqa: E501
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def test_test_query_integer_boolean_string(self):
|
||||
"""Test case for test_query_integer_boolean_string
|
||||
|
||||
Test query parameter(s) # noqa: E501
|
||||
"""
|
||||
pass
|
||||
|
||||
def test_test_query_style_form_explode_true_array_string(self):
|
||||
"""Test case for test_query_style_form_explode_true_array_string
|
||||
|
||||
Test query parameter(s) # noqa: E501
|
||||
"""
|
||||
pass
|
||||
|
||||
def test_test_query_style_form_explode_true_object(self):
|
||||
"""Test case for test_query_style_form_explode_true_object
|
||||
|
||||
Test query parameter(s) # noqa: E501
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,37 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.models.string_enum_ref import StringEnumRef # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
class TestStringEnumRef(unittest.TestCase):
|
||||
"""StringEnumRef unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def testStringEnumRef(self):
|
||||
"""Test StringEnumRef"""
|
||||
# inst = StringEnumRef()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,56 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.models.tag import Tag # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
class TestTag(unittest.TestCase):
|
||||
"""Tag unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test Tag
|
||||
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 `Tag`
|
||||
"""
|
||||
model = openapi_client.models.tag.Tag() # noqa: E501
|
||||
if include_optional :
|
||||
return Tag(
|
||||
id = 56,
|
||||
name = ''
|
||||
)
|
||||
else :
|
||||
return Tag(
|
||||
)
|
||||
"""
|
||||
|
||||
def testTag(self):
|
||||
"""Test Tag"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,58 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
class TestTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(unittest.TestCase):
|
||||
"""TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
|
||||
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 `TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter`
|
||||
"""
|
||||
model = openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() # noqa: E501
|
||||
if include_optional :
|
||||
return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(
|
||||
size = '',
|
||||
color = '',
|
||||
id = 1,
|
||||
name = 'Dogs'
|
||||
)
|
||||
else :
|
||||
return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(
|
||||
)
|
||||
"""
|
||||
|
||||
def testTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(self):
|
||||
"""Test TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,57 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
class TestTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(unittest.TestCase):
|
||||
"""TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
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 `TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter`
|
||||
"""
|
||||
model = openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() # noqa: E501
|
||||
if include_optional :
|
||||
return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(
|
||||
values = [
|
||||
''
|
||||
]
|
||||
)
|
||||
else :
|
||||
return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(
|
||||
)
|
||||
"""
|
||||
|
||||
def testTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(self):
|
||||
"""Test TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 43 B |
@@ -0,0 +1,222 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
import base64
|
||||
import os
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.api.query_api import QueryApi # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
class TestManual(unittest.TestCase):
|
||||
"""Manually written tests"""
|
||||
|
||||
gif_base64 = "R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
|
||||
|
||||
def setUpFiles(self):
|
||||
self.test_file_dir = os.path.join(os.path.dirname(__file__), "..", "testfiles")
|
||||
self.test_file_dir = os.path.realpath(self.test_file_dir)
|
||||
self.test_gif = os.path.join(self.test_file_dir, "test.gif")
|
||||
|
||||
def setUp(self):
|
||||
self.setUpFiles()
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def testEnumRefString(self):
|
||||
api_instance = openapi_client.QueryApi()
|
||||
q = openapi_client.StringEnumRef("unclassified")
|
||||
|
||||
# Test query parameter(s)
|
||||
api_response = api_instance.test_enum_ref_string(enum_ref_string_query=q)
|
||||
e = EchoServerResponseParser(api_response)
|
||||
self.assertEqual(e.path, "/query/enum_ref_string?enum_ref_string_query=unclassified")
|
||||
|
||||
|
||||
def testDateTimeQueryWithDateTimeFormat(self):
|
||||
api_instance = openapi_client.QueryApi()
|
||||
datetime_format_backup = api_instance.api_client.configuration.datetime_format # backup dateime_format
|
||||
api_instance.api_client.configuration.datetime_format = "%Y-%m-%d %a %H:%M:%S%Z"
|
||||
datetime_query = datetime.datetime.fromisoformat('2013-10-20T19:20:30-05:00') # datetime | (optional)
|
||||
date_query = datetime.date(2013, 10, 20) # date | (optional)
|
||||
string_query = 'string_query_example' # str | (optional)
|
||||
|
||||
# Test query parameter(s)
|
||||
api_response = api_instance.test_query_datetime_date_string(datetime_query=datetime_query, date_query=date_query, string_query=string_query)
|
||||
e = EchoServerResponseParser(api_response)
|
||||
self.assertEqual(e.path, "/query/datetime/date/string?datetime_query=2013-10-20%20Sun%2019%3A20%3A30UTC-05%3A00&date_query=2013-10-20&string_query=string_query_example")
|
||||
|
||||
# restore datetime format
|
||||
api_instance.api_client.configuration.datetime_format = datetime_format_backup
|
||||
|
||||
def testDateTimeQueryWithDateTime(self):
|
||||
api_instance = openapi_client.QueryApi()
|
||||
datetime_query = datetime.datetime.fromisoformat('2013-10-20T19:20:30-05:00') # datetime | (optional)
|
||||
date_query = datetime.date(2013, 10, 20) # date | (optional)
|
||||
string_query = 'string_query_example' # str | (optional)
|
||||
|
||||
# Test query parameter(s)
|
||||
api_response = api_instance.test_query_datetime_date_string(datetime_query=datetime_query, date_query=date_query, string_query=string_query)
|
||||
e = EchoServerResponseParser(api_response)
|
||||
self.assertEqual(e.path, "/query/datetime/date/string?datetime_query=2013-10-20T19%3A20%3A30.000000-0500&date_query=2013-10-20&string_query=string_query_example")
|
||||
|
||||
def testBinaryGif(self):
|
||||
api_instance = openapi_client.BodyApi()
|
||||
|
||||
# Test binary response
|
||||
api_response = api_instance.test_binary_gif()
|
||||
self.assertEqual((base64.b64encode(api_response)).decode("utf-8"), self.gif_base64)
|
||||
|
||||
def testAdditionalPropertiesNotDefined(self):
|
||||
try:
|
||||
n = openapi_client.NumberPropertiesOnly.from_json('{"number": 123, "float": 456, "double": 34}')
|
||||
except ValueError as err:
|
||||
self.assertEqual("Error due to additional fields (not defined in NumberPropertiesOnly) in the input: float", str(err))
|
||||
|
||||
def testApplicatinOctetStreamBinaryBodyParameter(self):
|
||||
api_instance = openapi_client.BodyApi()
|
||||
binary_body = base64.b64decode(self.gif_base64)
|
||||
api_response = api_instance.test_body_application_octetstream_binary(binary_body)
|
||||
e = EchoServerResponseParser(api_response)
|
||||
self.assertEqual(e.path, "/body/application/octetstream/binary")
|
||||
self.assertEqual(e.headers["Content-Type"], 'application/octet-stream')
|
||||
self.assertEqual(bytes(e.body, "utf-8"), b'GIF89a\x01\x00\x01\x00\xef\xbf\xbd\x01\x00\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\x00\x00\x00!\xef\xbf\xbd\x04\x01\n\x00\x01\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02L\x01\x00;')
|
||||
|
||||
def testApplicatinOctetStreamBinaryBodyParameterWithFile(self):
|
||||
api_instance = openapi_client.BodyApi()
|
||||
try:
|
||||
api_response = api_instance.test_body_application_octetstream_binary("invalid_file_path")
|
||||
except FileNotFoundError as err:
|
||||
self.assertEqual("[Errno 2] No such file or directory: 'invalid_file_path'", str(err))
|
||||
|
||||
api_response = api_instance.test_body_application_octetstream_binary(self.test_gif)
|
||||
e = EchoServerResponseParser(api_response)
|
||||
self.assertEqual(e.path, "/body/application/octetstream/binary")
|
||||
self.assertEqual(e.headers["Content-Type"], 'application/octet-stream')
|
||||
self.assertEqual(bytes(e.body, "utf-8"), b'GIF89a\x01\x00\x01\x00\xef\xbf\xbd\x01\x00\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\x00\x00\x00!\xef\xbf\xbd\x04\x01\n\x00\x01\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02L\x01\x00;')
|
||||
|
||||
def testBodyParameter(self):
|
||||
n = openapi_client.Pet.from_dict({"name": "testing", "photoUrls": ["http://1", "http://2"]})
|
||||
api_instance = openapi_client.BodyApi()
|
||||
api_response = api_instance.test_echo_body_pet_response_string(n)
|
||||
self.assertEqual(api_response, "{'name': 'testing', 'photoUrls': ['http://1', 'http://2']}")
|
||||
|
||||
t = openapi_client.Tag()
|
||||
api_response = api_instance.test_echo_body_tag_response_string(t)
|
||||
self.assertEqual(api_response, "{}") # assertion to ensure {} is sent in the body
|
||||
|
||||
api_response = api_instance.test_echo_body_tag_response_string(None)
|
||||
self.assertEqual(api_response, "") # assertion to ensure emtpy string is sent in the body
|
||||
|
||||
api_response = api_instance.test_echo_body_free_form_object_response_string({})
|
||||
self.assertEqual(api_response, "{}") # assertion to ensure {} is sent in the body
|
||||
|
||||
def testAuthHttpBasic(self):
|
||||
api_instance = openapi_client.AuthApi()
|
||||
api_response = api_instance.test_auth_http_basic()
|
||||
e = EchoServerResponseParser(api_response)
|
||||
self.assertFalse("Authorization" in e.headers)
|
||||
|
||||
api_instance.api_client.configuration.username = "test_username"
|
||||
api_instance.api_client.configuration.password = "test_password"
|
||||
api_response = api_instance.test_auth_http_basic()
|
||||
e = EchoServerResponseParser(api_response)
|
||||
self.assertTrue("Authorization" in e.headers)
|
||||
self.assertEqual(e.headers["Authorization"], "Basic dGVzdF91c2VybmFtZTp0ZXN0X3Bhc3N3b3Jk")
|
||||
|
||||
# test from_json, to_json, to_dict, from_dict
|
||||
def test_from_to_methods(self):
|
||||
json_str = ("{\"category\": {\"id\": 1, \"name\": \"dog\"},\n"
|
||||
" \"id\": 1,\n"
|
||||
" \"name\": \"test name\",\n"
|
||||
" \"photoUrls\": [\"string\"],\n"
|
||||
" \"status\": \"available\",\n"
|
||||
" \"tags\": [{\"id\": 1, \"name\": \"None\"}]}")
|
||||
pet = openapi_client.Pet.from_json(json_str)
|
||||
assert pet is not None
|
||||
self.assertEqual(pet.id, 1)
|
||||
self.assertEqual(pet.status, "available")
|
||||
self.assertEqual(pet.photo_urls, ["string"])
|
||||
assert pet.tags is not None
|
||||
self.assertEqual(pet.tags[0].id, 1)
|
||||
self.assertEqual(pet.tags[0].name, "None")
|
||||
assert pet.category is not None
|
||||
self.assertEqual(pet.category.id, 1)
|
||||
# test to_json
|
||||
self.assertEqual(pet.to_json(),
|
||||
'{"id": 1, "name": "test name", "category": {"id": 1, "name": "dog"}, "photoUrls": ['
|
||||
'"string"], "tags": [{"id": 1, "name": "None"}], "status": "available"}')
|
||||
|
||||
# test to_dict
|
||||
self.assertEqual(pet.to_dict(),
|
||||
{"id": 1, "name": "test name", "category": {"id": 1, "name": "dog"}, "photoUrls": ["string"],
|
||||
"tags": [{"id": 1, "name": "None"}], "status": "available"})
|
||||
|
||||
# test from_dict
|
||||
pet2 = openapi_client.Pet.from_dict(pet.to_dict())
|
||||
assert pet2 is not None
|
||||
self.assertEqual(pet2.id, 1)
|
||||
self.assertEqual(pet2.status, "available")
|
||||
self.assertEqual(pet2.photo_urls, ["string"])
|
||||
assert pet2.tags is not None
|
||||
self.assertEqual(pet2.tags[0].id, 1)
|
||||
self.assertEqual(pet2.tags[0].name, "None")
|
||||
assert pet2.category is not None
|
||||
self.assertEqual(pet2.category.id, 1)
|
||||
|
||||
def echoServerResponseParaserTest(self):
|
||||
s = """POST /echo/body/Pet/response_string HTTP/1.1
|
||||
Host: localhost:3000
|
||||
Accept-Encoding: identity
|
||||
Content-Length: 58
|
||||
Accept: text/plain
|
||||
Content-Type: application/json
|
||||
User-Agent: OpenAPI-Generator/1.0.0/python
|
||||
|
||||
{"name": "testing", "photoUrls": ["http://1", "http://2"]}"""
|
||||
e = EchoServerResponseParser(s)
|
||||
self.assertEqual(e.body, '{"name": "testing", "photoUrls": ["http://1", "http://2"]}')
|
||||
self.assertEqual(e.path, '/echo/body/Pet/response_string')
|
||||
self.assertEqual(e.headers["Accept"], 'text/plain')
|
||||
self.assertEqual(e.method, 'POST')
|
||||
|
||||
class EchoServerResponseParser():
|
||||
def __init__(self, http_response):
|
||||
if http_response is None:
|
||||
raise ValueError("http response must not be None.")
|
||||
|
||||
lines = http_response.splitlines()
|
||||
self.headers = dict()
|
||||
x = 0
|
||||
while x < len(lines):
|
||||
if x == 0:
|
||||
items = lines[x].split(" ")
|
||||
self.method = items[0];
|
||||
self.path = items[1];
|
||||
self.protocol = items[2];
|
||||
elif lines[x] == "": # blank line
|
||||
self.body = "\n".join(lines[x+1:])
|
||||
break
|
||||
else:
|
||||
key_value = lines[x].split(": ")
|
||||
# store the header key-value pair in headers
|
||||
if len(key_value) == 2:
|
||||
self.headers[key_value[0]] = key_value[1]
|
||||
x = x+1
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,9 @@
|
||||
[tox]
|
||||
envlist = py3
|
||||
|
||||
[testenv]
|
||||
deps=-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
||||
commands=
|
||||
pytest --cov=openapi_client
|
||||
Reference in New Issue
Block a user