Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ 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.21.0] - 2022-05-03

### Added

- Adds optional `total_price` and `currency` field to `order` creation
- Adds optional `amount` and `unit` field to `order` creation
- Adds inventory to `project` responses
- Adds inventory to `order` responses

### Changed

- Deprecates `mass_g` and `total_price_cents_usd` fields for create `order` requests
- Deprecates `average_price_per_tonne_cents_usd` and `remaining_mass_g` from `project` responses
- Deprecates `price_cents_usd`, `patch_fee_cents_usd`, and `mass_g` from `order` responses

## [1.20.0] - 2022-04-18

### Added
Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,25 @@ import patch_api
patch = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY'))

# Create an order - you can create an order
# providing either mass_g or total_price_cents_usd, but not both
# providing either amount (and unit) or total_price (and currency), but not both

# Create order with mass
patch.orders.create_order(mass_g=1_000_000) # Pass in the mass in grams (i.e. 1 metric tonne)
# Create order with amount
amount = 1_000_000 # Pass in the amount in unit specified
unit = "g"
patch.orders.create_order(amount=amount, unit=unit)

# Create an order with maximum total price
total_price_cents_usd = 5_00 # Pass in the total price in cents (i.e. 5 dollars)
patch.orders.create_order(total_price_cents_usd=total_price_cents_usd)
# Create an order with total price
total_price = 5_00 # Pass in the total price in smallest currency unit (ie cents for USD).
currency = "USD"
patch.orders.create_order(total_price=total_price, currency=currency)

## You can also specify a project-id field (optional) to be used instead of the preferred one
project_id = 'pro_test_1234' # Pass in the project's ID
patch.orders.create_order(project_id=project_id, mass_g=mass_g)
patch.orders.create_order(project_id=project_id, amount=amount, unit=unit)

## Orders also accept a metadata field (optional)
metadata = {user: "john doe"}
patch.orders.create_order(metadata=metadata, mass_g=mass_g)
patch.orders.create_order(metadata=metadata, amount=amount, unit=unit)

# Retrieve an order
order_id = 'ord_test_1234' # Pass in the order's id
Expand Down
2 changes: 1 addition & 1 deletion patch_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from __future__ import absolute_import

__version__ = "1.20.0"
__version__ = "1.21.0"

# import ApiClient
from patch_api.api_client import ApiClient
Expand Down
40 changes: 40 additions & 0 deletions patch_api/api/estimates_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class EstimatesApi(object):
"number_of_nights",
"number_of_rooms",
"vintage_year",
"total_price",
"currency",
"amount",
"unit",
]

def __init__(self, api_client=None):
Expand Down Expand Up @@ -158,6 +162,10 @@ def create_bitcoin_estimate_with_http_info(
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -328,6 +336,10 @@ def create_ethereum_estimate_with_http_info(
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -498,6 +510,10 @@ def create_flight_estimate_with_http_info(
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -668,6 +684,10 @@ def create_hotel_estimate_with_http_info(
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -838,6 +858,10 @@ def create_mass_estimate_with_http_info(
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -1008,6 +1032,10 @@ def create_shipping_estimate_with_http_info(
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -1178,6 +1206,10 @@ def create_vehicle_estimate_with_http_info(
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -1342,6 +1374,10 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -1496,6 +1532,10 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down
24 changes: 24 additions & 0 deletions patch_api/api/orders_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class OrdersApi(object):
"number_of_nights",
"number_of_rooms",
"vintage_year",
"total_price",
"currency",
"amount",
"unit",
]

def __init__(self, api_client=None):
Expand Down Expand Up @@ -152,6 +156,10 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -308,6 +316,10 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa:
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -472,6 +484,10 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -626,6 +642,10 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -791,6 +811,10 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down
12 changes: 12 additions & 0 deletions patch_api/api/projects_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class ProjectsApi(object):
"number_of_nights",
"number_of_rooms",
"vintage_year",
"total_price",
"currency",
"amount",
"unit",
]

def __init__(self, api_client=None):
Expand Down Expand Up @@ -152,6 +156,10 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -312,6 +320,10 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down
8 changes: 8 additions & 0 deletions patch_api/api/technology_types_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class TechnologyTypesApi(object):
"number_of_nights",
"number_of_rooms",
"vintage_year",
"total_price",
"currency",
"amount",
"unit",
]

def __init__(self, api_client=None):
Expand Down Expand Up @@ -150,6 +154,10 @@ def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501
all_params.append("number_of_nights")
all_params.append("number_of_rooms")
all_params.append("vintage_year")
all_params.append("total_price")
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down
2 changes: 1 addition & 1 deletion patch_api/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.20.0"
self.user_agent = "patch-python/1.21.0"

def __del__(self):
if self._pool:
Expand Down
2 changes: 1 addition & 1 deletion patch_api/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.20.0".format(
"SDK Package Version: 1.21.0".format(
env=sys.platform, pyversion=sys.version
)
)
Expand Down
3 changes: 3 additions & 0 deletions patch_api/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@
from patch_api.models.estimate_list_response import EstimateListResponse
from patch_api.models.estimate_response import EstimateResponse
from patch_api.models.highlight import Highlight
from patch_api.models.inventory import Inventory
from patch_api.models.meta_index_object import MetaIndexObject
from patch_api.models.order import Order
from patch_api.models.order_inventory import OrderInventory
from patch_api.models.order_inventory_project import OrderInventoryProject
from patch_api.models.order_list_response import OrderListResponse
from patch_api.models.order_response import OrderResponse
from patch_api.models.parent_technology_type import ParentTechnologyType
Expand Down
Loading