-
Notifications
You must be signed in to change notification settings - Fork 2
Add bitcoin estimates and registry_url #26
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
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
77190eb
Add bitcoin and registry_url
pcothenet aa53fa6
Merge remote-tracking branch 'origin/main' into pc/16
pcothenet dcff65d
Fix existing test
pcothenet a40c57e
Reformat files
pcothenet aa607cd
Inline black
pcothenet e267c6f
Add bitcoin test
pcothenet 0a7659d
Autoformat
pcothenet 6292ee3
Pre-commit instructions
pcothenet 6777e3f
Fix flake8
pcothenet e71d937
Remove ;
pcothenet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
repos: | ||
- repo: https://github.com/ambv/black | ||
rev: stable | ||
hooks: | ||
- id: black | ||
language_version: python3.6 | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v1.2.3 | ||
rev: v2.3.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: flake8 | ||
args: ['--config=.flake8'] | ||
- repo: https://github.com/psf/black | ||
rev: 21.6b0 | ||
hooks: | ||
- id: black |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,11 +40,158 @@ class EstimatesApi(object): | |
"model", | ||
"make", | ||
"year", | ||
"transaction_value_btc_sats", | ||
"timestamp", | ||
] | ||
|
||
def __init__(self, api_client=None): | ||
self.api_client = api_client | ||
|
||
def create_bitcoin_estimate( | ||
self, create_bitcoin_estimate_request={}, **kwargs | ||
): # noqa: E501 | ||
"""Create a bitcoin estimate given a timestamp and transaction value # noqa: E501 | ||
|
||
Creates a bitcoin estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. # 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_bitcoin_estimate(create_bitcoin_estimate_request, async_req=True) | ||
>>> result = thread.get() | ||
|
||
:param async_req bool: execute request asynchronously | ||
:param CreateBitcoinEstimateRequest create_bitcoin_estimate_request: (required) | ||
:param _preload_content: if False, the urllib3.HTTPResponse object will | ||
be returned without reading/decoding response | ||
data. Default is True. | ||
:param _request_timeout: timeout setting for this request. If one | ||
number provided, it will be total request | ||
timeout. It can also be a pair (tuple) of | ||
(connection, read) timeouts. | ||
:return: EstimateResponse | ||
If the method is called asynchronously, | ||
returns the request thread. | ||
""" | ||
kwargs["_return_http_data_only"] = True | ||
return self.create_bitcoin_estimate_with_http_info( | ||
create_bitcoin_estimate_request, **kwargs | ||
) # noqa: E501 | ||
|
||
def create_bitcoin_estimate_with_http_info( | ||
self, create_bitcoin_estimate_request, **kwargs | ||
): # noqa: E501 | ||
"""Create a bitcoin estimate given a timestamp and transaction value # noqa: E501 | ||
|
||
Creates a bitcoin estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. # 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_bitcoin_estimate_with_http_info(create_bitcoin_estimate_request, async_req=True) | ||
>>> result = thread.get() | ||
|
||
:param async_req bool: execute request asynchronously | ||
:param CreateBitcoinEstimateRequest create_bitcoin_estimate_request: (required) | ||
:param _return_http_data_only: response data without head status code | ||
and headers | ||
:param _preload_content: if False, the urllib3.HTTPResponse object will | ||
be returned without reading/decoding response | ||
data. Default is True. | ||
:param _request_timeout: timeout setting for this request. If one | ||
number provided, it will be total request | ||
timeout. It can also be a pair (tuple) of | ||
(connection, read) timeouts. | ||
:return: tuple(EstimateResponse, status_code(int), headers(HTTPHeaderDict)) | ||
If the method is called asynchronously, | ||
returns the request thread. | ||
""" | ||
|
||
local_var_params = locals() | ||
|
||
all_params = ["create_bitcoin_estimate_request"] # noqa: E501 | ||
all_params.append("async_req") | ||
all_params.append("_return_http_data_only") | ||
all_params.append("_preload_content") | ||
all_params.append("_request_timeout") | ||
all_params.append("mass_g") | ||
all_params.append("total_price_cents_usd") | ||
all_params.append("project_id") | ||
all_params.append("metadata") | ||
all_params.append("distance_m") | ||
all_params.append("transportation_method") | ||
all_params.append("package_mass_g") | ||
all_params.append("create_order") | ||
all_params.append("make") | ||
all_params.append("model") | ||
all_params.append("year") | ||
all_params.append("transaction_value_btc_sats") | ||
all_params.append("timestamp") | ||
|
||
for key, val in six.iteritems(local_var_params["kwargs"]): | ||
if key not in all_params: | ||
raise ApiTypeError( | ||
"Got an unexpected keyword argument '%s'" | ||
" to method create_bitcoin_estimate" % key | ||
) | ||
local_var_params[key] = val | ||
del local_var_params["kwargs"] | ||
# verify the required parameter 'create_bitcoin_estimate_request' is set | ||
if ( | ||
"create_bitcoin_estimate_request" not in local_var_params | ||
or local_var_params["create_bitcoin_estimate_request"] is None | ||
): | ||
raise ApiValueError( | ||
"Missing the required parameter `create_bitcoin_estimate_request` when calling `create_bitcoin_estimate`" | ||
) # noqa: E501 | ||
|
||
collection_formats = {} | ||
|
||
path_params = {} | ||
|
||
query_params = [] | ||
for key in kwargs: | ||
query_params.append([key, kwargs.get(key)]) | ||
|
||
header_params = {} | ||
|
||
form_params = [] | ||
local_var_files = {} | ||
|
||
body_params = None | ||
if "create_bitcoin_estimate_request" in local_var_params: | ||
body_params = local_var_params["create_bitcoin_estimate_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 | ||
|
||
return self.api_client.call_api( | ||
"/v1/estimates/crypto/btc", | ||
"POST", | ||
path_params, | ||
query_params, | ||
header_params, | ||
body=body_params, | ||
post_params=form_params, | ||
files=local_var_files, | ||
response_type="EstimateResponse", # noqa: E501 | ||
auth_settings=auth_settings, | ||
async_req=local_var_params.get("async_req"), | ||
_return_http_data_only=local_var_params.get( | ||
"_return_http_data_only" | ||
), # noqa: E501 | ||
_preload_content=local_var_params.get("_preload_content", True), | ||
_request_timeout=local_var_params.get("_request_timeout"), | ||
collection_formats=collection_formats, | ||
) | ||
|
||
def create_flight_estimate( | ||
self, create_flight_estimate_request={}, **kwargs | ||
): # noqa: E501 | ||
|
@@ -119,6 +266,8 @@ def create_flight_estimate_with_http_info( | |
all_params.append("make") | ||
all_params.append("model") | ||
all_params.append("year") | ||
all_params.append("transaction_value_btc_sats") | ||
all_params.append("timestamp") | ||
Comment on lines
+269
to
+270
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This cruft is a function of the code generator. Would be great to read allowed parameters from the OpenAPI file. |
||
|
||
for key, val in six.iteritems(local_var_params["kwargs"]): | ||
if key not in all_params: | ||
|
@@ -262,6 +411,8 @@ def create_mass_estimate_with_http_info( | |
all_params.append("make") | ||
all_params.append("model") | ||
all_params.append("year") | ||
all_params.append("transaction_value_btc_sats") | ||
all_params.append("timestamp") | ||
|
||
for key, val in six.iteritems(local_var_params["kwargs"]): | ||
if key not in all_params: | ||
|
@@ -405,6 +556,8 @@ def create_shipping_estimate_with_http_info( | |
all_params.append("make") | ||
all_params.append("model") | ||
all_params.append("year") | ||
all_params.append("transaction_value_btc_sats") | ||
all_params.append("timestamp") | ||
|
||
for key, val in six.iteritems(local_var_params["kwargs"]): | ||
if key not in all_params: | ||
|
@@ -548,6 +701,8 @@ def create_vehicle_estimate_with_http_info( | |
all_params.append("make") | ||
all_params.append("model") | ||
all_params.append("year") | ||
all_params.append("transaction_value_btc_sats") | ||
all_params.append("timestamp") | ||
|
||
for key, val in six.iteritems(local_var_params["kwargs"]): | ||
if key not in all_params: | ||
|
@@ -685,6 +840,8 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 | |
all_params.append("make") | ||
all_params.append("model") | ||
all_params.append("year") | ||
all_params.append("transaction_value_btc_sats") | ||
all_params.append("timestamp") | ||
|
||
for key, val in six.iteritems(local_var_params["kwargs"]): | ||
if key not in all_params: | ||
|
@@ -812,6 +969,8 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 | |
all_params.append("make") | ||
all_params.append("model") | ||
all_params.append("year") | ||
all_params.append("transaction_value_btc_sats") | ||
all_params.append("timestamp") | ||
|
||
for key, val in six.iteritems(local_var_params["kwargs"]): | ||
if key not in all_params: | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing this command and adding to the readme file.