Skip to content

Commit

Permalink
Add support to Orders API for issued_to (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtbp authored Jun 6, 2022
1 parent a1852fc commit 8880d42
Show file tree
Hide file tree
Showing 20 changed files with 547 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ 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.23.0] - 2022-06-03

### Added

- Adds support for the `issued_to` parameter on `orders`, to add support for creating and placing orders on behalf of another party.

## [1.22.0] - 2022-05-16

### Added
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,17 @@ project_id = 'pro_test_1234' # Pass in the project's ID
patch.orders.create_order(project_id=project_id, amount=amount, unit=unit)

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

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

## Orders also accept an issued_to field (optional)
issued_to = {"name": "Company A", "email": "[email protected]"}
patch.orders.create_order(issued_to=issued_to, amount=amount, unit=unit)

# Retrieve an order
order_id = 'ord_test_1234' # Pass in the order's id
patch.orders.retrieve_order(id=order_id)
Expand All @@ -93,6 +101,10 @@ patch.orders.retrieve_order(id=order_id)
order_id = 'ord_test_1234' # Pass in the order's id
patch.orders.place_order(id=order_id)

## Placing an order on behalf of another party
issued_to = {"name": "Company A", "email": "[email protected]"}
patch.orders.place_order(id=order_id, issued_to=issued_to)

