Skip to content

Metadata query params #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 18, 2021
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ 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.9.0] - 2021-08-17

### Added

- Fixed ability to create Orders with `metadata`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

- Add support for querying Orders by `metadata`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the new ETH parameter here as well?

- Added `transaction_value_eth_gwei` as an alternative way to compute transaction level emissions for ethereum

## [1.8.0] - 2021-07-20

### Added
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.8.0"
__version__ = "1.9.0"

# import ApiClient
from patch_api.api_client import ApiClient
Expand Down
74 changes: 65 additions & 9 deletions patch_api/api/estimates_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,15 @@ def create_bitcoin_estimate_with_http_info(
path_params = {}

query_params = []

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
query_params.append([key, kwargs.get(key)])
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

Expand Down Expand Up @@ -294,8 +301,15 @@ def create_ethereum_estimate_with_http_info(
path_params = {}

query_params = []

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
query_params.append([key, kwargs.get(key)])
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

Expand Down Expand Up @@ -440,8 +454,15 @@ def create_flight_estimate_with_http_info(
path_params = {}

query_params = []

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
query_params.append([key, kwargs.get(key)])
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

Expand Down Expand Up @@ -586,8 +607,15 @@ def create_mass_estimate_with_http_info(
path_params = {}

query_params = []

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
query_params.append([key, kwargs.get(key)])
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

Expand Down Expand Up @@ -732,8 +760,15 @@ def create_shipping_estimate_with_http_info(
path_params = {}

query_params = []

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
query_params.append([key, kwargs.get(key)])
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

Expand Down Expand Up @@ -878,8 +913,15 @@ def create_vehicle_estimate_with_http_info(
path_params = {}

query_params = []

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
query_params.append([key, kwargs.get(key)])
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

Expand Down Expand Up @@ -1017,8 +1059,15 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501
path_params["id"] = local_var_params["id"] # noqa: E501

query_params = []

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
query_params.append([key, kwargs.get(key)])
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])
Comment on lines +1062 to +1070
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll probably want to address the fact that this is duplicated several times over?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose but this logic does seem useful to have in each case so there aren't duplicate params in the list


header_params = {}

Expand Down Expand Up @@ -1140,11 +1189,18 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501
path_params = {}

query_params = []
for key in kwargs:
query_params.append([key, kwargs.get(key)])
if "page" in local_var_params:
query_params.append(("page", local_var_params["page"])) # noqa: E501

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

form_params = []
Expand Down
72 changes: 65 additions & 7 deletions patch_api/api/orders_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,15 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501
path_params["id"] = local_var_params["id"] # noqa: E501

query_params = []

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
query_params.append([key, kwargs.get(key)])
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

Expand Down Expand Up @@ -274,8 +281,15 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa:
path_params = {}

query_params = []

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
query_params.append([key, kwargs.get(key)])
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

Expand Down Expand Up @@ -413,8 +427,15 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501
path_params["id"] = local_var_params["id"] # noqa: E501

query_params = []

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
query_params.append([key, kwargs.get(key)])
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

Expand Down Expand Up @@ -543,8 +564,15 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501
path_params["id"] = local_var_params["id"] # noqa: E501

query_params = []

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
query_params.append([key, kwargs.get(key)])
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

Expand Down Expand Up @@ -591,6 +619,9 @@ def retrieve_orders(self, **kwargs): # noqa: E501

:param async_req bool: execute request asynchronously
:param int page:
:param str metadata:
:param str metadata_example1:
:param str metadata_example2:
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
Expand All @@ -616,6 +647,9 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501

:param async_req bool: execute request asynchronously
:param int page:
:param str metadata:
:param str metadata_example1:
:param str metadata_example2:
: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 @@ -632,7 +666,12 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501

local_var_params = locals()

all_params = ["page"] # noqa: E501
all_params = [
"page",
"metadata",
"metadata_example1",
"metadata_example2",
] # noqa: E501
all_params.append("async_req")
all_params.append("_return_http_data_only")
all_params.append("_preload_content")
Expand Down Expand Up @@ -666,10 +705,29 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501
path_params = {}

query_params = []
for key in kwargs:
query_params.append([key, kwargs.get(key)])
if "page" in local_var_params:
query_params.append(("page", local_var_params["page"])) # noqa: E501
if "metadata" in local_var_params:
query_params.append(
("metadata", local_var_params["metadata"])
) # noqa: E501
if "metadata_example1" in local_var_params:
query_params.append(
("metadata[example1]", local_var_params["metadata_example1"])
) # noqa: E501
if "metadata_example2" in local_var_params:
query_params.append(
("metadata[example2]", local_var_params["metadata_example2"])
) # noqa: E501

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])
Comment on lines +723 to +730
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the place in which this new logic is most relevant. Previously, a named query param would appear twice because all args were added to the params list even if they already matched one of the conditionals above


header_params = {}

Expand Down
38 changes: 33 additions & 5 deletions patch_api/api/preferences_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,15 @@ def create_preference_with_http_info(
path_params = {}

query_params = []

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
query_params.append([key, kwargs.get(key)])
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

Expand Down Expand Up @@ -285,8 +292,15 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501
path_params["id"] = local_var_params["id"] # noqa: E501

query_params = []

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
query_params.append([key, kwargs.get(key)])
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

Expand Down Expand Up @@ -415,8 +429,15 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501
path_params["id"] = local_var_params["id"] # noqa: E501

query_params = []

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
query_params.append([key, kwargs.get(key)])
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

Expand Down Expand Up @@ -538,11 +559,18 @@ def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501
path_params = {}

query_params = []
for key in kwargs:
query_params.append([key, kwargs.get(key)])
if "page" in local_var_params:
query_params.append(("page", local_var_params["page"])) # noqa: E501

# do not add duplicate keys to query_params list
existing_keys = []
for param in query_params:
existing_keys.append(param[0])

for key in kwargs:
if key not in existing_keys:
query_params.append([key, kwargs.get(key)])

header_params = {}

form_params = []
Expand Down
Loading