diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e0e977..2333442 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.18.0] - 2022-03-22 +### Changed + +- Adds optional `state` field to `order` creation + ## [1.17.0] - 2022-01-11 ### Changed diff --git a/patch_api/__init__.py b/patch_api/__init__.py index 15bbf41..6f69236 100644 --- a/patch_api/__init__.py +++ b/patch_api/__init__.py @@ -15,7 +15,7 @@ from __future__ import absolute_import -__version__ = "1.17.1" +__version__ = "1.18.0" # import ApiClient from patch_api.api_client import ApiClient diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py index d86a079..4f299e9 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -51,6 +51,7 @@ class EstimatesApi(object): "aircraft_code", "cabin_class", "passenger_count", + "state", ] def __init__(self, api_client=None): @@ -142,6 +143,7 @@ def create_bitcoin_estimate_with_http_info( all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -304,6 +306,7 @@ def create_ethereum_estimate_with_http_info( all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -466,6 +469,7 @@ def create_flight_estimate_with_http_info( all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -628,6 +632,7 @@ def create_mass_estimate_with_http_info( all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -790,6 +795,7 @@ def create_shipping_estimate_with_http_info( all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -952,6 +958,7 @@ def create_vehicle_estimate_with_http_info( all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -1108,6 +1115,7 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -1254,6 +1262,7 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: diff --git a/patch_api/api/orders_api.py b/patch_api/api/orders_api.py index 8f98721..cc583ed 100644 --- a/patch_api/api/orders_api.py +++ b/patch_api/api/orders_api.py @@ -51,6 +51,7 @@ class OrdersApi(object): "aircraft_code", "cabin_class", "passenger_count", + "state", ] def __init__(self, api_client=None): @@ -136,6 +137,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -205,7 +207,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 def create_order(self, create_order_request={}, **kwargs): # noqa: E501 """Creates an order # noqa: E501 - Creates an order in the `placed` state. To create a `draft` order, create an estimate first. # noqa: E501 + Creates an order in the `placed` or `draft` state. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_order(create_order_request, async_req=True) @@ -232,7 +234,7 @@ def create_order(self, create_order_request={}, **kwargs): # noqa: E501 def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: E501 """Creates an order # noqa: E501 - Creates an order in the `placed` state. To create a `draft` order, create an estimate first. # noqa: E501 + Creates an order in the `placed` or `draft` state. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_order_with_http_info(create_order_request, async_req=True) @@ -284,6 +286,7 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -440,6 +443,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -586,6 +590,7 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -743,6 +748,7 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: diff --git a/patch_api/api/projects_api.py b/patch_api/api/projects_api.py index 2c97cd8..7035555 100644 --- a/patch_api/api/projects_api.py +++ b/patch_api/api/projects_api.py @@ -51,6 +51,7 @@ class ProjectsApi(object): "aircraft_code", "cabin_class", "passenger_count", + "state", ] def __init__(self, api_client=None): @@ -136,6 +137,7 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -288,6 +290,7 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: diff --git a/patch_api/api/technology_types_api.py b/patch_api/api/technology_types_api.py index d421cb3..43cb02d 100644 --- a/patch_api/api/technology_types_api.py +++ b/patch_api/api/technology_types_api.py @@ -51,6 +51,7 @@ class TechnologyTypesApi(object): "aircraft_code", "cabin_class", "passenger_count", + "state", ] def __init__(self, api_client=None): @@ -134,6 +135,7 @@ def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501 all_params.append("aircraft_code") all_params.append("cabin_class") all_params.append("passenger_count") + all_params.append("state") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: diff --git a/patch_api/api_client.py b/patch_api/api_client.py index f296ba2..240ae5a 100644 --- a/patch_api/api_client.py +++ b/patch_api/api_client.py @@ -91,7 +91,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = "patch-python/1.17.1" + self.user_agent = "patch-python/1.18.0" def __del__(self): if self._pool: diff --git a/patch_api/configuration.py b/patch_api/configuration.py index fd7eb11..f9fa899 100644 --- a/patch_api/configuration.py +++ b/patch_api/configuration.py @@ -341,7 +341,7 @@ def to_debug_report(self): "OS: {env}\n" "Python Version: {pyversion}\n" "Version of the API: v1\n" - "SDK Package Version: 1.17.1".format( + "SDK Package Version: 1.18.0".format( env=sys.platform, pyversion=sys.version ) ) diff --git a/patch_api/models/create_order_request.py b/patch_api/models/create_order_request.py index 1fdf951..15b1387 100644 --- a/patch_api/models/create_order_request.py +++ b/patch_api/models/create_order_request.py @@ -38,6 +38,7 @@ class CreateOrderRequest(object): "total_price_cents_usd": "int", "project_id": "str", "metadata": "object", + "state": "str", } attribute_map = { @@ -45,6 +46,7 @@ class CreateOrderRequest(object): "total_price_cents_usd": "total_price_cents_usd", "project_id": "project_id", "metadata": "metadata", + "state": "state", } def __init__( @@ -53,6 +55,7 @@ def __init__( total_price_cents_usd=None, project_id=None, metadata=None, + state=None, local_vars_configuration=None, ): # noqa: E501 """CreateOrderRequest - a model defined in OpenAPI""" # noqa: E501 @@ -64,6 +67,7 @@ def __init__( self._total_price_cents_usd = None self._project_id = None self._metadata = None + self._state = None self.discriminator = None if mass_g is not None: @@ -74,6 +78,8 @@ def __init__( self.project_id = project_id if metadata is not None: self.metadata = metadata + if state is not None: + self.state = state @property def mass_g(self): @@ -183,6 +189,37 @@ def metadata(self, metadata): self._metadata = metadata + @property + def state(self): + """Gets the state of this CreateOrderRequest. # noqa: E501 + + + :return: The state of this CreateOrderRequest. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this CreateOrderRequest. + + + :param state: The state of this CreateOrderRequest. # noqa: E501 + :type: str + """ + allowed_values = ["draft", "placed"] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and state not in allowed_values + ): # noqa: E501 + raise ValueError( + "Invalid value for `state` ({0}), must be one of {1}".format( # noqa: E501 + state, allowed_values + ) + ) + + self._state = state + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/setup.py b/setup.py index c78ebfa..0a2b115 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "patch-api" -VERSION = "1.17.1" +VERSION = "1.18.0" # To install the library, run the following # # python setup.py install diff --git a/test/test_orders_api.py b/test/test_orders_api.py index 25f7abf..0c74eb7 100644 --- a/test/test_orders_api.py +++ b/test/test_orders_api.py @@ -51,6 +51,14 @@ def test_interactions_with_an_order(self): order.data.price_cents_usd + order.data.patch_fee_cents_usd, 100 ) + """Create an order in draft state + """ + order = self.api.create_order(mass_g=100, state="draft") + + self.assertTrue(order) + self.assertEqual(order.data.mass_g, 100) + self.assertEqual(order.data.state, "draft") + def test_retrieve_order(self): """Test case for retrieve_order"""