Skip to content

Commit 3477fc6

Browse files
authored
Add hotel estimates (#54)
* Generated sdk and added test code * Fixed mustache files and regenerated * Regenerated SDK after fixing mustache file in ccg
1 parent fc56f3e commit 3477fc6

12 files changed

+632
-5
lines changed

CHANGELOG.md

+6-1
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.19.0] - 2022-04-11
9+
### Added
10+
11+
- Adds ability to create hotel estimates via `api_client.estimates.create_hotel_estimate()`
12+
813
## [1.18.0] - 2022-03-22
914
### Changed
1015

@@ -62,7 +67,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6267

6368
### Added
6469

65-
- Adds support for airports, aircracts, cabin class and passenger count in flight estimates
70+
- Adds support for airports, aircrafts, cabin class and passenger count in flight estimates
6671

6772
## [1.10.0] - 2021-08-27
6873

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.18.0"
18+
__version__ = "1.19.0"
1919

2020
# import ApiClient
2121
from patch_api.api_client import ApiClient

patch_api/api/estimates_api.py

+223
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ class EstimatesApi(object):
5252
"cabin_class",
5353
"passenger_count",
5454
"state",
55+
"country_code",
56+
"city",
57+
"region",
58+
"star_rating",
59+
"number_of_nights",
60+
"number_of_rooms",
5561
]
5662