# Cancel an order
order_id = 'ord_test_1234' # Pass in the order's id
patch.orders.cancel_order(id=order_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.22.0"
__version__ = "1.23.0"

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

def __init__(self, api_client=None):
Expand Down Expand Up @@ -166,6 +167,7 @@ def create_bitcoin_estimate_with_http_info(
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -340,6 +342,7 @@ def create_ethereum_estimate_with_http_info(
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -514,6 +517,7 @@ def create_flight_estimate_with_http_info(
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -688,6 +692,7 @@ def create_hotel_estimate_with_http_info(
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -862,6 +867,7 @@ def create_mass_estimate_with_http_info(
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -1036,6 +1042,7 @@ def create_shipping_estimate_with_http_info(
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -1210,6 +1217,7 @@ def create_vehicle_estimate_with_http_info(
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -1378,6 +1386,7 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -1536,6 +1545,7 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down
19 changes: 18 additions & 1 deletion patch_api/api/orders_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class OrdersApi(object):
"currency",
"amount",
"unit",
"issued_to",
]

def __init__(self, api_client=None):
Expand Down Expand Up @@ -160,6 +161,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -320,6 +322,7 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa:
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -407,6 +410,7 @@ def place_order(self, id={}, **kwargs): # noqa: E501
:param async_req bool: execute request asynchronously
:param str id: (required)
:param PlaceOrderRequest place_order_request:
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
Expand All @@ -432,6 +436,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501
:param async_req bool: execute request asynchronously
:param str id: (required)
:param PlaceOrderRequest place_order_request:
:param _return_http_data_only: response data without head status code
and headers
:param _preload_content: if False, the urllib3.HTTPResponse object will
Expand All @@ -448,7 +453,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501

local_var_params = locals()

all_params = ["id"] # noqa: E501
all_params = ["id", "place_order_request"] # noqa: E501
all_params.append("async_req")
all_params.append("_return_http_data_only")
all_params.append("_preload_content")
Expand Down Expand Up @@ -488,6 +493,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -526,11 +532,20 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501
local_var_files = {}

body_params = None
if "place_order_request" in local_var_params:
body_params = local_var_params["place_order_request"]
# HTTP header `Accept`
header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
) # noqa: E501

# HTTP header `Content-Type`
header_params[
"Content-Type"
] = self.api_client.select_header_content_type( # noqa: E501
["application/json"]
) # noqa: E501

# Authentication setting
auth_settings = ["bearer_auth"] # noqa: E501

Expand Down Expand Up @@ -646,6 +661,7 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -815,6 +831,7 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

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

def __init__(self, api_client=None):
Expand Down Expand Up @@ -162,6 +163,7 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
Expand Down Expand Up @@ -338,6 +340,7 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

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

def __init__(self, api_client=None):
Expand Down Expand Up @@ -158,6 +159,7 @@ def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501
all_params.append("currency")
all_params.append("amount")
all_params.append("unit")
all_params.append("issued_to")

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.22.0"
self.user_agent = "patch-python/1.23.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.22.0".format(
"SDK Package Version: 1.23.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 @@ -39,6 +39,7 @@
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.issued_to import IssuedTo
from patch_api.models.meta_index_object import MetaIndexObject
from patch_api.models.order import Order
from patch_api.models.order_inventory import OrderInventory
Expand All @@ -47,10 +48,12 @@
from patch_api.models.order_response import OrderResponse
from patch_api.models.parent_technology_type import ParentTechnologyType
from patch_api.models.photo import Photo
from patch_api.models.place_order_request import PlaceOrderRequest
from patch_api.models.project import Project
from patch_api.models.project_list_response import ProjectListResponse
from patch_api.models.project_response import ProjectResponse
from patch_api.models.sdg import Sdg
from patch_api.models.standard import Standard
from patch_api.models.technology_type import TechnologyType
from patch_api.models.technology_type_list_response import TechnologyTypeListResponse
from patch_api.models.v1_orders_issued_to import V1OrdersIssuedTo
4 changes: 2 additions & 2 deletions patch_api/models/allocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def id(self, id):
def production(self):
"""Gets the production of this Allocation. # noqa: E501
A boolean indicating if this project is a production or test mode project. # noqa: E501
A boolean indicating if this project is a production or demo mode project. # noqa: E501
:return: The production of this Allocation. # noqa: E501
:rtype: bool
Expand All @@ -96,7 +96,7 @@ def production(self):
def production(self, production):
"""Sets the production of this Allocation.
A boolean indicating if this project is a production or test mode project. # noqa: E501
A boolean indicating if this project is a production or demo mode project. # noqa: E501
:param production: The production of this Allocation. # noqa: E501
:type: bool
Expand Down
26 changes: 26 additions & 0 deletions patch_api/models/create_order_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class CreateOrderRequest(object):
"currency": "str",
"amount": "int",
"unit": "str",
"issued_to": "V1OrdersIssuedTo",
}

attribute_map = {
Expand All @@ -57,6 +58,7 @@ class CreateOrderRequest(object):
"currency": "currency",
"amount": "amount",
"unit": "unit",
"issued_to": "issued_to",
}

def __init__(
Expand All @@ -71,6 +73,7 @@ def __init__(
currency=None,
amount=None,
unit=None,
issued_to=None,
local_vars_configuration=None,
): # noqa: E501
"""CreateOrderRequest - a model defined in OpenAPI""" # noqa: E501
Expand All @@ -88,6 +91,7 @@ def __init__(
self._currency = None
self._amount = None
self._unit = None
self._issued_to = None
self.discriminator = None

self.mass_g = mass_g
Expand All @@ -100,6 +104,7 @@ def __init__(
self.currency = currency
self.amount = amount
self.unit = unit
self.issued_to = issued_to

@property
def mass_g(self):
Expand Down Expand Up @@ -395,6 +400,27 @@ def unit(self, unit):

self._unit = unit

@property
def issued_to(self):
"""Gets the issued_to of this CreateOrderRequest. # noqa: E501
:return: The issued_to of this CreateOrderRequest. # noqa: E501
:rtype: V1OrdersIssuedTo
"""
return self._issued_to

@issued_to.setter
def issued_to(self, issued_to):
"""Sets the issued_to of this CreateOrderRequest.
:param issued_to: The issued_to of this CreateOrderRequest. # noqa: E501
:type: V1OrdersIssuedTo
"""

self._issued_to = issued_to

def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
Expand Down
Loading

0 comments on commit 8880d42

Please sign in to comment.