Skip to content

Commit fc56f3e

Browse files
authored
1.18.0 (#53)
* 1.18.0 * spec coverage for draft orders, add allowed parameter
1 parent 3c22332 commit fc56f3e

11 files changed

+76
-6
lines changed

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.18.0] - 2022-03-22
9+
### Changed
10+
11+
- Adds optional `state` field to `order` creation
12+
813
## [1.17.0] - 2022-01-11
914

1015
### Changed

Diff for: patch_api/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from __future__ import absolute_import
1717

18-
__version__ = "1.17.1"
18+
__version__ = "1.18.0"
1919

2020
# import ApiClient
2121
from patch_api.api_client import ApiClient

Diff for: patch_api/api/estimates_api.py

+9
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class EstimatesApi(object):
5151
"aircraft_code",
5252
"cabin_class",
5353
"passenger_count",
54+
"state",
5455
]
5556

5657
def __init__(self, api_client=None):
@@ -142,6 +143,7 @@ def create_bitcoin_estimate_with_http_info(
142143
all_params.append("aircraft_code")
143144
all_params.append("cabin_class")
144145
all_params.append("passenger_count")
146+
all_params.append("state")
145147

146148
for key, val in six.iteritems(local_var_params["kwargs"]):
147149
if key not in all_params:
@@ -304,6 +306,7 @@ def create_ethereum_estimate_with_http_info(
304306
all_params.append("aircraft_code")
305307
all_params.append("cabin_class")
306308
all_params.append("passenger_count")
309+
all_params.append("state")
307310

308311
for key, val in six.iteritems(local_var_params["kwargs"]):
309312
if key not in all_params:
@@ -466,6 +469,7 @@ def create_flight_estimate_with_http_info(
466469
all_params.append("aircraft_code")
467470
all_params.append("cabin_class")
468471
all_params.append("passenger_count")
472+
all_params.append("state")
469473

470474
for key, val in six.iteritems(local_var_params["kwargs"]):
471475
if key not in all_params:
@@ -628,6 +632,7 @@ def create_mass_estimate_with_http_info(
628632
all_params.append("aircraft_code")
629633
all_params.append("cabin_class")
630634
all_params.append("passenger_count")
635+
all_params.append("state")
631636

632637
for key, val in six.iteritems(local_var_params["kwargs"]):
633638
if key not in all_params:
@@ -790,6 +795,7 @@ def create_shipping_estimate_with_http_info(
790795
all_params.append("aircraft_code")
791796
all_params.append("cabin_class")
792797
all_params.append("passenger_count")
798+
all_params.append("state")
793799

794800
for key, val in six.iteritems(local_var_params["kwargs"]):
795801
if key not in all_params:
@@ -952,6 +958,7 @@ def create_vehicle_estimate_with_http_info(
952958
all_params.append("aircraft_code")
953959
all_params.append("cabin_class")
954960
all_params.append("passenger_count")
961+
all_params.append("state")
955962

956963
for key, val in six.iteritems(local_var_params["kwargs"]):
957964
if key not in all_params:
@@ -1108,6 +1115,7 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501
11081115
all_params.append("aircraft_code")
11091116
all_params.append("cabin_class")
11101117
all_params.append("passenger_count")
1118+
all_params.append("state")
11111119

11121120
for key, val in six.iteritems(local_var_params["kwargs"]):
11131121
if key not in all_params:
@@ -1254,6 +1262,7 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501
12541262
all_params.append("aircraft_code")
12551263
all_params.append("cabin_class")
12561264
all_params.append("passenger_count")
1265+
all_params.append("state")
12571266

12581267
for key, val in six.iteritems(local_var_params["kwargs"]):
12591268
if key not in all_params:

Diff for: patch_api/api/orders_api.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class OrdersApi(object):
5151
"aircraft_code",
5252
"cabin_class",
5353
"passenger_count",
54+
"state",
5455
]
5556

5657
def __init__(self, api_client=None):
@@ -136,6 +137,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501
136137
all_params.append("aircraft_code")
137138
all_params.append("cabin_class")
138139
all_params.append("passenger_count")
140+
all_params.append("state")
139141

140142
for key, val in six.iteritems(local_var_params["kwargs"]):
141143
if key not in all_params:
@@ -205,7 +207,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501
205207
def create_order(self, create_order_request={}, **kwargs): # noqa: E501
206208
"""Creates an order # noqa: E501
207209
208-
Creates an order in the `placed` state. To create a `draft` order, create an estimate first. # noqa: E501
210+
Creates an order in the `placed` or `draft` state. # noqa: E501
209211
This method makes a synchronous HTTP request by default. To make an
210212
asynchronous HTTP request, please pass async_req=True
211213
>>> thread = api.create_order(create_order_request, async_req=True)
@@ -232,7 +234,7 @@ def create_order(self, create_order_request={}, **kwargs): # noqa: E501
232234
def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: E501
233235
"""Creates an order # noqa: E501
234236
235-
Creates an order in the `placed` state. To create a `draft` order, create an estimate first. # noqa: E501
237+
Creates an order in the `placed` or `draft` state. # noqa: E501
236238
This method makes a synchronous HTTP request by default. To make an
237239
asynchronous HTTP request, please pass async_req=True
238240
>>> 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:
284286
all_params.append("aircraft_code")
285287
all_params.append("cabin_class")
286288
all_params.append("passenger_count")
289+
all_params.append("state")
287290

288291
for key, val in six.iteritems(local_var_params["kwargs"]):
289292
if key not in all_params:
@@ -440,6 +443,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501
440443
all_params.append("aircraft_code")
441444
all_params.append("cabin_class")
442445
all_params.append("passenger_count")
446+
all_params.append("state")
443447

444448
for key, val in six.iteritems(local_var_params["kwargs"]):
445449
if key not in all_params:
@@ -586,6 +590,7 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501
586590
all_params.append("aircraft_code")
587591
all_params.append("cabin_class")
588592
all_params.append("passenger_count")
593+
all_params.append("state")
589594

590595
for key, val in six.iteritems(local_var_params["kwargs"]):
591596
if key not in all_params:
@@ -743,6 +748,7 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501
743748
all_params.append("aircraft_code")
744749
all_params.append("cabin_class")
745750
all_params.append("passenger_count")
751+
all_params.append("state")
746752

747753
for key, val in six.iteritems(local_var_params["kwargs"]):
748754
if key not in all_params:

Diff for: patch_api/api/projects_api.py

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class ProjectsApi(object):
5151
"aircraft_code",
5252
"cabin_class",
5353
"passenger_count",
54+
"state",
5455
]
5556

5657
def __init__(self, api_client=None):
@@ -136,6 +137,7 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501
136137
all_params.append("aircraft_code")
137138
all_params.append("cabin_class")
138139
all_params.append("passenger_count")
140+
all_params.append("state")
139141

140142
for key, val in six.iteritems(local_var_params["kwargs"]):
141143
if key not in all_params:
@@ -288,6 +290,7 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501
288290
all_params.append("aircraft_code")
289291
all_params.append("cabin_class")
290292
all_params.append("passenger_count")
293+
all_params.append("state")
291294

292295
for key, val in six.iteritems(local_var_params["kwargs"]):
293296
if key not in all_params:

Diff for: patch_api/api/technology_types_api.py

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class TechnologyTypesApi(object):
5151
"aircraft_code",
5252
"cabin_class",
5353
"passenger_count",
54+
"state",
5455
]
5556

5657
def __init__(self, api_client=None):
@@ -134,6 +135,7 @@ def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501
134135
all_params.append("aircraft_code")
135136
all_params.append("cabin_class")
136137
all_params.append("passenger_count")
138+
all_params.append("state")
137139

138140
for key, val in six.iteritems(local_var_params["kwargs"]):
139141
if key not in all_params:

Diff for: patch_api/api_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(
9191
self.default_headers[header_name] = header_value
9292
self.cookie = cookie
9393
# Set default User-Agent.
94-
self.user_agent = "patch-python/1.17.1"
94+
self.user_agent = "patch-python/1.18.0"
9595

9696
def __del__(self):
9797
if self._pool:

Diff for: patch_api/configuration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def to_debug_report(self):
341341
"OS: {env}\n"
342342
"Python Version: {pyversion}\n"
343343
"Version of the API: v1\n"
344-
"SDK Package Version: 1.17.1".format(
344+
"SDK Package Version: 1.18.0".format(
345345
env=sys.platform, pyversion=sys.version
346346
)
347347
)

Diff for: patch_api/models/create_order_request.py

+37
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ class CreateOrderRequest(object):
3838
"total_price_cents_usd": "int",
3939
"project_id": "str",
4040
"metadata": "object",
41+
"state": "str",
4142
}
4243

4344
attribute_map = {
4445
"mass_g": "mass_g",
4546
"total_price_cents_usd": "total_price_cents_usd",
4647
"project_id": "project_id",
4748
"metadata": "metadata",
49+
"state": "state",
4850
}
4951

5052
def __init__(
@@ -53,6 +55,7 @@ def __init__(
5355
total_price_cents_usd=None,
5456
project_id=None,
5557
metadata=None,
58+
state=None,
5659
local_vars_configuration=None,
5760
): # noqa: E501
5861
"""CreateOrderRequest - a model defined in OpenAPI""" # noqa: E501
@@ -64,6 +67,7 @@ def __init__(
6467
self._total_price_cents_usd = None
6568
self._project_id = None
6669
self._metadata = None
70+
self._state = None
6771
self.discriminator = None
6872

6973
if mass_g is not None:
@@ -74,6 +78,8 @@ def __init__(
7478
self.project_id = project_id
7579
if metadata is not None:
7680
self.metadata = metadata
81+
if state is not None:
82+
self.state = state
7783

7884
@property
7985
def mass_g(self):
@@ -183,6 +189,37 @@ def metadata(self, metadata):
183189

184190
self._metadata = metadata
185191

192+
@property
193+
def state(self):
194+
"""Gets the state of this CreateOrderRequest. # noqa: E501
195+
196+
197+
:return: The state of this CreateOrderRequest. # noqa: E501
198+
:rtype: str
199+
"""
200+
return self._state
201+
202+
@state.setter
203+
def state(self, state):
204+
"""Sets the state of this CreateOrderRequest.
205+
206+
207+
:param state: The state of this CreateOrderRequest. # noqa: E501
208+
:type: str
209+
"""
210+
allowed_values = ["draft", "placed"] # noqa: E501
211+
if (
212+
self.local_vars_configuration.client_side_validation
213+
and state not in allowed_values
214+
): # noqa: E501
215+
raise ValueError(
216+
"Invalid value for `state` ({0}), must be one of {1}".format( # noqa: E501
217+
state, allowed_values
218+
)
219+
)
220+
221+
self._state = state
222+
186223
def to_dict(self):
187224
"""Returns the model properties as a dict"""
188225
result = {}

Diff for: setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from setuptools import setup, find_packages # noqa: H301
1313

1414
NAME = "patch-api"
15-
VERSION = "1.17.1"
15+
VERSION = "1.18.0"
1616
# To install the library, run the following
1717
#
1818
# python setup.py install

Diff for: test/test_orders_api.py

+8
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ def test_interactions_with_an_order(self):
5151
order.data.price_cents_usd + order.data.patch_fee_cents_usd, 100
5252
)
5353

54+
"""Create an order in draft state
55+
"""
56+
order = self.api.create_order(mass_g=100, state="draft")
57+
58+
self.assertTrue(order)
59+
self.assertEqual(order.data.mass_g, 100)
60+
self.assertEqual(order.data.state, "draft")
61+
5462
def test_retrieve_order(self):
5563
"""Test case for retrieve_order"""
5664

0 commit comments

Comments
 (0)