5763
def __init__(self, api_client=None):
@@ -144,6 +150,12 @@ def create_bitcoin_estimate_with_http_info(
144150
all_params.append("cabin_class")
145151
all_params.append("passenger_count")
146152
all_params.append("state")
153+
all_params.append("country_code")
154+
all_params.append("city")
155+
all_params.append("region")
156+
all_params.append("star_rating")
157+
all_params.append("number_of_nights")
158+
all_params.append("number_of_rooms")
147159

148160
for key, val in six.iteritems(local_var_params["kwargs"]):
149161
if key not in all_params:
@@ -307,6 +319,12 @@ def create_ethereum_estimate_with_http_info(
307319
all_params.append("cabin_class")
308320
all_params.append("passenger_count")
309321
all_params.append("state")
322+
all_params.append("country_code")
323+
all_params.append("city")
324+
all_params.append("region")
325+
all_params.append("star_rating")
326+
all_params.append("number_of_nights")
327+
all_params.append("number_of_rooms")
310328

311329
for key, val in six.iteritems(local_var_params["kwargs"]):
312330
if key not in all_params:
@@ -470,6 +488,12 @@ def create_flight_estimate_with_http_info(
470488
all_params.append("cabin_class")
471489
all_params.append("passenger_count")
472490
all_params.append("state")
491+
all_params.append("country_code")
492+
all_params.append("city")
493+
all_params.append("region")
494+
all_params.append("star_rating")
495+
all_params.append("number_of_nights")
496+
all_params.append("number_of_rooms")
473497

474498
for key, val in six.iteritems(local_var_params["kwargs"]):
475499
if key not in all_params:
@@ -546,6 +570,175 @@ def create_flight_estimate_with_http_info(
546570
collection_formats=collection_formats,
547571
)
548572

573+
def create_hotel_estimate(
574+
self, create_hotel_estimate_request={}, **kwargs
575+
): # noqa: E501
576+
"""Create a hotel estimate. # noqa: E501
577+
578+
Creates a hotel estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters. # noqa: E501
579+
This method makes a synchronous HTTP request by default. To make an
580+
asynchronous HTTP request, please pass async_req=True
581+
>>> thread = api.create_hotel_estimate(create_hotel_estimate_request, async_req=True)
582+
>>> result = thread.get()
583+
584+
:param async_req bool: execute request asynchronously
585+
:param CreateHotelEstimateRequest create_hotel_estimate_request: (required)
586+
:param _preload_content: if False, the urllib3.HTTPResponse object will
587+
be returned without reading/decoding response
588+
data. Default is True.
589+
:param _request_timeout: timeout setting for this request. If one
590+
number provided, it will be total request
591+
timeout. It can also be a pair (tuple) of
592+
(connection, read) timeouts.
593+
:return: EstimateResponse
594+
If the method is called asynchronously,
595+
returns the request thread.
596+
"""
597+
kwargs["_return_http_data_only"] = True
598+
return self.create_hotel_estimate_with_http_info(
599+
create_hotel_estimate_request, **kwargs
600+
) # noqa: E501
601+
602+
def create_hotel_estimate_with_http_info(
603+
self, create_hotel_estimate_request, **kwargs
604+
): # noqa: E501
605+
"""Create a hotel estimate. # noqa: E501
606+
607+
Creates a hotel estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters. # noqa: E501
608+
This method makes a synchronous HTTP request by default. To make an
609+
asynchronous HTTP request, please pass async_req=True
610+
>>> thread = api.create_hotel_estimate_with_http_info(create_hotel_estimate_request, async_req=True)
611+
>>> result = thread.get()
612+
613+
:param async_req bool: execute request asynchronously
614+
:param CreateHotelEstimateRequest create_hotel_estimate_request: (required)
615+
:param _return_http_data_only: response data without head status code
616+
and headers
617+
:param _preload_content: if False, the urllib3.HTTPResponse object will
618+
be returned without reading/decoding response
619+
data. Default is True.
620+
:param _request_timeout: timeout setting for this request. If one
621+
number provided, it will be total request
622+
timeout. It can also be a pair (tuple) of
623+
(connection, read) timeouts.
624+
:return: tuple(EstimateResponse, status_code(int), headers(HTTPHeaderDict))
625+
If the method is called asynchronously,
626+
returns the request thread.
627+
"""
628+
629+
local_var_params = locals()
630+
631+
all_params = ["create_hotel_estimate_request"] # noqa: E501
632+
all_params.append("async_req")
633+
all_params.append("_return_http_data_only")
634+
all_params.append("_preload_content")
635+
all_params.append("_request_timeout")
636+
all_params.append("mass_g")
637+
all_params.append("total_price_cents_usd")
638+
all_params.append("project_id")
639+
all_params.append("metadata")
640+
all_params.append("distance_m")
641+
all_params.append("transportation_method")
642+
all_params.append("package_mass_g")
643+
all_params.append("create_order")
644+
all_params.append("make")
645+
all_params.append("model")
646+
all_params.append("year")
647+
all_params.append("transaction_value_btc_sats")
648+
all_params.append("transaction_value_eth_gwei")
649+
all_params.append("gas_used")
650+
all_params.append("transaction_value_btc_sats")
651+
all_params.append("average_daily_balance_btc_sats")
652+
all_params.append("average_daily_balance_eth_gwei")
653+
all_params.append("timestamp")
654+
all_params.append("origin_airport")
655+
all_params.append("destination_airport")
656+
all_params.append("aircraft_code")
657+
all_params.append("cabin_class")
658+
all_params.append("passenger_count")
659+
all_params.append("state")
660+
all_params.append("country_code")
661+
all_params.append("city")
662+
all_params.append("region")
663+
all_params.append("star_rating")
664+
all_params.append("number_of_nights")
665+
all_params.append("number_of_rooms")
666+
667+
for key, val in six.iteritems(local_var_params["kwargs"]):
668+
if key not in all_params:
669+
raise ApiTypeError(
670+
"Got an unexpected keyword argument '%s'"
671+
" to method create_hotel_estimate" % key
672+
)
673+
local_var_params[key] = val
674+
del local_var_params["kwargs"]
675+
# verify the required parameter 'create_hotel_estimate_request' is set
676+
if (
677+
"create_hotel_estimate_request" not in local_var_params
678+
or local_var_params["create_hotel_estimate_request"] is None
679+
):
680+
raise ApiValueError(
681+
"Missing the required parameter `create_hotel_estimate_request` when calling `create_hotel_estimate`"
682+
) # noqa: E501
683+
684+
collection_formats = {}
685+
686+
path_params = {}
687+
688+
query_params = []
689+
690+
# do not add duplicate keys to query_params list
691+
existing_keys = []
692+
for param in query_params:
693+
existing_keys.append(param[0])
694+
695+
for key in kwargs:
696+
if key not in existing_keys:
697+
query_params.append([key, kwargs.get(key)])
698+
699+
header_params = {}
700+
701+
form_params = []
702+
local_var_files = {}
703+
704+
body_params = None
705+
if "create_hotel_estimate_request" in local_var_params:
706+
body_params = local_var_params["create_hotel_estimate_request"]
707+
# HTTP header `Accept`
708+
header_params["Accept"] = self.api_client.select_header_accept(
709+
["application/json"]
710+
) # noqa: E501
711+
712+
# HTTP header `Content-Type`
713+
header_params[
714+
"Content-Type"
715+
] = self.api_client.select_header_content_type( # noqa: E501
716+
["application/json"]
717+
) # noqa: E501
718+
719+
# Authentication setting
720+
auth_settings = ["bearer_auth"] # noqa: E501
721+
722+
return self.api_client.call_api(
723+
"/v1/estimates/hotel",
724+
"POST",
725+
path_params,
726+
query_params,
727+
header_params,
728+
body=body_params,
729+
post_params=form_params,
730+
files=local_var_files,
731+
response_type="EstimateResponse", # noqa: E501
732+
auth_settings=auth_settings,
733+
async_req=local_var_params.get("async_req"),
734+
_return_http_data_only=local_var_params.get(
735+
"_return_http_data_only"
736+
), # noqa: E501
737+
_preload_content=local_var_params.get("_preload_content", True),
738+
_request_timeout=local_var_params.get("_request_timeout"),
739+
collection_formats=collection_formats,
740+
)
741+
549742
def create_mass_estimate(
550743
self, create_mass_estimate_request={}, **kwargs
551744
): # noqa: E501
@@ -633,6 +826,12 @@ def create_mass_estimate_with_http_info(
633826
all_params.append("cabin_class")
634827
all_params.append("passenger_count")
635828
all_params.append("state")
829+
all_params.append("country_code")
830+
all_params.append("city")
831+
all_params.append("region")
832+
all_params.append("star_rating")
833+
all_params.append("number_of_nights")
834+
all_params.append("number_of_rooms")
636835

637836
for key, val in six.iteritems(local_var_params["kwargs"]):
638837
if key not in all_params:
@@ -796,6 +995,12 @@ def create_shipping_estimate_with_http_info(
796995
all_params.append("cabin_class")
797996
all_params.append("passenger_count")
798997
all_params.append("state")
998+
all_params.append("country_code")
999+
all_params.append("city")
1000+
all_params.append("region")
1001+
all_params.append("star_rating")
1002+
all_params.append("number_of_nights")
1003+
all_params.append("number_of_rooms")
7991004

8001005
for key, val in six.iteritems(local_var_params["kwargs"]):
8011006
if key not in all_params:
@@ -959,6 +1164,12 @@ def create_vehicle_estimate_with_http_info(
9591164
all_params.append("cabin_class")
9601165
all_params.append("passenger_count")
9611166
all_params.append("state")
1167+
all_params.append("country_code")
1168+
all_params.append("city")
1169+
all_params.append("region")
1170+
all_params.append("star_rating")
1171+
all_params.append("number_of_nights")
1172+
all_params.append("number_of_rooms")
9621173

9631174
for key, val in six.iteritems(local_var_params["kwargs"]):
9641175
if key not in all_params:
@@ -1116,6 +1327,12 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501
11161327
all_params.append("cabin_class")
11171328
all_params.append("passenger_count")
11181329
all_params.append("state")
1330+
all_params.append("country_code")
1331+
all_params.append("city")
1332+
all_params.append("region")
1333+
all_params.append("star_rating")
1334+
all_params.append("number_of_nights")
1335+
all_params.append("number_of_rooms")
11191336

11201337
for key, val in six.iteritems(local_var_params["kwargs"]):
11211338
if key not in all_params:
@@ -1263,6 +1480,12 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501
12631480
all_params.append("cabin_class")
12641481
all_params.append("passenger_count")
12651482
all_params.append("state")
1483+
all_params.append("country_code")
1484+
all_params.append("city")
1485+
all_params.append("region")
1486+
all_params.append("star_rating")
1487+
all_params.append("number_of_nights")
1488+
all_params.append("number_of_rooms")
12661489

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

0 commit comments

Comments
 (0)