diff --git a/service/.github/workflows/python.yml b/.github/workflows/python.yml similarity index 100% rename from service/.github/workflows/python.yml rename to .github/workflows/python.yml diff --git a/.gitignore b/.gitignore index 13e78388..43995bd4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,66 @@ -.idea -.gradle -**/build/ -!src/**/build/ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class -# Ignore Gradle GUI config -gradle-app.setting +# C extensions +*.so -# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) -!gradle-wrapper.jar +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg -# Avoid ignore Gradle wrappper properties -!gradle-wrapper.properties +# 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 -# Cache of project -.gradletasknamecache +# Installer logs +pip-log.txt +pip-delete-this-directory.txt -# Eclipse Gradle plugin generated files -# Eclipse Core -.project -# JDT-specific (Eclipse Java Development Tools) -.classpath +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.venv/ +.python-version +.pytest_cache -**/__pycache__/ +# Translations +*.mo +*.pot -*.iml -/service/.venv/ +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..29da7211 --- /dev/null +++ b/.gitlab-ci.yml @@ -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 diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 00000000..7484ee59 --- /dev/null +++ b/.openapi-generator-ignore @@ -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 diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 00000000..100368a3 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,92 @@ +.github/workflows/python.yml +.gitignore +.gitlab-ci.yml +.openapi-generator-ignore +.travis.yml +README.md +docs/Cost.md +docs/Direction.md +docs/ErrorContext.md +docs/ErrorType.md +docs/ImagePredictionResponse.md +docs/ImageRecognitionApi.md +docs/Location.md +docs/Message.md +docs/MiscInstruction.md +docs/Move.md +docs/Path.md +docs/PathfindingApi.md +docs/PathfindingPoint.md +docs/PathfindingRequest.md +docs/PathfindingRequestObstacle.md +docs/PathfindingRequestRobot.md +docs/PathfindingResponse.md +docs/PathfindingResponseMoveInstruction.md +docs/PathfindingResponseSegment.md +docs/PathfindingResponseSegmentInstructionsInner.md +docs/PathfindingVector.md +docs/TurnInstruction.md +docs/ValidationErrorModel.md +git_push.sh +openapi_client/__init__.py +openapi_client/api/__init__.py +openapi_client/api/image_recognition_api.py +openapi_client/api/pathfinding_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/cost.py +openapi_client/models/direction.py +openapi_client/models/error_context.py +openapi_client/models/error_type.py +openapi_client/models/image_prediction_response.py +openapi_client/models/location.py +openapi_client/models/message.py +openapi_client/models/misc_instruction.py +openapi_client/models/move.py +openapi_client/models/path.py +openapi_client/models/pathfinding_point.py +openapi_client/models/pathfinding_request.py +openapi_client/models/pathfinding_request_obstacle.py +openapi_client/models/pathfinding_request_robot.py +openapi_client/models/pathfinding_response.py +openapi_client/models/pathfinding_response_move_instruction.py +openapi_client/models/pathfinding_response_segment.py +openapi_client/models/pathfinding_response_segment_instructions_inner.py +openapi_client/models/pathfinding_vector.py +openapi_client/models/turn_instruction.py +openapi_client/models/validation_error_model.py +openapi_client/py.typed +openapi_client/rest.py +pyproject.toml +requirements.txt +setup.cfg +setup.py +test-requirements.txt +test/__init__.py +test/test_cost.py +test/test_direction.py +test/test_error_context.py +test/test_error_type.py +test/test_image_prediction_response.py +test/test_image_recognition_api.py +test/test_location.py +test/test_message.py +test/test_misc_instruction.py +test/test_move.py +test/test_path.py +test/test_pathfinding_api.py +test/test_pathfinding_point.py +test/test_pathfinding_request.py +test/test_pathfinding_request_obstacle.py +test/test_pathfinding_request_robot.py +test/test_pathfinding_response.py +test/test_pathfinding_response_move_instruction.py +test/test_pathfinding_response_segment.py +test/test_pathfinding_response_segment_instructions_inner.py +test/test_pathfinding_vector.py +test/test_turn_instruction.py +test/test_validation_error_model.py +tox.ini diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 00000000..8b23b8d4 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.3.0 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..fd888f75 --- /dev/null +++ b/.travis.yml @@ -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 diff --git a/README.md b/README.md index 44a1907e..501c3c92 100644 --- a/README.md +++ b/README.md @@ -1 +1,130 @@ -# CZ3004-SC2079-MDP-GROUP 14 \ No newline at end of file +# CZ3004-SC2079-MDP-GROUP 14 + + +# openapi-client +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.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 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost" +) + + + +# 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.ImageRecognitionApi(api_client) + file = None # bytearray | + + try: + api_response = api_instance.image_prediction_task1_post(file) + print("The response of ImageRecognitionApi->image_prediction_task1_post:\n") + pprint(api_response) + except ApiException as e: + print("Exception when calling ImageRecognitionApi->image_prediction_task1_post: %s\n" % e) + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*ImageRecognitionApi* | [**image_prediction_task1_post**](docs/ImageRecognitionApi.md#image_prediction_task1_post) | **POST** /image/prediction/task-1 | +*ImageRecognitionApi* | [**image_prediction_task2_post**](docs/ImageRecognitionApi.md#image_prediction_task2_post) | **POST** /image/prediction/task-2 | +*ImageRecognitionApi* | [**image_stitch_post**](docs/ImageRecognitionApi.md#image_stitch_post) | **POST** /image/stitch | +*PathfindingApi* | [**pathfinding_post**](docs/PathfindingApi.md#pathfinding_post) | **POST** /pathfinding/ | + + +## Documentation For Models + + - [Cost](docs/Cost.md) + - [Direction](docs/Direction.md) + - [ErrorContext](docs/ErrorContext.md) + - [ErrorType](docs/ErrorType.md) + - [ImagePredictionResponse](docs/ImagePredictionResponse.md) + - [Location](docs/Location.md) + - [Message](docs/Message.md) + - [MiscInstruction](docs/MiscInstruction.md) + - [Move](docs/Move.md) + - [Path](docs/Path.md) + - [PathfindingPoint](docs/PathfindingPoint.md) + - [PathfindingRequest](docs/PathfindingRequest.md) + - [PathfindingRequestObstacle](docs/PathfindingRequestObstacle.md) + - [PathfindingRequestRobot](docs/PathfindingRequestRobot.md) + - [PathfindingResponse](docs/PathfindingResponse.md) + - [PathfindingResponseMoveInstruction](docs/PathfindingResponseMoveInstruction.md) + - [PathfindingResponseSegment](docs/PathfindingResponseSegment.md) + - [PathfindingResponseSegmentInstructionsInner](docs/PathfindingResponseSegmentInstructionsInner.md) + - [PathfindingVector](docs/PathfindingVector.md) + - [TurnInstruction](docs/TurnInstruction.md) + - [ValidationErrorModel](docs/ValidationErrorModel.md) + + + +## Documentation For Authorization + +Endpoints do not require authorization. + + +## Author + + + + diff --git a/docs/Cost.md b/docs/Cost.md new file mode 100644 index 00000000..12847733 --- /dev/null +++ b/docs/Cost.md @@ -0,0 +1,29 @@ +# Cost + +The cost, included only if verbose is true. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from openapi_client.models.cost import Cost + +# TODO update the JSON string below +json = "{}" +# create an instance of Cost from a JSON string +cost_instance = Cost.from_json(json) +# print the JSON string representation of the object +print Cost.to_json() + +# convert the object into a dict +cost_dict = cost_instance.to_dict() +# create an instance of Cost from a dict +cost_form_dict = cost.from_dict(cost_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Direction.md b/docs/Direction.md new file mode 100644 index 00000000..2903e479 --- /dev/null +++ b/docs/Direction.md @@ -0,0 +1,11 @@ +# Direction + + +## 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) + + diff --git a/docs/ErrorContext.md b/docs/ErrorContext.md new file mode 100644 index 00000000..e7202a01 --- /dev/null +++ b/docs/ErrorContext.md @@ -0,0 +1,29 @@ +# ErrorContext + +an optional object which contains values required to render the error message. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from openapi_client.models.error_context import ErrorContext + +# TODO update the JSON string below +json = "{}" +# create an instance of ErrorContext from a JSON string +error_context_instance = ErrorContext.from_json(json) +# print the JSON string representation of the object +print ErrorContext.to_json() + +# convert the object into a dict +error_context_dict = error_context_instance.to_dict() +# create an instance of ErrorContext from a dict +error_context_form_dict = error_context.from_dict(error_context_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ErrorType.md b/docs/ErrorType.md new file mode 100644 index 00000000..8ca483ef --- /dev/null +++ b/docs/ErrorType.md @@ -0,0 +1,29 @@ +# ErrorType + +a human readable explanation of the error. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from openapi_client.models.error_type import ErrorType + +# TODO update the JSON string below +json = "{}" +# create an instance of ErrorType from a JSON string +error_type_instance = ErrorType.from_json(json) +# print the JSON string representation of the object +print ErrorType.to_json() + +# convert the object into a dict +error_type_dict = error_type_instance.to_dict() +# create an instance of ErrorType from a dict +error_type_form_dict = error_type.from_dict(error_type_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ImagePredictionResponse.md b/docs/ImagePredictionResponse.md new file mode 100644 index 00000000..455cef87 --- /dev/null +++ b/docs/ImagePredictionResponse.md @@ -0,0 +1,30 @@ +# ImagePredictionResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**image_id** | **int** | | +**obstacle_id** | **int** | | + +## Example + +```python +from openapi_client.models.image_prediction_response import ImagePredictionResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ImagePredictionResponse from a JSON string +image_prediction_response_instance = ImagePredictionResponse.from_json(json) +# print the JSON string representation of the object +print ImagePredictionResponse.to_json() + +# convert the object into a dict +image_prediction_response_dict = image_prediction_response_instance.to_dict() +# create an instance of ImagePredictionResponse from a dict +image_prediction_response_form_dict = image_prediction_response.from_dict(image_prediction_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ImageRecognitionApi.md b/docs/ImageRecognitionApi.md new file mode 100644 index 00000000..32d90317 --- /dev/null +++ b/docs/ImageRecognitionApi.md @@ -0,0 +1,196 @@ +# openapi_client.ImageRecognitionApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**image_prediction_task1_post**](ImageRecognitionApi.md#image_prediction_task1_post) | **POST** /image/prediction/task-1 | +[**image_prediction_task2_post**](ImageRecognitionApi.md#image_prediction_task2_post) | **POST** /image/prediction/task-2 | +[**image_stitch_post**](ImageRecognitionApi.md#image_stitch_post) | **POST** /image/stitch | + + +# **image_prediction_task1_post** +> ImagePredictionResponse image_prediction_task1_post(file) + + + +### Example + + +```python +import openapi_client +from openapi_client.models.image_prediction_response import ImagePredictionResponse +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost" +) + + +# 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.ImageRecognitionApi(api_client) + file = None # bytearray | + + try: + api_response = api_instance.image_prediction_task1_post(file) + print("The response of ImageRecognitionApi->image_prediction_task1_post:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ImageRecognitionApi->image_prediction_task1_post: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file** | **bytearray**| | + +### Return type + +[**ImagePredictionResponse**](ImagePredictionResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**422** | Unprocessable Entity | - | + +[[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) + +# **image_prediction_task2_post** +> ImagePredictionResponse image_prediction_task2_post(file) + + + +### Example + + +```python +import openapi_client +from openapi_client.models.image_prediction_response import ImagePredictionResponse +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost" +) + + +# 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.ImageRecognitionApi(api_client) + file = None # bytearray | + + try: + api_response = api_instance.image_prediction_task2_post(file) + print("The response of ImageRecognitionApi->image_prediction_task2_post:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ImageRecognitionApi->image_prediction_task2_post: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file** | **bytearray**| | + +### Return type + +[**ImagePredictionResponse**](ImagePredictionResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**422** | Unprocessable Entity | - | + +[[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) + +# **image_stitch_post** +> image_stitch_post() + + + +### 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 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost" +) + + +# 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.ImageRecognitionApi(api_client) + + try: + api_instance.image_stitch_post() + except Exception as e: + print("Exception when calling ImageRecognitionApi->image_stitch_post: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Location.md b/docs/Location.md new file mode 100644 index 00000000..2f8644a8 --- /dev/null +++ b/docs/Location.md @@ -0,0 +1,29 @@ +# Location + +the error's location as a list. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from openapi_client.models.location import Location + +# TODO update the JSON string below +json = "{}" +# create an instance of Location from a JSON string +location_instance = Location.from_json(json) +# print the JSON string representation of the object +print Location.to_json() + +# convert the object into a dict +location_dict = location_instance.to_dict() +# create an instance of Location from a dict +location_form_dict = location.from_dict(location_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Message.md b/docs/Message.md new file mode 100644 index 00000000..786ff0cf --- /dev/null +++ b/docs/Message.md @@ -0,0 +1,29 @@ +# Message + +a computer-readable identifier of the error type. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from openapi_client.models.message import Message + +# TODO update the JSON string below +json = "{}" +# create an instance of Message from a JSON string +message_instance = Message.from_json(json) +# print the JSON string representation of the object +print Message.to_json() + +# convert the object into a dict +message_dict = message_instance.to_dict() +# create an instance of Message from a dict +message_form_dict = message.from_dict(message_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MiscInstruction.md b/docs/MiscInstruction.md new file mode 100644 index 00000000..cb8b3e03 --- /dev/null +++ b/docs/MiscInstruction.md @@ -0,0 +1,11 @@ +# MiscInstruction + + +## 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) + + diff --git a/docs/Move.md b/docs/Move.md new file mode 100644 index 00000000..0e7bd294 --- /dev/null +++ b/docs/Move.md @@ -0,0 +1,11 @@ +# Move + + +## 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) + + diff --git a/docs/Path.md b/docs/Path.md new file mode 100644 index 00000000..b9faf367 --- /dev/null +++ b/docs/Path.md @@ -0,0 +1,29 @@ +# Path + +The path (unordered), included only if verbose is true. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from openapi_client.models.path import Path + +# TODO update the JSON string below +json = "{}" +# create an instance of Path from a JSON string +path_instance = Path.from_json(json) +# print the JSON string representation of the object +print Path.to_json() + +# convert the object into a dict +path_dict = path_instance.to_dict() +# create an instance of Path from a dict +path_form_dict = path.from_dict(path_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PathfindingApi.md b/docs/PathfindingApi.md new file mode 100644 index 00000000..450ff0cf --- /dev/null +++ b/docs/PathfindingApi.md @@ -0,0 +1,76 @@ +# openapi_client.PathfindingApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**pathfinding_post**](PathfindingApi.md#pathfinding_post) | **POST** /pathfinding/ | + + +# **pathfinding_post** +> PathfindingResponse pathfinding_post(pathfinding_request) + + + +### Example + + +```python +import openapi_client +from openapi_client.models.pathfinding_request import PathfindingRequest +from openapi_client.models.pathfinding_response import PathfindingResponse +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost" +) + + +# 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.PathfindingApi(api_client) + pathfinding_request = openapi_client.PathfindingRequest() # PathfindingRequest | + + try: + api_response = api_instance.pathfinding_post(pathfinding_request) + print("The response of PathfindingApi->pathfinding_post:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PathfindingApi->pathfinding_post: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pathfinding_request** | [**PathfindingRequest**](PathfindingRequest.md)| | + +### Return type + +[**PathfindingResponse**](PathfindingResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**422** | Unprocessable Entity | - | + +[[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) + diff --git a/docs/PathfindingPoint.md b/docs/PathfindingPoint.md new file mode 100644 index 00000000..40df1367 --- /dev/null +++ b/docs/PathfindingPoint.md @@ -0,0 +1,30 @@ +# PathfindingPoint + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**x** | **int** | | +**y** | **int** | | + +## Example + +```python +from openapi_client.models.pathfinding_point import PathfindingPoint + +# TODO update the JSON string below +json = "{}" +# create an instance of PathfindingPoint from a JSON string +pathfinding_point_instance = PathfindingPoint.from_json(json) +# print the JSON string representation of the object +print PathfindingPoint.to_json() + +# convert the object into a dict +pathfinding_point_dict = pathfinding_point_instance.to_dict() +# create an instance of PathfindingPoint from a dict +pathfinding_point_form_dict = pathfinding_point.from_dict(pathfinding_point_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PathfindingRequest.md b/docs/PathfindingRequest.md new file mode 100644 index 00000000..4fb7b472 --- /dev/null +++ b/docs/PathfindingRequest.md @@ -0,0 +1,31 @@ +# PathfindingRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**obstacles** | [**List[PathfindingRequestObstacle]**](PathfindingRequestObstacle.md) | | +**robot** | [**PathfindingRequestRobot**](PathfindingRequestRobot.md) | The initial position of the robot. | +**verbose** | **bool** | Whether to attach the path and cost alongside the movement instructions in the response. | [optional] [default to True] + +## Example + +```python +from openapi_client.models.pathfinding_request import PathfindingRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of PathfindingRequest from a JSON string +pathfinding_request_instance = PathfindingRequest.from_json(json) +# print the JSON string representation of the object +print PathfindingRequest.to_json() + +# convert the object into a dict +pathfinding_request_dict = pathfinding_request_instance.to_dict() +# create an instance of PathfindingRequest from a dict +pathfinding_request_form_dict = pathfinding_request.from_dict(pathfinding_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PathfindingRequestObstacle.md b/docs/PathfindingRequestObstacle.md new file mode 100644 index 00000000..1501881c --- /dev/null +++ b/docs/PathfindingRequestObstacle.md @@ -0,0 +1,32 @@ +# PathfindingRequestObstacle + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**direction** | [**Direction**](Direction.md) | The direction of the image. | +**image_id** | **int** | The image ID. | +**north_east** | [**PathfindingPoint**](PathfindingPoint.md) | The north-east corner of the obstacle. | +**south_west** | [**PathfindingPoint**](PathfindingPoint.md) | The south-west corner of the obstacle. | + +## Example + +```python +from openapi_client.models.pathfinding_request_obstacle import PathfindingRequestObstacle + +# TODO update the JSON string below +json = "{}" +# create an instance of PathfindingRequestObstacle from a JSON string +pathfinding_request_obstacle_instance = PathfindingRequestObstacle.from_json(json) +# print the JSON string representation of the object +print PathfindingRequestObstacle.to_json() + +# convert the object into a dict +pathfinding_request_obstacle_dict = pathfinding_request_obstacle_instance.to_dict() +# create an instance of PathfindingRequestObstacle from a dict +pathfinding_request_obstacle_form_dict = pathfinding_request_obstacle.from_dict(pathfinding_request_obstacle_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PathfindingRequestRobot.md b/docs/PathfindingRequestRobot.md new file mode 100644 index 00000000..022698d3 --- /dev/null +++ b/docs/PathfindingRequestRobot.md @@ -0,0 +1,31 @@ +# PathfindingRequestRobot + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**direction** | [**Direction**](Direction.md) | The direction of the robot. | +**north_east** | [**PathfindingPoint**](PathfindingPoint.md) | The north-east corner of the robot. | +**south_west** | [**PathfindingPoint**](PathfindingPoint.md) | The south-west corner of the robot. | + +## Example + +```python +from openapi_client.models.pathfinding_request_robot import PathfindingRequestRobot + +# TODO update the JSON string below +json = "{}" +# create an instance of PathfindingRequestRobot from a JSON string +pathfinding_request_robot_instance = PathfindingRequestRobot.from_json(json) +# print the JSON string representation of the object +print PathfindingRequestRobot.to_json() + +# convert the object into a dict +pathfinding_request_robot_dict = pathfinding_request_robot_instance.to_dict() +# create an instance of PathfindingRequestRobot from a dict +pathfinding_request_robot_form_dict = pathfinding_request_robot.from_dict(pathfinding_request_robot_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PathfindingResponse.md b/docs/PathfindingResponse.md new file mode 100644 index 00000000..bc6c6561 --- /dev/null +++ b/docs/PathfindingResponse.md @@ -0,0 +1,29 @@ +# PathfindingResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**segments** | [**List[PathfindingResponseSegment]**](PathfindingResponseSegment.md) | The data for moving the robot from the start/objective to another objective. | + +## Example + +```python +from openapi_client.models.pathfinding_response import PathfindingResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of PathfindingResponse from a JSON string +pathfinding_response_instance = PathfindingResponse.from_json(json) +# print the JSON string representation of the object +print PathfindingResponse.to_json() + +# convert the object into a dict +pathfinding_response_dict = pathfinding_response_instance.to_dict() +# create an instance of PathfindingResponse from a dict +pathfinding_response_form_dict = pathfinding_response.from_dict(pathfinding_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PathfindingResponseMoveInstruction.md b/docs/PathfindingResponseMoveInstruction.md new file mode 100644 index 00000000..f427ff6d --- /dev/null +++ b/docs/PathfindingResponseMoveInstruction.md @@ -0,0 +1,30 @@ +# PathfindingResponseMoveInstruction + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | The amount to move the robot in centimetres. | +**move** | [**Move**](Move.md) | | + +## Example + +```python +from openapi_client.models.pathfinding_response_move_instruction import PathfindingResponseMoveInstruction + +# TODO update the JSON string below +json = "{}" +# create an instance of PathfindingResponseMoveInstruction from a JSON string +pathfinding_response_move_instruction_instance = PathfindingResponseMoveInstruction.from_json(json) +# print the JSON string representation of the object +print PathfindingResponseMoveInstruction.to_json() + +# convert the object into a dict +pathfinding_response_move_instruction_dict = pathfinding_response_move_instruction_instance.to_dict() +# create an instance of PathfindingResponseMoveInstruction from a dict +pathfinding_response_move_instruction_form_dict = pathfinding_response_move_instruction.from_dict(pathfinding_response_move_instruction_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PathfindingResponseSegment.md b/docs/PathfindingResponseSegment.md new file mode 100644 index 00000000..85721c29 --- /dev/null +++ b/docs/PathfindingResponseSegment.md @@ -0,0 +1,32 @@ +# PathfindingResponseSegment + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cost** | [**Cost**](Cost.md) | | +**image_id** | **int** | | +**instructions** | [**List[PathfindingResponseSegmentInstructionsInner]**](PathfindingResponseSegmentInstructionsInner.md) | | +**path** | [**Path**](Path.md) | | + +## Example + +```python +from openapi_client.models.pathfinding_response_segment import PathfindingResponseSegment + +# TODO update the JSON string below +json = "{}" +# create an instance of PathfindingResponseSegment from a JSON string +pathfinding_response_segment_instance = PathfindingResponseSegment.from_json(json) +# print the JSON string representation of the object +print PathfindingResponseSegment.to_json() + +# convert the object into a dict +pathfinding_response_segment_dict = pathfinding_response_segment_instance.to_dict() +# create an instance of PathfindingResponseSegment from a dict +pathfinding_response_segment_form_dict = pathfinding_response_segment.from_dict(pathfinding_response_segment_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PathfindingResponseSegmentInstructionsInner.md b/docs/PathfindingResponseSegmentInstructionsInner.md new file mode 100644 index 00000000..b2f14d0d --- /dev/null +++ b/docs/PathfindingResponseSegmentInstructionsInner.md @@ -0,0 +1,30 @@ +# PathfindingResponseSegmentInstructionsInner + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **object** | The amount to move the robot in centimetres. | +**move** | [**Move**](Move.md) | | + +## Example + +```python +from openapi_client.models.pathfinding_response_segment_instructions_inner import PathfindingResponseSegmentInstructionsInner + +# TODO update the JSON string below +json = "{}" +# create an instance of PathfindingResponseSegmentInstructionsInner from a JSON string +pathfinding_response_segment_instructions_inner_instance = PathfindingResponseSegmentInstructionsInner.from_json(json) +# print the JSON string representation of the object +print PathfindingResponseSegmentInstructionsInner.to_json() + +# convert the object into a dict +pathfinding_response_segment_instructions_inner_dict = pathfinding_response_segment_instructions_inner_instance.to_dict() +# create an instance of PathfindingResponseSegmentInstructionsInner from a dict +pathfinding_response_segment_instructions_inner_form_dict = pathfinding_response_segment_instructions_inner.from_dict(pathfinding_response_segment_instructions_inner_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PathfindingVector.md b/docs/PathfindingVector.md new file mode 100644 index 00000000..f7af08f7 --- /dev/null +++ b/docs/PathfindingVector.md @@ -0,0 +1,31 @@ +# PathfindingVector + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**direction** | [**Direction**](Direction.md) | The direction | +**x** | **int** | | +**y** | **int** | | + +## Example + +```python +from openapi_client.models.pathfinding_vector import PathfindingVector + +# TODO update the JSON string below +json = "{}" +# create an instance of PathfindingVector from a JSON string +pathfinding_vector_instance = PathfindingVector.from_json(json) +# print the JSON string representation of the object +print PathfindingVector.to_json() + +# convert the object into a dict +pathfinding_vector_dict = pathfinding_vector_instance.to_dict() +# create an instance of PathfindingVector from a dict +pathfinding_vector_form_dict = pathfinding_vector.from_dict(pathfinding_vector_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TurnInstruction.md b/docs/TurnInstruction.md new file mode 100644 index 00000000..9a897f4f --- /dev/null +++ b/docs/TurnInstruction.md @@ -0,0 +1,11 @@ +# TurnInstruction + + +## 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) + + diff --git a/docs/ValidationErrorModel.md b/docs/ValidationErrorModel.md new file mode 100644 index 00000000..dda70de8 --- /dev/null +++ b/docs/ValidationErrorModel.md @@ -0,0 +1,32 @@ +# ValidationErrorModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ctx** | [**ErrorContext**](ErrorContext.md) | | [optional] +**loc** | [**Location**](Location.md) | | [optional] +**msg** | [**Message**](Message.md) | | [optional] +**type_** | [**ErrorType**](ErrorType.md) | | [optional] + +## Example + +```python +from openapi_client.models.validation_error_model import ValidationErrorModel + +# TODO update the JSON string below +json = "{}" +# create an instance of ValidationErrorModel from a JSON string +validation_error_model_instance = ValidationErrorModel.from_json(json) +# print the JSON string representation of the object +print ValidationErrorModel.to_json() + +# convert the object into a dict +validation_error_model_dict = validation_error_model_instance.to_dict() +# create an instance of ValidationErrorModel from a dict +validation_error_model_form_dict = validation_error_model.from_dict(validation_error_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 00000000..f53a75d4 --- /dev/null +++ b/git_push.sh @@ -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' diff --git a/openapi_client/__init__.py b/openapi_client/__init__.py new file mode 100644 index 00000000..c03cd71c --- /dev/null +++ b/openapi_client/__init__.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +# flake8: noqa + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +__version__ = "1.0.0" + +# import apis into sdk package +from openapi_client.api.image_recognition_api import ImageRecognitionApi +from openapi_client.api.pathfinding_api import PathfindingApi + +# 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.cost import Cost +from openapi_client.models.direction import Direction +from openapi_client.models.error_context import ErrorContext +from openapi_client.models.error_type import ErrorType +from openapi_client.models.image_prediction_response import ImagePredictionResponse +from openapi_client.models.location import Location +from openapi_client.models.message import Message +from openapi_client.models.misc_instruction import MiscInstruction +from openapi_client.models.move import Move +from openapi_client.models.path import Path +from openapi_client.models.pathfinding_point import PathfindingPoint +from openapi_client.models.pathfinding_request import PathfindingRequest +from openapi_client.models.pathfinding_request_obstacle import PathfindingRequestObstacle +from openapi_client.models.pathfinding_request_robot import PathfindingRequestRobot +from openapi_client.models.pathfinding_response import PathfindingResponse +from openapi_client.models.pathfinding_response_move_instruction import PathfindingResponseMoveInstruction +from openapi_client.models.pathfinding_response_segment import PathfindingResponseSegment +from openapi_client.models.pathfinding_response_segment_instructions_inner import PathfindingResponseSegmentInstructionsInner +from openapi_client.models.pathfinding_vector import PathfindingVector +from openapi_client.models.turn_instruction import TurnInstruction +from openapi_client.models.validation_error_model import ValidationErrorModel diff --git a/openapi_client/api/__init__.py b/openapi_client/api/__init__.py new file mode 100644 index 00000000..620a6513 --- /dev/null +++ b/openapi_client/api/__init__.py @@ -0,0 +1,6 @@ +# flake8: noqa + +# import apis into api package +from openapi_client.api.image_recognition_api import ImageRecognitionApi +from openapi_client.api.pathfinding_api import PathfindingApi + diff --git a/openapi_client/api/image_recognition_api.py b/openapi_client/api/image_recognition_api.py new file mode 100644 index 00000000..1818abcd --- /dev/null +++ b/openapi_client/api/image_recognition_api.py @@ -0,0 +1,808 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import 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 StrictBytes, StrictStr +from typing import Union +from openapi_client.models.image_prediction_response import ImagePredictionResponse + +from openapi_client.api_client import ApiClient, RequestSerialized +from openapi_client.api_response import ApiResponse +from openapi_client.rest import RESTResponseType + + +class ImageRecognitionApi: + """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 image_prediction_task1_post( + self, + file: Union[StrictBytes, StrictStr], + _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, + ) -> ImagePredictionResponse: + """image_prediction_task1_post + + + :param file: (required) + :type file: bytearray + :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._image_prediction_task1_post_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ImagePredictionResponse", + '422': "List[ValidationErrorModel]", + } + 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 image_prediction_task1_post_with_http_info( + self, + file: Union[StrictBytes, StrictStr], + _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[ImagePredictionResponse]: + """image_prediction_task1_post + + + :param file: (required) + :type file: bytearray + :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._image_prediction_task1_post_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ImagePredictionResponse", + '422': "List[ValidationErrorModel]", + } + 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 image_prediction_task1_post_without_preload_content( + self, + file: Union[StrictBytes, StrictStr], + _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: + """image_prediction_task1_post + + + :param file: (required) + :type file: bytearray + :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._image_prediction_task1_post_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ImagePredictionResponse", + '422': "List[ValidationErrorModel]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _image_prediction_task1_post_serialize( + self, + file, + _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 file is not None: + _files['file'] = file + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/image/prediction/task-1', + 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 image_prediction_task2_post( + self, + file: Union[StrictBytes, StrictStr], + _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, + ) -> ImagePredictionResponse: + """image_prediction_task2_post + + + :param file: (required) + :type file: bytearray + :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._image_prediction_task2_post_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ImagePredictionResponse", + '422': "List[ValidationErrorModel]", + } + 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 image_prediction_task2_post_with_http_info( + self, + file: Union[StrictBytes, StrictStr], + _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[ImagePredictionResponse]: + """image_prediction_task2_post + + + :param file: (required) + :type file: bytearray + :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._image_prediction_task2_post_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ImagePredictionResponse", + '422': "List[ValidationErrorModel]", + } + 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 image_prediction_task2_post_without_preload_content( + self, + file: Union[StrictBytes, StrictStr], + _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: + """image_prediction_task2_post + + + :param file: (required) + :type file: bytearray + :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._image_prediction_task2_post_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ImagePredictionResponse", + '422': "List[ValidationErrorModel]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _image_prediction_task2_post_serialize( + self, + file, + _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 file is not None: + _files['file'] = file + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/image/prediction/task-2', + 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 image_stitch_post( + 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, + ) -> None: + """image_stitch_post + + + :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._image_stitch_post_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[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 image_stitch_post_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[None]: + """image_stitch_post + + + :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._image_stitch_post_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[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 image_stitch_post_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: + """image_stitch_post + + + :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._image_stitch_post_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _image_stitch_post_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 + + + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/image/stitch', + 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 + ) + + diff --git a/openapi_client/api/pathfinding_api.py b/openapi_client/api/pathfinding_api.py new file mode 100644 index 00000000..f61ed91a --- /dev/null +++ b/openapi_client/api/pathfinding_api.py @@ -0,0 +1,307 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import 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.models.pathfinding_request import PathfindingRequest +from openapi_client.models.pathfinding_response import PathfindingResponse + +from openapi_client.api_client import ApiClient, RequestSerialized +from openapi_client.api_response import ApiResponse +from openapi_client.rest import RESTResponseType + + +class PathfindingApi: + """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 pathfinding_post( + self, + pathfinding_request: PathfindingRequest, + _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, + ) -> PathfindingResponse: + """pathfinding_post + + + :param pathfinding_request: (required) + :type pathfinding_request: PathfindingRequest + :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._pathfinding_post_serialize( + pathfinding_request=pathfinding_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PathfindingResponse", + '422': "List[ValidationErrorModel]", + } + 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 pathfinding_post_with_http_info( + self, + pathfinding_request: PathfindingRequest, + _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[PathfindingResponse]: + """pathfinding_post + + + :param pathfinding_request: (required) + :type pathfinding_request: PathfindingRequest + :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._pathfinding_post_serialize( + pathfinding_request=pathfinding_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PathfindingResponse", + '422': "List[ValidationErrorModel]", + } + 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 pathfinding_post_without_preload_content( + self, + pathfinding_request: PathfindingRequest, + _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: + """pathfinding_post + + + :param pathfinding_request: (required) + :type pathfinding_request: PathfindingRequest + :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._pathfinding_post_serialize( + pathfinding_request=pathfinding_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PathfindingResponse", + '422': "List[ValidationErrorModel]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _pathfinding_post_serialize( + self, + pathfinding_request, + _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 + if pathfinding_request is not None: + _body_params = pathfinding_request + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # 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/json' + ] + ) + ) + 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='/pathfinding/', + 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 + ) + + diff --git a/openapi_client/api_client.py b/openapi_client/api_client.py new file mode 100644 index 00000000..c8b73eb2 --- /dev/null +++ b/openapi_client/api_client.py @@ -0,0 +1,758 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import datetime +from dateutil.parser import parse +from enum import Enum +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) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) + 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(map(str, 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_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + + 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) diff --git a/openapi_client/api_response.py b/openapi_client/api_response.py new file mode 100644 index 00000000..9bc7c11f --- /dev/null +++ b/openapi_client/api_response.py @@ -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 + } diff --git a/openapi_client/configuration.py b/openapi_client/configuration.py new file mode 100644 index 00000000..c963e4ba --- /dev/null +++ b/openapi_client/configuration.py @@ -0,0 +1,436 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import 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. + + """ + + _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" 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 = {} + 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: 1.0.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': "", + '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 diff --git a/openapi_client/exceptions.py b/openapi_client/exceptions.py new file mode 100644 index 00000000..8625739c --- /dev/null +++ b/openapi_client/exceptions.py @@ -0,0 +1,199 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from 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 diff --git a/openapi_client/models/__init__.py b/openapi_client/models/__init__.py new file mode 100644 index 00000000..c468542d --- /dev/null +++ b/openapi_client/models/__init__.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +# flake8: noqa +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +# import models into model package +from openapi_client.models.cost import Cost +from openapi_client.models.direction import Direction +from openapi_client.models.error_context import ErrorContext +from openapi_client.models.error_type import ErrorType +from openapi_client.models.image_prediction_response import ImagePredictionResponse +from openapi_client.models.location import Location +from openapi_client.models.message import Message +from openapi_client.models.misc_instruction import MiscInstruction +from openapi_client.models.move import Move +from openapi_client.models.path import Path +from openapi_client.models.pathfinding_point import PathfindingPoint +from openapi_client.models.pathfinding_request import PathfindingRequest +from openapi_client.models.pathfinding_request_obstacle import PathfindingRequestObstacle +from openapi_client.models.pathfinding_request_robot import PathfindingRequestRobot +from openapi_client.models.pathfinding_response import PathfindingResponse +from openapi_client.models.pathfinding_response_move_instruction import PathfindingResponseMoveInstruction +from openapi_client.models.pathfinding_response_segment import PathfindingResponseSegment +from openapi_client.models.pathfinding_response_segment_instructions_inner import PathfindingResponseSegmentInstructionsInner +from openapi_client.models.pathfinding_vector import PathfindingVector +from openapi_client.models.turn_instruction import TurnInstruction +from openapi_client.models.validation_error_model import ValidationErrorModel diff --git a/openapi_client/models/cost.py b/openapi_client/models/cost.py new file mode 100644 index 00000000..45f0f227 --- /dev/null +++ b/openapi_client/models/cost.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, Field, StrictInt, StrictStr, ValidationError, field_validator +from typing import Any, Optional +from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +COST_ANY_OF_SCHEMAS = ["int", "object"] + +class Cost(BaseModel): + """ + The cost, included only if verbose is true. + """ + + # data type: int + anyof_schema_1_validator: Optional[StrictInt] = None + # data type: object + anyof_schema_2_validator: Optional[Any] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[int, object]] = None + else: + actual_instance: Any = None + any_of_schemas: List[str] = Field(default=Literal["int", "object"]) + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Cost.model_construct() + error_messages = [] + # validate data type: int + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: object + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Cost with anyOf schemas: int, object. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # deserialize data into int + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into object + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Cost with anyOf schemas: int, object. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], int, object]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/openapi_client/models/direction.py b/openapi_client/models/direction.py new file mode 100644 index 00000000..25e03431 --- /dev/null +++ b/openapi_client/models/direction.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class Direction(str, Enum): + """ + Direction + """ + + """ + allowed enum values + """ + NORTH = 'NORTH' + EAST = 'EAST' + SOUTH = 'SOUTH' + WEST = 'WEST' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of Direction from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/openapi_client/models/error_context.py b/openapi_client/models/error_context.py new file mode 100644 index 00000000..fbe17416 --- /dev/null +++ b/openapi_client/models/error_context.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator +from typing import Any, Dict, Optional +from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +ERRORCONTEXT_ANY_OF_SCHEMAS = ["object"] + +class ErrorContext(BaseModel): + """ + an optional object which contains values required to render the error message. + """ + + # data type: object + anyof_schema_1_validator: Optional[Dict[str, Any]] = None + # data type: object + anyof_schema_2_validator: Optional[Any] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[object]] = None + else: + actual_instance: Any = None + any_of_schemas: List[str] = Field(default=Literal["object"]) + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = ErrorContext.model_construct() + error_messages = [] + # validate data type: object + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: object + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in ErrorContext with anyOf schemas: object. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # deserialize data into object + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into object + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into ErrorContext with anyOf schemas: object. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], object]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/openapi_client/models/error_type.py b/openapi_client/models/error_type.py new file mode 100644 index 00000000..dd456490 --- /dev/null +++ b/openapi_client/models/error_type.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator +from typing import Any, Optional +from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +ERRORTYPE_ANY_OF_SCHEMAS = ["object", "str"] + +class ErrorType(BaseModel): + """ + a human readable explanation of the error. + """ + + # data type: str + anyof_schema_1_validator: Optional[StrictStr] = None + # data type: object + anyof_schema_2_validator: Optional[Any] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[object, str]] = None + else: + actual_instance: Any = None + any_of_schemas: List[str] = Field(default=Literal["object", "str"]) + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = ErrorType.model_construct() + error_messages = [] + # validate data type: str + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: object + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in ErrorType with anyOf schemas: object, str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # deserialize data into str + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into object + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into ErrorType with anyOf schemas: object, str. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], object, str]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/openapi_client/models/image_prediction_response.py b/openapi_client/models/image_prediction_response.py new file mode 100644 index 00000000..4519f3bd --- /dev/null +++ b/openapi_client/models/image_prediction_response.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ImagePredictionResponse(BaseModel): + """ + ImagePredictionResponse + """ # noqa: E501 + image_id: StrictInt + obstacle_id: StrictInt + __properties: ClassVar[List[str]] = ["image_id", "obstacle_id"] + + 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 ImagePredictionResponse 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 ImagePredictionResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "image_id": obj.get("image_id"), + "obstacle_id": obj.get("obstacle_id") + }) + return _obj + + diff --git a/openapi_client/models/location.py b/openapi_client/models/location.py new file mode 100644 index 00000000..44bc9dcd --- /dev/null +++ b/openapi_client/models/location.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator +from typing import Any, Optional +from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +LOCATION_ANY_OF_SCHEMAS = ["object"] + +class Location(BaseModel): + """ + the error's location as a list. + """ + + # data type: object + anyof_schema_1_validator: Optional[Any] = None + # data type: object + anyof_schema_2_validator: Optional[Any] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[object]] = None + else: + actual_instance: Any = None + any_of_schemas: List[str] = Field(default=Literal["object"]) + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Location.model_construct() + error_messages = [] + # validate data type: object + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: object + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Location with anyOf schemas: object. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # deserialize data into object + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into object + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Location with anyOf schemas: object. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], object]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/openapi_client/models/message.py b/openapi_client/models/message.py new file mode 100644 index 00000000..c26f9d5b --- /dev/null +++ b/openapi_client/models/message.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator +from typing import Any, Optional +from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +MESSAGE_ANY_OF_SCHEMAS = ["object", "str"] + +class Message(BaseModel): + """ + a computer-readable identifier of the error type. + """ + + # data type: str + anyof_schema_1_validator: Optional[StrictStr] = None + # data type: object + anyof_schema_2_validator: Optional[Any] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[object, str]] = None + else: + actual_instance: Any = None + any_of_schemas: List[str] = Field(default=Literal["object", "str"]) + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Message.model_construct() + error_messages = [] + # validate data type: str + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: object + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Message with anyOf schemas: object, str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # deserialize data into str + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into object + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Message with anyOf schemas: object, str. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], object, str]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/openapi_client/models/misc_instruction.py b/openapi_client/models/misc_instruction.py new file mode 100644 index 00000000..1f6be545 --- /dev/null +++ b/openapi_client/models/misc_instruction.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class MiscInstruction(str, Enum): + """ + MiscInstruction + """ + + """ + allowed enum values + """ + CAPTURE_IMAGE = 'CAPTURE_IMAGE' + RESET_GYROSCOPE = 'RESET_GYROSCOPE' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of MiscInstruction from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/openapi_client/models/move.py b/openapi_client/models/move.py new file mode 100644 index 00000000..b9c73561 --- /dev/null +++ b/openapi_client/models/move.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class Move(str, Enum): + """ + Move + """ + + """ + allowed enum values + """ + FORWARD = 'FORWARD' + BACKWARD = 'BACKWARD' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of Move from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/openapi_client/models/path.py b/openapi_client/models/path.py new file mode 100644 index 00000000..07b925b9 --- /dev/null +++ b/openapi_client/models/path.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator +from typing import Any, Optional +from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +PATH_ANY_OF_SCHEMAS = ["object"] + +class Path(BaseModel): + """ + The path (unordered), included only if verbose is true. + """ + + # data type: object + anyof_schema_1_validator: Optional[Any] = None + # data type: object + anyof_schema_2_validator: Optional[Any] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[object]] = None + else: + actual_instance: Any = None + any_of_schemas: List[str] = Field(default=Literal["object"]) + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Path.model_construct() + error_messages = [] + # validate data type: object + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: object + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Path with anyOf schemas: object. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # deserialize data into object + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into object + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Path with anyOf schemas: object. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], object]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/openapi_client/models/pathfinding_point.py b/openapi_client/models/pathfinding_point.py new file mode 100644 index 00000000..120fb72d --- /dev/null +++ b/openapi_client/models/pathfinding_point.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class PathfindingPoint(BaseModel): + """ + PathfindingPoint + """ # noqa: E501 + x: Annotated[int, Field(strict=True, ge=0)] + y: Annotated[int, Field(strict=True, ge=0)] + __properties: ClassVar[List[str]] = ["x", "y"] + + 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 PathfindingPoint 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 PathfindingPoint from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "x": obj.get("x"), + "y": obj.get("y") + }) + return _obj + + diff --git a/openapi_client/models/pathfinding_request.py b/openapi_client/models/pathfinding_request.py new file mode 100644 index 00000000..5cc60a93 --- /dev/null +++ b/openapi_client/models/pathfinding_request.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from openapi_client.models.pathfinding_request_obstacle import PathfindingRequestObstacle +from openapi_client.models.pathfinding_request_robot import PathfindingRequestRobot +from typing import Optional, Set +from typing_extensions import Self + +class PathfindingRequest(BaseModel): + """ + PathfindingRequest + """ # noqa: E501 + obstacles: Annotated[List[PathfindingRequestObstacle], Field(min_length=1)] + robot: PathfindingRequestRobot = Field(description="The initial position of the robot.") + verbose: Optional[StrictBool] = Field(default=True, description="Whether to attach the path and cost alongside the movement instructions in the response.") + __properties: ClassVar[List[str]] = ["obstacles", "robot", "verbose"] + + 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 PathfindingRequest 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 each item in obstacles (list) + _items = [] + if self.obstacles: + for _item in self.obstacles: + if _item: + _items.append(_item.to_dict()) + _dict['obstacles'] = _items + # override the default output from pydantic by calling `to_dict()` of robot + if self.robot: + _dict['robot'] = self.robot.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PathfindingRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "obstacles": [PathfindingRequestObstacle.from_dict(_item) for _item in obj["obstacles"]] if obj.get("obstacles") is not None else None, + "robot": PathfindingRequestRobot.from_dict(obj["robot"]) if obj.get("robot") is not None else None, + "verbose": obj.get("verbose") if obj.get("verbose") is not None else True + }) + return _obj + + diff --git a/openapi_client/models/pathfinding_request_obstacle.py b/openapi_client/models/pathfinding_request_obstacle.py new file mode 100644 index 00000000..ea167fa6 --- /dev/null +++ b/openapi_client/models/pathfinding_request_obstacle.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from openapi_client.models.direction import Direction +from openapi_client.models.pathfinding_point import PathfindingPoint +from typing import Optional, Set +from typing_extensions import Self + +class PathfindingRequestObstacle(BaseModel): + """ + PathfindingRequestObstacle + """ # noqa: E501 + direction: Direction = Field(description="The direction of the image.") + image_id: Annotated[int, Field(strict=True, ge=1)] = Field(description="The image ID.") + north_east: PathfindingPoint = Field(description="The north-east corner of the obstacle.") + south_west: PathfindingPoint = Field(description="The south-west corner of the obstacle.") + __properties: ClassVar[List[str]] = ["direction", "image_id", "north_east", "south_west"] + + 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 PathfindingRequestObstacle 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 north_east + if self.north_east: + _dict['north_east'] = self.north_east.to_dict() + # override the default output from pydantic by calling `to_dict()` of south_west + if self.south_west: + _dict['south_west'] = self.south_west.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PathfindingRequestObstacle from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "direction": obj.get("direction"), + "image_id": obj.get("image_id"), + "north_east": PathfindingPoint.from_dict(obj["north_east"]) if obj.get("north_east") is not None else None, + "south_west": PathfindingPoint.from_dict(obj["south_west"]) if obj.get("south_west") is not None else None + }) + return _obj + + diff --git a/openapi_client/models/pathfinding_request_robot.py b/openapi_client/models/pathfinding_request_robot.py new file mode 100644 index 00000000..066d0aba --- /dev/null +++ b/openapi_client/models/pathfinding_request_robot.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, Field +from typing import Any, ClassVar, Dict, List +from openapi_client.models.direction import Direction +from openapi_client.models.pathfinding_point import PathfindingPoint +from typing import Optional, Set +from typing_extensions import Self + +class PathfindingRequestRobot(BaseModel): + """ + PathfindingRequestRobot + """ # noqa: E501 + direction: Direction = Field(description="The direction of the robot.") + north_east: PathfindingPoint = Field(description="The north-east corner of the robot.") + south_west: PathfindingPoint = Field(description="The south-west corner of the robot.") + __properties: ClassVar[List[str]] = ["direction", "north_east", "south_west"] + + 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 PathfindingRequestRobot 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 north_east + if self.north_east: + _dict['north_east'] = self.north_east.to_dict() + # override the default output from pydantic by calling `to_dict()` of south_west + if self.south_west: + _dict['south_west'] = self.south_west.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PathfindingRequestRobot from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "direction": obj.get("direction"), + "north_east": PathfindingPoint.from_dict(obj["north_east"]) if obj.get("north_east") is not None else None, + "south_west": PathfindingPoint.from_dict(obj["south_west"]) if obj.get("south_west") is not None else None + }) + return _obj + + diff --git a/openapi_client/models/pathfinding_response.py b/openapi_client/models/pathfinding_response.py new file mode 100644 index 00000000..ebee6234 --- /dev/null +++ b/openapi_client/models/pathfinding_response.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, Field +from typing import Any, ClassVar, Dict, List +from openapi_client.models.pathfinding_response_segment import PathfindingResponseSegment +from typing import Optional, Set +from typing_extensions import Self + +class PathfindingResponse(BaseModel): + """ + PathfindingResponse + """ # noqa: E501 + segments: List[PathfindingResponseSegment] = Field(description="The data for moving the robot from the start/objective to another objective.") + __properties: ClassVar[List[str]] = ["segments"] + + 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 PathfindingResponse 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 each item in segments (list) + _items = [] + if self.segments: + for _item in self.segments: + if _item: + _items.append(_item.to_dict()) + _dict['segments'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PathfindingResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "segments": [PathfindingResponseSegment.from_dict(_item) for _item in obj["segments"]] if obj.get("segments") is not None else None + }) + return _obj + + diff --git a/openapi_client/models/pathfinding_response_move_instruction.py b/openapi_client/models/pathfinding_response_move_instruction.py new file mode 100644 index 00000000..ca4db9ae --- /dev/null +++ b/openapi_client/models/pathfinding_response_move_instruction.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from openapi_client.models.move import Move +from typing import Optional, Set +from typing_extensions import Self + +class PathfindingResponseMoveInstruction(BaseModel): + """ + PathfindingResponseMoveInstruction + """ # noqa: E501 + amount: Annotated[int, Field(strict=True, ge=1)] = Field(description="The amount to move the robot in centimetres.") + move: Move + __properties: ClassVar[List[str]] = ["amount", "move"] + + 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 PathfindingResponseMoveInstruction 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 PathfindingResponseMoveInstruction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "move": obj.get("move") + }) + return _obj + + diff --git a/openapi_client/models/pathfinding_response_segment.py b/openapi_client/models/pathfinding_response_segment.py new file mode 100644 index 00000000..498d6801 --- /dev/null +++ b/openapi_client/models/pathfinding_response_segment.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, StrictInt +from typing import Any, ClassVar, Dict, List +from openapi_client.models.cost import Cost +from openapi_client.models.path import Path +from openapi_client.models.pathfinding_response_segment_instructions_inner import PathfindingResponseSegmentInstructionsInner +from typing import Optional, Set +from typing_extensions import Self + +class PathfindingResponseSegment(BaseModel): + """ + PathfindingResponseSegment + """ # noqa: E501 + cost: Cost + image_id: StrictInt + instructions: List[PathfindingResponseSegmentInstructionsInner] + path: Path + __properties: ClassVar[List[str]] = ["cost", "image_id", "instructions", "path"] + + 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 PathfindingResponseSegment 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 cost + if self.cost: + _dict['cost'] = self.cost.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in instructions (list) + _items = [] + if self.instructions: + for _item in self.instructions: + if _item: + _items.append(_item.to_dict()) + _dict['instructions'] = _items + # override the default output from pydantic by calling `to_dict()` of path + if self.path: + _dict['path'] = self.path.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PathfindingResponseSegment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "cost": Cost.from_dict(obj["cost"]) if obj.get("cost") is not None else None, + "image_id": obj.get("image_id"), + "instructions": [PathfindingResponseSegmentInstructionsInner.from_dict(_item) for _item in obj["instructions"]] if obj.get("instructions") is not None else None, + "path": Path.from_dict(obj["path"]) if obj.get("path") is not None else None + }) + return _obj + + diff --git a/openapi_client/models/pathfinding_response_segment_instructions_inner.py b/openapi_client/models/pathfinding_response_segment_instructions_inner.py new file mode 100644 index 00000000..2129deec --- /dev/null +++ b/openapi_client/models/pathfinding_response_segment_instructions_inner.py @@ -0,0 +1,149 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from openapi_client.models.misc_instruction import MiscInstruction +from openapi_client.models.pathfinding_response_move_instruction import PathfindingResponseMoveInstruction +from openapi_client.models.turn_instruction import TurnInstruction +from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +PATHFINDINGRESPONSESEGMENTINSTRUCTIONSINNER_ANY_OF_SCHEMAS = ["MiscInstruction", "PathfindingResponseMoveInstruction", "TurnInstruction"] + +class PathfindingResponseSegmentInstructionsInner(BaseModel): + """ + PathfindingResponseSegmentInstructionsInner + """ + + # data type: MiscInstruction + anyof_schema_1_validator: Optional[MiscInstruction] = None + # data type: TurnInstruction + anyof_schema_2_validator: Optional[TurnInstruction] = None + # data type: PathfindingResponseMoveInstruction + anyof_schema_3_validator: Optional[PathfindingResponseMoveInstruction] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[MiscInstruction, PathfindingResponseMoveInstruction, TurnInstruction]] = None + else: + actual_instance: Any = None + any_of_schemas: List[str] = Field(default=Literal["MiscInstruction", "PathfindingResponseMoveInstruction", "TurnInstruction"]) + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = PathfindingResponseSegmentInstructionsInner.model_construct() + error_messages = [] + # validate data type: MiscInstruction + if not isinstance(v, MiscInstruction): + error_messages.append(f"Error! Input type `{type(v)}` is not `MiscInstruction`") + else: + return v + + # validate data type: TurnInstruction + if not isinstance(v, TurnInstruction): + error_messages.append(f"Error! Input type `{type(v)}` is not `TurnInstruction`") + else: + return v + + # validate data type: PathfindingResponseMoveInstruction + if not isinstance(v, PathfindingResponseMoveInstruction): + error_messages.append(f"Error! Input type `{type(v)}` is not `PathfindingResponseMoveInstruction`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in PathfindingResponseSegmentInstructionsInner with anyOf schemas: MiscInstruction, PathfindingResponseMoveInstruction, TurnInstruction. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[MiscInstruction] = None + try: + instance.actual_instance = MiscInstruction.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[TurnInstruction] = None + try: + instance.actual_instance = TurnInstruction.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_3_validator: Optional[PathfindingResponseMoveInstruction] = None + try: + instance.actual_instance = PathfindingResponseMoveInstruction.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into PathfindingResponseSegmentInstructionsInner with anyOf schemas: MiscInstruction, PathfindingResponseMoveInstruction, TurnInstruction. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], MiscInstruction, PathfindingResponseMoveInstruction, TurnInstruction]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/openapi_client/models/pathfinding_vector.py b/openapi_client/models/pathfinding_vector.py new file mode 100644 index 00000000..4e707e26 --- /dev/null +++ b/openapi_client/models/pathfinding_vector.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from openapi_client.models.direction import Direction +from typing import Optional, Set +from typing_extensions import Self + +class PathfindingVector(BaseModel): + """ + PathfindingVector + """ # noqa: E501 + direction: Direction = Field(description="The direction") + x: Annotated[int, Field(strict=True, ge=0)] + y: Annotated[int, Field(strict=True, ge=0)] + __properties: ClassVar[List[str]] = ["direction", "x", "y"] + + 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 PathfindingVector 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 PathfindingVector from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "direction": obj.get("direction"), + "x": obj.get("x"), + "y": obj.get("y") + }) + return _obj + + diff --git a/openapi_client/models/turn_instruction.py b/openapi_client/models/turn_instruction.py new file mode 100644 index 00000000..accfca0c --- /dev/null +++ b/openapi_client/models/turn_instruction.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class TurnInstruction(str, Enum): + """ + TurnInstruction + """ + + """ + allowed enum values + """ + FORWARD_LEFT = 'FORWARD_LEFT' + FORWARD_RIGHT = 'FORWARD_RIGHT' + BACKWARD_LEFT = 'BACKWARD_LEFT' + BACKWARD_RIGHT = 'BACKWARD_RIGHT' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TurnInstruction from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/openapi_client/models/validation_error_model.py b/openapi_client/models/validation_error_model.py new file mode 100644 index 00000000..262a0249 --- /dev/null +++ b/openapi_client/models/validation_error_model.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel +from typing import Any, ClassVar, Dict, List, Optional +from openapi_client.models.error_context import ErrorContext +from openapi_client.models.error_type import ErrorType +from openapi_client.models.location import Location +from openapi_client.models.message import Message +from typing import Optional, Set +from typing_extensions import Self + +class ValidationErrorModel(BaseModel): + """ + ValidationErrorModel + """ # noqa: E501 + ctx: Optional[ErrorContext] = None + loc: Optional[Location] = None + msg: Optional[Message] = None + type_: Optional[ErrorType] = None + __properties: ClassVar[List[str]] = ["ctx", "loc", "msg", "type_"] + + 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 ValidationErrorModel 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 ctx + if self.ctx: + _dict['ctx'] = self.ctx.to_dict() + # override the default output from pydantic by calling `to_dict()` of loc + if self.loc: + _dict['loc'] = self.loc.to_dict() + # override the default output from pydantic by calling `to_dict()` of msg + if self.msg: + _dict['msg'] = self.msg.to_dict() + # override the default output from pydantic by calling `to_dict()` of type_ + if self.type_: + _dict['type_'] = self.type_.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationErrorModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ctx": ErrorContext.from_dict(obj["ctx"]) if obj.get("ctx") is not None else None, + "loc": Location.from_dict(obj["loc"]) if obj.get("loc") is not None else None, + "msg": Message.from_dict(obj["msg"]) if obj.get("msg") is not None else None, + "type_": ErrorType.from_dict(obj["type_"]) if obj.get("type_") is not None else None + }) + return _obj + + diff --git a/openapi_client/py.typed b/openapi_client/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/openapi_client/rest.py b/openapi_client/rest.py new file mode 100644 index 00000000..693622e9 --- /dev/null +++ b/openapi_client/rest.py @@ -0,0 +1,255 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import 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) diff --git a/openapitools.json b/openapitools.json new file mode 100644 index 00000000..9841a49b --- /dev/null +++ b/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.3.0" + } +} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..9747f91b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,71 @@ +[tool.poetry] +name = "openapi_client" +version = "1.0.0" +description = "MDP API" +authors = ["OpenAPI Generator Community "] +license = "NoLicense" +readme = "README.md" +repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID" +keywords = ["OpenAPI", "OpenAPI-Generator", "MDP 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 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..cc85509e --- /dev/null +++ b/requirements.txt @@ -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 diff --git a/service/.openapi-generator/FILES b/service/.openapi-generator/FILES deleted file mode 100644 index ba9867e4..00000000 --- a/service/.openapi-generator/FILES +++ /dev/null @@ -1,32 +0,0 @@ -.github/workflows/python.yml -.gitignore -.gitlab-ci.yml -.openapi-generator-ignore -.travis.yml -README.md -docs/DefaultApi.md -docs/Obstacle.md -docs/ResponseBody.md -git_push.sh -openapi_client/__init__.py -openapi_client/api/__init__.py -openapi_client/api/default_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/obstacle.py -openapi_client/models/response_body.py -openapi_client/py.typed -openapi_client/rest.py -pyproject.toml -requirements.txt -setup.cfg -setup.py -test-requirements.txt -test/__init__.py -test/test_default_api.py -test/test_obstacle.py -test/test_response_body.py -tox.ini diff --git a/service/.openapi-generator/VERSION b/service/.openapi-generator/VERSION deleted file mode 100644 index 4b49d9bb..00000000 --- a/service/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.2.0 \ No newline at end of file diff --git a/service/api.json b/service/api.json index 69911dcc..75fbfab4 100644 --- a/service/api.json +++ b/service/api.json @@ -1 +1 @@ -{"definitions":{"Obstacle":{"properties":{"direction":{"enum":["NORTH","EAST","SOUTH","WEST"],"type":"string"},"north_east":{"example":[0,0],"items":{"type":"integer"},"type":"array"},"south_west":{"example":[0,0],"items":{"type":"integer"},"type":"array"}},"required":["direction","south_west","north_east"]},"ResponseBody":{"properties":{"distance":{"format":"float","type":"number"},"instructions":{"items":{"oneOf":[{"properties":{"instruction":{"enum":["RESET_GYROSCOPE","STOP","CAPTURE_IMAGE"],"type":"string"}},"required":["instruction"],"type":"object"},{"properties":{"amount":{"type":"integer"},"move":{"enum":["FORWARD","FORWARD_LEFT","FORWARD_RIGHT","BACKWARD","BACKWARD_LEFT","BACKWARD_RIGHT"],"type":"string"}},"required":["move","amount"],"type":"object"}]},"type":"array"}}}},"info":{"description":"powered by Flasgger","termsOfService":"/tos","title":"A swagger API","version":"0.0.1"},"paths":{"/pathfinding":{"post":{"parameters":[{"in":"body","name":"body","required":"true","schema":{"$ref":"#/definitions/Obstacle"}}],"responses":{"200":{"description":"Successful operation","schema":{"$ref":"#/definitions/ResponseBody"}},"400":{"description":"Invalid input"}}}}},"swagger":"2.0"} \ No newline at end of file +{"components":{"schemas":{"Direction":{"enum":["NORTH","EAST","SOUTH","WEST"],"title":"Direction","type":"string"},"ImagePredictionRequest":{"properties":{"file":{"format":"binary","title":"File","type":"string"}},"required":["file"],"title":"ImagePredictionRequest","type":"object"},"ImagePredictionResponse":{"properties":{"image_id":{"title":"Image Id","type":"integer"},"obstacle_id":{"title":"Obstacle Id","type":"integer"}},"required":["obstacle_id","image_id"],"title":"ImagePredictionResponse","type":"object"},"MiscInstruction":{"enum":["CAPTURE_IMAGE","RESET_GYROSCOPE"],"title":"MiscInstruction","type":"string"},"Move":{"enum":["FORWARD","BACKWARD"],"title":"Move","type":"string"},"PathfindingPoint":{"properties":{"x":{"minimum":0.0,"title":"X","type":"integer"},"y":{"minimum":0.0,"title":"Y","type":"integer"}},"required":["x","y"],"title":"PathfindingPoint","type":"object"},"PathfindingRequest":{"properties":{"obstacles":{"items":{"$ref":"#/components/schemas/PathfindingRequestObstacle"},"minItems":1,"title":"Obstacles","type":"array"},"robot":{"allOf":[{"$ref":"#/components/schemas/PathfindingRequestRobot"}],"description":"The initial position of the robot."},"verbose":{"default":true,"description":"Whether to attach the path and cost alongside the movement instructions in the response.","title":"Verbose","type":"boolean"}},"required":["robot","obstacles"],"title":"PathfindingRequest","type":"object"},"PathfindingRequestObstacle":{"properties":{"direction":{"allOf":[{"$ref":"#/components/schemas/Direction"}],"description":"The direction of the image."},"image_id":{"description":"The image ID.","minimum":1.0,"title":"Image Id","type":"integer"},"north_east":{"allOf":[{"$ref":"#/components/schemas/PathfindingPoint"}],"description":"The north-east corner of the obstacle."},"south_west":{"allOf":[{"$ref":"#/components/schemas/PathfindingPoint"}],"description":"The south-west corner of the obstacle."}},"required":["image_id","direction","south_west","north_east"],"title":"PathfindingRequestObstacle","type":"object"},"PathfindingRequestRobot":{"properties":{"direction":{"allOf":[{"$ref":"#/components/schemas/Direction"}],"description":"The direction of the robot."},"north_east":{"allOf":[{"$ref":"#/components/schemas/PathfindingPoint"}],"description":"The north-east corner of the robot."},"south_west":{"allOf":[{"$ref":"#/components/schemas/PathfindingPoint"}],"description":"The south-west corner of the robot."}},"required":["direction","south_west","north_east"],"title":"PathfindingRequestRobot","type":"object"},"PathfindingResponse":{"properties":{"segments":{"description":"The data for moving the robot from the start/objective to another objective.","items":{"$ref":"#/components/schemas/PathfindingResponseSegment"},"title":"Segments","type":"array"}},"required":["segments"],"title":"PathfindingResponse","type":"object"},"PathfindingResponseMoveInstruction":{"properties":{"amount":{"description":"The amount to move the robot in centimetres.","minimum":1.0,"title":"Amount","type":"integer"},"move":{"$ref":"#/components/schemas/Move"}},"required":["move","amount"],"title":"PathfindingResponseMoveInstruction","type":"object"},"PathfindingResponseSegment":{"properties":{"cost":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"The cost, included only if verbose is true.","title":"Cost"},"image_id":{"title":"Image Id","type":"integer"},"instructions":{"items":{"anyOf":[{"$ref":"#/components/schemas/MiscInstruction"},{"$ref":"#/components/schemas/TurnInstruction"},{"$ref":"#/components/schemas/PathfindingResponseMoveInstruction"}]},"title":"Instructions","type":"array"},"path":{"anyOf":[{"items":{"$ref":"#/components/schemas/PathfindingVector"},"type":"array"},{"type":"null"}],"description":"The path (unordered), included only if verbose is true.","title":"Path"}},"required":["image_id","cost","instructions","path"],"title":"PathfindingResponseSegment","type":"object"},"PathfindingVector":{"properties":{"direction":{"allOf":[{"$ref":"#/components/schemas/Direction"}],"description":"The direction"},"x":{"minimum":0.0,"title":"X","type":"integer"},"y":{"minimum":0.0,"title":"Y","type":"integer"}},"required":["direction","x","y"],"title":"PathfindingVector","type":"object"},"TurnInstruction":{"enum":["FORWARD_LEFT","FORWARD_RIGHT","BACKWARD_LEFT","BACKWARD_RIGHT"],"title":"TurnInstruction","type":"string"},"ValidationErrorModel":{"properties":{"ctx":{"anyOf":[{"type":"object"},{"type":"null"}],"description":"an optional object which contains values required to render the error message.","title":"Error context"},"loc":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"description":"the error's location as a list. ","title":"Location"},"msg":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"a computer-readable identifier of the error type.","title":"Message"},"type_":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"a human readable explanation of the error.","title":"Error Type"}},"title":"ValidationErrorModel","type":"object"}}},"info":{"title":"MDP API","version":"1.0.0"},"openapi":"3.1.0","paths":{"/image/prediction/task-1":{"post":{"operationId":"_image_prediction_task_1_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ImagePredictionRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImagePredictionResponse"}}},"description":"OK"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"}},"tags":["Image Recognition"]}},"/image/prediction/task-2":{"post":{"operationId":"_image_prediction_task_2_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ImagePredictionRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImagePredictionResponse"}}},"description":"OK"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"}},"tags":["Image Recognition"]}},"/image/stitch":{"post":{"operationId":"_image_stitch_post","responses":{},"tags":["Image Recognition"]}},"/pathfinding/":{"post":{"operationId":"_pathfinding__post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PathfindingRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PathfindingResponse"}}},"description":"OK"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"}},"tags":["Pathfinding"]}}},"tags":[{"name":"Pathfinding"},{"name":"Image Recognition"}]} \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..11433ee8 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..2ffc6526 --- /dev/null +++ b/setup.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from 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="MDP API", + author="OpenAPI Generator community", + author_email="team@openapitools.org", + url="", + keywords=["OpenAPI", "OpenAPI-Generator", "MDP API"], + install_requires=REQUIRES, + packages=find_packages(exclude=["test", "tests"]), + include_package_data=True, + long_description_content_type='text/markdown', + long_description="""\ + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + """, # noqa: E501 + package_data={"openapi_client": ["py.typed"]}, +) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..8e6d8cb1 --- /dev/null +++ b/test-requirements.txt @@ -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 diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/test_cost.py b/test/test_cost.py new file mode 100644 index 00000000..b65bbc61 --- /dev/null +++ b/test/test_cost.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.cost import Cost + +class TestCost(unittest.TestCase): + """Cost unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Cost: + """Test Cost + 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 `Cost` + """ + model = Cost() + if include_optional: + return Cost( + ) + else: + return Cost( + ) + """ + + def testCost(self): + """Test Cost""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_direction.py b/test/test_direction.py new file mode 100644 index 00000000..3132d224 --- /dev/null +++ b/test/test_direction.py @@ -0,0 +1,33 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.direction import Direction + +class TestDirection(unittest.TestCase): + """Direction unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testDirection(self): + """Test Direction""" + # inst = Direction() + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_error_context.py b/test/test_error_context.py new file mode 100644 index 00000000..b41654df --- /dev/null +++ b/test/test_error_context.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.error_context import ErrorContext + +class TestErrorContext(unittest.TestCase): + """ErrorContext unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ErrorContext: + """Test ErrorContext + 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 `ErrorContext` + """ + model = ErrorContext() + if include_optional: + return ErrorContext( + ) + else: + return ErrorContext( + ) + """ + + def testErrorContext(self): + """Test ErrorContext""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_error_type.py b/test/test_error_type.py new file mode 100644 index 00000000..58cf7852 --- /dev/null +++ b/test/test_error_type.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.error_type import ErrorType + +class TestErrorType(unittest.TestCase): + """ErrorType unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ErrorType: + """Test ErrorType + 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 `ErrorType` + """ + model = ErrorType() + if include_optional: + return ErrorType( + ) + else: + return ErrorType( + ) + """ + + def testErrorType(self): + """Test ErrorType""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_image_prediction_response.py b/test/test_image_prediction_response.py new file mode 100644 index 00000000..6d95d40e --- /dev/null +++ b/test/test_image_prediction_response.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.image_prediction_response import ImagePredictionResponse + +class TestImagePredictionResponse(unittest.TestCase): + """ImagePredictionResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ImagePredictionResponse: + """Test ImagePredictionResponse + 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 `ImagePredictionResponse` + """ + model = ImagePredictionResponse() + if include_optional: + return ImagePredictionResponse( + image_id = 56, + obstacle_id = 56 + ) + else: + return ImagePredictionResponse( + image_id = 56, + obstacle_id = 56, + ) + """ + + def testImagePredictionResponse(self): + """Test ImagePredictionResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_image_recognition_api.py b/test/test_image_recognition_api.py new file mode 100644 index 00000000..b646631f --- /dev/null +++ b/test/test_image_recognition_api.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.api.image_recognition_api import ImageRecognitionApi + + +class TestImageRecognitionApi(unittest.TestCase): + """ImageRecognitionApi unit test stubs""" + + def setUp(self) -> None: + self.api = ImageRecognitionApi() + + def tearDown(self) -> None: + pass + + def test_image_prediction_task1_post(self) -> None: + """Test case for image_prediction_task1_post + + """ + pass + + def test_image_prediction_task2_post(self) -> None: + """Test case for image_prediction_task2_post + + """ + pass + + def test_image_stitch_post(self) -> None: + """Test case for image_stitch_post + + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_location.py b/test/test_location.py new file mode 100644 index 00000000..92bc97d7 --- /dev/null +++ b/test/test_location.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.location import Location + +class TestLocation(unittest.TestCase): + """Location unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Location: + """Test Location + 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 `Location` + """ + model = Location() + if include_optional: + return Location( + ) + else: + return Location( + ) + """ + + def testLocation(self): + """Test Location""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_message.py b/test/test_message.py new file mode 100644 index 00000000..35789aa5 --- /dev/null +++ b/test/test_message.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.message import Message + +class TestMessage(unittest.TestCase): + """Message unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Message: + """Test Message + 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 `Message` + """ + model = Message() + if include_optional: + return Message( + ) + else: + return Message( + ) + """ + + def testMessage(self): + """Test Message""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_misc_instruction.py b/test/test_misc_instruction.py new file mode 100644 index 00000000..7020d109 --- /dev/null +++ b/test/test_misc_instruction.py @@ -0,0 +1,33 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.misc_instruction import MiscInstruction + +class TestMiscInstruction(unittest.TestCase): + """MiscInstruction unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testMiscInstruction(self): + """Test MiscInstruction""" + # inst = MiscInstruction() + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_move.py b/test/test_move.py new file mode 100644 index 00000000..3fcb3170 --- /dev/null +++ b/test/test_move.py @@ -0,0 +1,33 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.move import Move + +class TestMove(unittest.TestCase): + """Move unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testMove(self): + """Test Move""" + # inst = Move() + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_path.py b/test/test_path.py new file mode 100644 index 00000000..d2150569 --- /dev/null +++ b/test/test_path.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.path import Path + +class TestPath(unittest.TestCase): + """Path unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Path: + """Test Path + 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 `Path` + """ + model = Path() + if include_optional: + return Path( + ) + else: + return Path( + ) + """ + + def testPath(self): + """Test Path""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_pathfinding_api.py b/test/test_pathfinding_api.py new file mode 100644 index 00000000..cfce012e --- /dev/null +++ b/test/test_pathfinding_api.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.api.pathfinding_api import PathfindingApi + + +class TestPathfindingApi(unittest.TestCase): + """PathfindingApi unit test stubs""" + + def setUp(self) -> None: + self.api = PathfindingApi() + + def tearDown(self) -> None: + pass + + def test_pathfinding_post(self) -> None: + """Test case for pathfinding_post + + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_pathfinding_point.py b/test/test_pathfinding_point.py new file mode 100644 index 00000000..199527d8 --- /dev/null +++ b/test/test_pathfinding_point.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.pathfinding_point import PathfindingPoint + +class TestPathfindingPoint(unittest.TestCase): + """PathfindingPoint unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PathfindingPoint: + """Test PathfindingPoint + 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 `PathfindingPoint` + """ + model = PathfindingPoint() + if include_optional: + return PathfindingPoint( + x = 0.0, + y = 0.0 + ) + else: + return PathfindingPoint( + x = 0.0, + y = 0.0, + ) + """ + + def testPathfindingPoint(self): + """Test PathfindingPoint""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_pathfinding_request.py b/test/test_pathfinding_request.py new file mode 100644 index 00000000..8c13b025 --- /dev/null +++ b/test/test_pathfinding_request.py @@ -0,0 +1,73 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.pathfinding_request import PathfindingRequest + +class TestPathfindingRequest(unittest.TestCase): + """PathfindingRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PathfindingRequest: + """Test PathfindingRequest + 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 `PathfindingRequest` + """ + model = PathfindingRequest() + if include_optional: + return PathfindingRequest( + obstacles = [ + openapi_client.models.pathfinding_request_obstacle.PathfindingRequestObstacle( + direction = null, + image_id = 1.0, + north_east = null, + south_west = null, ) + ], + robot = openapi_client.models.pathfinding_request_robot.PathfindingRequestRobot( + direction = null, + north_east = null, + south_west = null, ), + verbose = True + ) + else: + return PathfindingRequest( + obstacles = [ + openapi_client.models.pathfinding_request_obstacle.PathfindingRequestObstacle( + direction = null, + image_id = 1.0, + north_east = null, + south_west = null, ) + ], + robot = openapi_client.models.pathfinding_request_robot.PathfindingRequestRobot( + direction = null, + north_east = null, + south_west = null, ), + ) + """ + + def testPathfindingRequest(self): + """Test PathfindingRequest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_pathfinding_request_obstacle.py b/test/test_pathfinding_request_obstacle.py new file mode 100644 index 00000000..3b309144 --- /dev/null +++ b/test/test_pathfinding_request_obstacle.py @@ -0,0 +1,66 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.pathfinding_request_obstacle import PathfindingRequestObstacle + +class TestPathfindingRequestObstacle(unittest.TestCase): + """PathfindingRequestObstacle unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PathfindingRequestObstacle: + """Test PathfindingRequestObstacle + 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 `PathfindingRequestObstacle` + """ + model = PathfindingRequestObstacle() + if include_optional: + return PathfindingRequestObstacle( + direction = 'NORTH', + image_id = 1.0, + north_east = openapi_client.models.pathfinding_point.PathfindingPoint( + x = 0.0, + y = 0.0, ), + south_west = openapi_client.models.pathfinding_point.PathfindingPoint( + x = 0.0, + y = 0.0, ) + ) + else: + return PathfindingRequestObstacle( + direction = 'NORTH', + image_id = 1.0, + north_east = openapi_client.models.pathfinding_point.PathfindingPoint( + x = 0.0, + y = 0.0, ), + south_west = openapi_client.models.pathfinding_point.PathfindingPoint( + x = 0.0, + y = 0.0, ), + ) + """ + + def testPathfindingRequestObstacle(self): + """Test PathfindingRequestObstacle""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_pathfinding_request_robot.py b/test/test_pathfinding_request_robot.py new file mode 100644 index 00000000..6800ad31 --- /dev/null +++ b/test/test_pathfinding_request_robot.py @@ -0,0 +1,64 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.pathfinding_request_robot import PathfindingRequestRobot + +class TestPathfindingRequestRobot(unittest.TestCase): + """PathfindingRequestRobot unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PathfindingRequestRobot: + """Test PathfindingRequestRobot + 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 `PathfindingRequestRobot` + """ + model = PathfindingRequestRobot() + if include_optional: + return PathfindingRequestRobot( + direction = 'NORTH', + north_east = openapi_client.models.pathfinding_point.PathfindingPoint( + x = 0.0, + y = 0.0, ), + south_west = openapi_client.models.pathfinding_point.PathfindingPoint( + x = 0.0, + y = 0.0, ) + ) + else: + return PathfindingRequestRobot( + direction = 'NORTH', + north_east = openapi_client.models.pathfinding_point.PathfindingPoint( + x = 0.0, + y = 0.0, ), + south_west = openapi_client.models.pathfinding_point.PathfindingPoint( + x = 0.0, + y = 0.0, ), + ) + """ + + def testPathfindingRequestRobot(self): + """Test PathfindingRequestRobot""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_pathfinding_response.py b/test/test_pathfinding_response.py new file mode 100644 index 00000000..1b5b43c9 --- /dev/null +++ b/test/test_pathfinding_response.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.pathfinding_response import PathfindingResponse + +class TestPathfindingResponse(unittest.TestCase): + """PathfindingResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PathfindingResponse: + """Test PathfindingResponse + 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 `PathfindingResponse` + """ + model = PathfindingResponse() + if include_optional: + return PathfindingResponse( + segments = [ + openapi_client.models.pathfinding_response_segment.PathfindingResponseSegment( + cost = null, + image_id = 56, + instructions = [ + null + ], + path = null, ) + ] + ) + else: + return PathfindingResponse( + segments = [ + openapi_client.models.pathfinding_response_segment.PathfindingResponseSegment( + cost = null, + image_id = 56, + instructions = [ + null + ], + path = null, ) + ], + ) + """ + + def testPathfindingResponse(self): + """Test PathfindingResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_pathfinding_response_move_instruction.py b/test/test_pathfinding_response_move_instruction.py new file mode 100644 index 00000000..32e84923 --- /dev/null +++ b/test/test_pathfinding_response_move_instruction.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.pathfinding_response_move_instruction import PathfindingResponseMoveInstruction + +class TestPathfindingResponseMoveInstruction(unittest.TestCase): + """PathfindingResponseMoveInstruction unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PathfindingResponseMoveInstruction: + """Test PathfindingResponseMoveInstruction + 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 `PathfindingResponseMoveInstruction` + """ + model = PathfindingResponseMoveInstruction() + if include_optional: + return PathfindingResponseMoveInstruction( + amount = 1.0, + move = 'FORWARD' + ) + else: + return PathfindingResponseMoveInstruction( + amount = 1.0, + move = 'FORWARD', + ) + """ + + def testPathfindingResponseMoveInstruction(self): + """Test PathfindingResponseMoveInstruction""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_pathfinding_response_segment.py b/test/test_pathfinding_response_segment.py new file mode 100644 index 00000000..ceb643cd --- /dev/null +++ b/test/test_pathfinding_response_segment.py @@ -0,0 +1,62 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.pathfinding_response_segment import PathfindingResponseSegment + +class TestPathfindingResponseSegment(unittest.TestCase): + """PathfindingResponseSegment unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PathfindingResponseSegment: + """Test PathfindingResponseSegment + 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 `PathfindingResponseSegment` + """ + model = PathfindingResponseSegment() + if include_optional: + return PathfindingResponseSegment( + cost = None, + image_id = 56, + instructions = [ + null + ], + path = None + ) + else: + return PathfindingResponseSegment( + cost = None, + image_id = 56, + instructions = [ + null + ], + path = None, + ) + """ + + def testPathfindingResponseSegment(self): + """Test PathfindingResponseSegment""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_pathfinding_response_segment_instructions_inner.py b/test/test_pathfinding_response_segment_instructions_inner.py new file mode 100644 index 00000000..da42887f --- /dev/null +++ b/test/test_pathfinding_response_segment_instructions_inner.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.pathfinding_response_segment_instructions_inner import PathfindingResponseSegmentInstructionsInner + +class TestPathfindingResponseSegmentInstructionsInner(unittest.TestCase): + """PathfindingResponseSegmentInstructionsInner unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PathfindingResponseSegmentInstructionsInner: + """Test PathfindingResponseSegmentInstructionsInner + 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 `PathfindingResponseSegmentInstructionsInner` + """ + model = PathfindingResponseSegmentInstructionsInner() + if include_optional: + return PathfindingResponseSegmentInstructionsInner( + amount = None, + move = 'FORWARD' + ) + else: + return PathfindingResponseSegmentInstructionsInner( + amount = None, + move = 'FORWARD', + ) + """ + + def testPathfindingResponseSegmentInstructionsInner(self): + """Test PathfindingResponseSegmentInstructionsInner""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_pathfinding_vector.py b/test/test_pathfinding_vector.py new file mode 100644 index 00000000..e0997f21 --- /dev/null +++ b/test/test_pathfinding_vector.py @@ -0,0 +1,56 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.pathfinding_vector import PathfindingVector + +class TestPathfindingVector(unittest.TestCase): + """PathfindingVector unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PathfindingVector: + """Test PathfindingVector + 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 `PathfindingVector` + """ + model = PathfindingVector() + if include_optional: + return PathfindingVector( + direction = 'NORTH', + x = 0.0, + y = 0.0 + ) + else: + return PathfindingVector( + direction = 'NORTH', + x = 0.0, + y = 0.0, + ) + """ + + def testPathfindingVector(self): + """Test PathfindingVector""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_turn_instruction.py b/test/test_turn_instruction.py new file mode 100644 index 00000000..74523102 --- /dev/null +++ b/test/test_turn_instruction.py @@ -0,0 +1,33 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.turn_instruction import TurnInstruction + +class TestTurnInstruction(unittest.TestCase): + """TurnInstruction unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testTurnInstruction(self): + """Test TurnInstruction""" + # inst = TurnInstruction() + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_validation_error_model.py b/test/test_validation_error_model.py new file mode 100644 index 00000000..22e0a734 --- /dev/null +++ b/test/test_validation_error_model.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + MDP API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.validation_error_model import ValidationErrorModel + +class TestValidationErrorModel(unittest.TestCase): + """ValidationErrorModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ValidationErrorModel: + """Test ValidationErrorModel + 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 `ValidationErrorModel` + """ + model = ValidationErrorModel() + if include_optional: + return ValidationErrorModel( + ctx = None, + loc = None, + msg = None, + type_ = None + ) + else: + return ValidationErrorModel( + ) + """ + + def testValidationErrorModel(self): + """Test ValidationErrorModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..1a9028b7 --- /dev/null +++ b/tox.ini @@ -0,0 +1,9 @@ +[tox] +envlist = py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + pytest --cov=openapi_client