From 4e1b26a8668edc831d707d76e7691eee050ea67c Mon Sep 17 00:00:00 2001 From: Aliana Melendez Date: Mon, 8 Nov 2021 14:21:35 -0500 Subject: [PATCH 1/6] Adds highlights to project response --- CHANGELOG.md | 6 + patch_api/__init__.py | 2 +- patch_api/api/estimates_api.py | 996 ++++++++---------- patch_api/api/orders_api.py | 579 +++++----- patch_api/api/preferences_api.py | 462 ++++---- patch_api/api/projects_api.py | 256 +++-- patch_api/api/technology_types_api.py | 136 ++- patch_api/api_client.py | 424 +++----- patch_api/configuration.py | 86 +- patch_api/exceptions.py | 12 +- patch_api/models/__init__.py | 17 +- patch_api/models/allocation.py | 60 +- .../models/create_bitcoin_estimate_request.py | 50 +- .../create_ethereum_estimate_request.py | 55 +- .../models/create_flight_estimate_request.py | 87 +- .../models/create_mass_estimate_request.py | 70 +- patch_api/models/create_order_request.py | 78 +- patch_api/models/create_preference_request.py | 36 +- .../create_shipping_estimate_request.py | 130 +-- patch_api/models/create_success_response.py | 50 +- .../models/create_vehicle_estimate_request.py | 96 +- patch_api/models/error_response.py | 56 +- patch_api/models/estimate.py | 70 +- patch_api/models/estimate_list_response.py | 69 +- patch_api/models/estimate_response.py | 56 +- patch_api/models/highlight.py | 153 +++ patch_api/models/meta_index_object.py | 34 +- patch_api/models/order.py | 183 +--- patch_api/models/order_list_response.py | 69 +- patch_api/models/order_response.py | 56 +- patch_api/models/parent_technology_type.py | 34 +- patch_api/models/photo.py | 42 +- patch_api/models/preference.py | 61 +- patch_api/models/preference_list_response.py | 69 +- patch_api/models/preference_response.py | 56 +- patch_api/models/project.py | 230 ++-- patch_api/models/project_list_response.py | 69 +- patch_api/models/project_response.py | 56 +- patch_api/models/sdg.py | 77 +- patch_api/models/standard.py | 64 +- patch_api/models/technology_type.py | 56 +- .../models/technology_type_list_response.py | 52 +- patch_api/rest.py | 317 ++---- setup.py | 10 +- test/test_projects_api.py | 1 + 45 files changed, 2459 insertions(+), 3169 deletions(-) create mode 100644 patch_api/models/highlight.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 8caea8c..755bfe0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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.15.2] - 2021-11-08 + +### Added + +- Adds highlights to project responses + ## [1.15.1] - 2021-11-04 ### Added diff --git a/patch_api/__init__.py b/patch_api/__init__.py index 8cf429c..aa81188 100644 --- a/patch_api/__init__.py +++ b/patch_api/__init__.py @@ -15,7 +15,7 @@ from __future__ import absolute_import -__version__ = "1.15.1" +__version__ = "1.15.2" # import ApiClient from patch_api.api_client import ApiClient diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py index 8f42f75..82539b5 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -18,7 +18,10 @@ # python 2 and python 3 compatibility library import six -from patch_api.exceptions import ApiTypeError, ApiValueError +from patch_api.exceptions import ( + ApiTypeError, + ApiValueError +) class EstimatesApi(object): @@ -29,36 +32,34 @@ class EstimatesApi(object): """ ALLOWED_QUERY_PARAMS = [ - "mass_g", - "total_price_cents_usd", - "project_id", - "page", - "distance_m", - "transportation_method", - "package_mass_g", - "create_order", - "model", - "make", - "year", - "transaction_value_btc_sats", - "transaction_value_eth_gwei", - "gas_used", - "average_daily_balance_btc_sats", - "average_daily_balance_eth_gwei", - "timestamp", - "origin_aiport", - "destination_aiport", - "aircraft_code", - "cabin_class", - "passenger_count", + "mass_g", + "total_price_cents_usd", + "project_id", + "page", + "distance_m", + "transportation_method", + "package_mass_g", + "create_order", + "model", + "make", + "year", + "transaction_value_btc_sats", + "transaction_value_eth_gwei", + "gas_used", + "average_daily_balance_btc_sats", + "average_daily_balance_eth_gwei", + "timestamp", + "origin_aiport", + "destination_aiport", + "aircraft_code", + "cabin_class", + "passenger_count" ] def __init__(self, api_client=None): self.api_client = api_client - def create_bitcoin_estimate( - self, create_bitcoin_estimate_request={}, **kwargs - ): # noqa: E501 + 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 @@ -80,14 +81,10 @@ def create_bitcoin_estimate( 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 + 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 @@ -114,51 +111,47 @@ def create_bitcoin_estimate_with_http_info( 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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + 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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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"] + 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 + 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 = {} @@ -181,46 +174,36 @@ def create_bitcoin_estimate_with_http_info( local_var_files = {} body_params = None - if "create_bitcoin_estimate_request" in local_var_params: - body_params = local_var_params["create_bitcoin_estimate_request"] + 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 + 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 + 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 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/estimates/crypto/btc", - "POST", + '/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 + 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_ethereum_estimate( - self, create_ethereum_estimate_request={}, **kwargs - ): # noqa: E501 + 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_ethereum_estimate(self, create_ethereum_estimate_request={}, **kwargs): # noqa: E501 """Create an ethereum estimate # noqa: E501 Creates an ethereum 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 @@ -242,14 +225,10 @@ def create_ethereum_estimate( If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - return self.create_ethereum_estimate_with_http_info( - create_ethereum_estimate_request, **kwargs - ) # noqa: E501 - - def create_ethereum_estimate_with_http_info( - self, create_ethereum_estimate_request, **kwargs - ): # noqa: E501 + kwargs['_return_http_data_only'] = True + return self.create_ethereum_estimate_with_http_info(create_ethereum_estimate_request, **kwargs) # noqa: E501 + + def create_ethereum_estimate_with_http_info(self, create_ethereum_estimate_request, **kwargs): # noqa: E501 """Create an ethereum estimate # noqa: E501 Creates an ethereum 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 @@ -276,51 +255,47 @@ def create_ethereum_estimate_with_http_info( local_var_params = locals() - all_params = ["create_ethereum_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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['create_ethereum_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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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_ethereum_estimate" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] # verify the required parameter 'create_ethereum_estimate_request' is set - if ( - "create_ethereum_estimate_request" not in local_var_params - or local_var_params["create_ethereum_estimate_request"] is None - ): - raise ApiValueError( - "Missing the required parameter `create_ethereum_estimate_request` when calling `create_ethereum_estimate`" - ) # noqa: E501 + if ('create_ethereum_estimate_request' not in local_var_params or + local_var_params['create_ethereum_estimate_request'] is None): + raise ApiValueError("Missing the required parameter `create_ethereum_estimate_request` when calling `create_ethereum_estimate`") # noqa: E501 collection_formats = {} @@ -343,46 +318,36 @@ def create_ethereum_estimate_with_http_info( local_var_files = {} body_params = None - if "create_ethereum_estimate_request" in local_var_params: - body_params = local_var_params["create_ethereum_estimate_request"] + if 'create_ethereum_estimate_request' in local_var_params: + body_params = local_var_params['create_ethereum_estimate_request'] # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + 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 + 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 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/estimates/crypto/eth", - "POST", + '/v1/estimates/crypto/eth', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="EstimateResponse", # noqa: E501 + 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 + 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 """Create a flight estimate given the distance traveled in meters # noqa: E501 Creates a flight 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 @@ -404,14 +369,10 @@ def create_flight_estimate( If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - return self.create_flight_estimate_with_http_info( - create_flight_estimate_request, **kwargs - ) # noqa: E501 - - def create_flight_estimate_with_http_info( - self, create_flight_estimate_request, **kwargs - ): # noqa: E501 + kwargs['_return_http_data_only'] = True + return self.create_flight_estimate_with_http_info(create_flight_estimate_request, **kwargs) # noqa: E501 + + def create_flight_estimate_with_http_info(self, create_flight_estimate_request, **kwargs): # noqa: E501 """Create a flight estimate given the distance traveled in meters # noqa: E501 Creates a flight 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 @@ -438,51 +399,47 @@ def create_flight_estimate_with_http_info( local_var_params = locals() - all_params = ["create_flight_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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['create_flight_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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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_flight_estimate" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] # verify the required parameter 'create_flight_estimate_request' is set - if ( - "create_flight_estimate_request" not in local_var_params - or local_var_params["create_flight_estimate_request"] is None - ): - raise ApiValueError( - "Missing the required parameter `create_flight_estimate_request` when calling `create_flight_estimate`" - ) # noqa: E501 + if ('create_flight_estimate_request' not in local_var_params or + local_var_params['create_flight_estimate_request'] is None): + raise ApiValueError("Missing the required parameter `create_flight_estimate_request` when calling `create_flight_estimate`") # noqa: E501 collection_formats = {} @@ -505,46 +462,36 @@ def create_flight_estimate_with_http_info( local_var_files = {} body_params = None - if "create_flight_estimate_request" in local_var_params: - body_params = local_var_params["create_flight_estimate_request"] + if 'create_flight_estimate_request' in local_var_params: + body_params = local_var_params['create_flight_estimate_request'] # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + 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 + 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 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/estimates/flight", - "POST", + '/v1/estimates/flight', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="EstimateResponse", # noqa: E501 + 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_mass_estimate( - self, create_mass_estimate_request={}, **kwargs - ): # noqa: E501 + 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_mass_estimate(self, create_mass_estimate_request={}, **kwargs): # noqa: E501 """Create an estimate based on mass of CO2 # noqa: E501 Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate. # noqa: E501 @@ -566,14 +513,10 @@ def create_mass_estimate( If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - return self.create_mass_estimate_with_http_info( - create_mass_estimate_request, **kwargs - ) # noqa: E501 - - def create_mass_estimate_with_http_info( - self, create_mass_estimate_request, **kwargs - ): # noqa: E501 + kwargs['_return_http_data_only'] = True + return self.create_mass_estimate_with_http_info(create_mass_estimate_request, **kwargs) # noqa: E501 + + def create_mass_estimate_with_http_info(self, create_mass_estimate_request, **kwargs): # noqa: E501 """Create an estimate based on mass of CO2 # noqa: E501 Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate. # noqa: E501 @@ -600,51 +543,47 @@ def create_mass_estimate_with_http_info( local_var_params = locals() - all_params = ["create_mass_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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['create_mass_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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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_mass_estimate" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] # verify the required parameter 'create_mass_estimate_request' is set - if ( - "create_mass_estimate_request" not in local_var_params - or local_var_params["create_mass_estimate_request"] is None - ): - raise ApiValueError( - "Missing the required parameter `create_mass_estimate_request` when calling `create_mass_estimate`" - ) # noqa: E501 + if ('create_mass_estimate_request' not in local_var_params or + local_var_params['create_mass_estimate_request'] is None): + raise ApiValueError("Missing the required parameter `create_mass_estimate_request` when calling `create_mass_estimate`") # noqa: E501 collection_formats = {} @@ -667,46 +606,36 @@ def create_mass_estimate_with_http_info( local_var_files = {} body_params = None - if "create_mass_estimate_request" in local_var_params: - body_params = local_var_params["create_mass_estimate_request"] + if 'create_mass_estimate_request' in local_var_params: + body_params = local_var_params['create_mass_estimate_request'] # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + 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 + 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 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/estimates/mass", - "POST", + '/v1/estimates/mass', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="EstimateResponse", # noqa: E501 + 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_shipping_estimate( - self, create_shipping_estimate_request={}, **kwargs - ): # noqa: E501 + 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_shipping_estimate(self, create_shipping_estimate_request={}, **kwargs): # noqa: E501 """Create a shipping estimate given the distance traveled in meters, package weight, and transportation method. # noqa: E501 Creates a shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters. # noqa: E501 @@ -728,14 +657,10 @@ def create_shipping_estimate( If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - return self.create_shipping_estimate_with_http_info( - create_shipping_estimate_request, **kwargs - ) # noqa: E501 - - def create_shipping_estimate_with_http_info( - self, create_shipping_estimate_request, **kwargs - ): # noqa: E501 + kwargs['_return_http_data_only'] = True + return self.create_shipping_estimate_with_http_info(create_shipping_estimate_request, **kwargs) # noqa: E501 + + def create_shipping_estimate_with_http_info(self, create_shipping_estimate_request, **kwargs): # noqa: E501 """Create a shipping estimate given the distance traveled in meters, package weight, and transportation method. # noqa: E501 Creates a shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters. # noqa: E501 @@ -762,51 +687,47 @@ def create_shipping_estimate_with_http_info( local_var_params = locals() - all_params = ["create_shipping_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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['create_shipping_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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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_shipping_estimate" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] # verify the required parameter 'create_shipping_estimate_request' is set - if ( - "create_shipping_estimate_request" not in local_var_params - or local_var_params["create_shipping_estimate_request"] is None - ): - raise ApiValueError( - "Missing the required parameter `create_shipping_estimate_request` when calling `create_shipping_estimate`" - ) # noqa: E501 + if ('create_shipping_estimate_request' not in local_var_params or + local_var_params['create_shipping_estimate_request'] is None): + raise ApiValueError("Missing the required parameter `create_shipping_estimate_request` when calling `create_shipping_estimate`") # noqa: E501 collection_formats = {} @@ -829,46 +750,36 @@ def create_shipping_estimate_with_http_info( local_var_files = {} body_params = None - if "create_shipping_estimate_request" in local_var_params: - body_params = local_var_params["create_shipping_estimate_request"] + if 'create_shipping_estimate_request' in local_var_params: + body_params = local_var_params['create_shipping_estimate_request'] # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + 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 + 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 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/estimates/shipping", - "POST", + '/v1/estimates/shipping', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="EstimateResponse", # noqa: E501 + 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_vehicle_estimate( - self, create_vehicle_estimate_request={}, **kwargs - ): # noqa: E501 + 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_vehicle_estimate(self, create_vehicle_estimate_request={}, **kwargs): # noqa: E501 """Create a vehicle estimate given the distance traveled in meters and the type of vehicle # noqa: E501 Creates an estimate and calculates the amount of CO2 to be compensated depending on the distance and the vehicle. An order in the `draft` state may be created based on the parameters, linked to the estimate. # noqa: E501 @@ -890,14 +801,10 @@ def create_vehicle_estimate( If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - return self.create_vehicle_estimate_with_http_info( - create_vehicle_estimate_request, **kwargs - ) # noqa: E501 - - def create_vehicle_estimate_with_http_info( - self, create_vehicle_estimate_request, **kwargs - ): # noqa: E501 + kwargs['_return_http_data_only'] = True + return self.create_vehicle_estimate_with_http_info(create_vehicle_estimate_request, **kwargs) # noqa: E501 + + def create_vehicle_estimate_with_http_info(self, create_vehicle_estimate_request, **kwargs): # noqa: E501 """Create a vehicle estimate given the distance traveled in meters and the type of vehicle # noqa: E501 Creates an estimate and calculates the amount of CO2 to be compensated depending on the distance and the vehicle. An order in the `draft` state may be created based on the parameters, linked to the estimate. # noqa: E501 @@ -924,51 +831,47 @@ def create_vehicle_estimate_with_http_info( local_var_params = locals() - all_params = ["create_vehicle_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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['create_vehicle_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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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_vehicle_estimate" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] # verify the required parameter 'create_vehicle_estimate_request' is set - if ( - "create_vehicle_estimate_request" not in local_var_params - or local_var_params["create_vehicle_estimate_request"] is None - ): - raise ApiValueError( - "Missing the required parameter `create_vehicle_estimate_request` when calling `create_vehicle_estimate`" - ) # noqa: E501 + if ('create_vehicle_estimate_request' not in local_var_params or + local_var_params['create_vehicle_estimate_request'] is None): + raise ApiValueError("Missing the required parameter `create_vehicle_estimate_request` when calling `create_vehicle_estimate`") # noqa: E501 collection_formats = {} @@ -991,42 +894,34 @@ def create_vehicle_estimate_with_http_info( local_var_files = {} body_params = None - if "create_vehicle_estimate_request" in local_var_params: - body_params = local_var_params["create_vehicle_estimate_request"] + if 'create_vehicle_estimate_request' in local_var_params: + body_params = local_var_params['create_vehicle_estimate_request'] # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + 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 + 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 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/estimates/vehicle", - "POST", + '/v1/estimates/vehicle', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="EstimateResponse", # noqa: E501 + 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, - ) + 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 retrieve_estimate(self, id={}, **kwargs): # noqa: E501 """Retrieves an estimate # noqa: E501 @@ -1050,7 +945,7 @@ def retrieve_estimate(self, id={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True + kwargs['_return_http_data_only'] = True return self.retrieve_estimate_with_http_info(id, **kwargs) # noqa: E501 def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 @@ -1080,54 +975,53 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] # 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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['id'] # 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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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 retrieve_estimate" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] # verify the required parameter 'id' is set - if "id" not in local_var_params or local_var_params["id"] is None: - raise ApiValueError( - "Missing the required parameter `id` when calling `retrieve_estimate`" - ) # noqa: E501 + if ('id' not in local_var_params or + local_var_params['id'] is None): + raise ApiValueError("Missing the required parameter `id` when calling `retrieve_estimate`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in local_var_params: - path_params["id"] = local_var_params["id"] # noqa: E501 + if 'id' in local_var_params: + path_params['id'] = local_var_params['id'] # noqa: E501 query_params = [] @@ -1147,32 +1041,27 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/estimates/{id}", - "GET", + '/v1/estimates/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="EstimateResponse", # noqa: E501 + 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, - ) + 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 retrieve_estimates(self, **kwargs): # noqa: E501 """Retrieves a list of estimates # noqa: E501 @@ -1196,7 +1085,7 @@ def retrieve_estimates(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True + kwargs['_return_http_data_only'] = True return self.retrieve_estimates_with_http_info(**kwargs) # noqa: E501 def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 @@ -1226,51 +1115,51 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["page"] # 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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['page'] # 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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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 retrieve_estimates" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] collection_formats = {} path_params = {} query_params = [] - if "page" in local_var_params: - query_params.append(("page", local_var_params["page"])) # noqa: E501 + 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 = [] @@ -1288,29 +1177,24 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/estimates", - "GET", + '/v1/estimates', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="EstimateListResponse", # noqa: E501 + response_type='EstimateListResponse', # 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, - ) + 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) diff --git a/patch_api/api/orders_api.py b/patch_api/api/orders_api.py index ee20417..51f9cb9 100644 --- a/patch_api/api/orders_api.py +++ b/patch_api/api/orders_api.py @@ -18,7 +18,10 @@ # python 2 and python 3 compatibility library import six -from patch_api.exceptions import ApiTypeError, ApiValueError +from patch_api.exceptions import ( + ApiTypeError, + ApiValueError +) class OrdersApi(object): @@ -29,28 +32,28 @@ class OrdersApi(object): """ ALLOWED_QUERY_PARAMS = [ - "mass_g", - "total_price_cents_usd", - "project_id", - "page", - "distance_m", - "transportation_method", - "package_mass_g", - "create_order", - "model", - "make", - "year", - "transaction_value_btc_sats", - "transaction_value_eth_gwei", - "gas_used", - "average_daily_balance_btc_sats", - "average_daily_balance_eth_gwei", - "timestamp", - "origin_aiport", - "destination_aiport", - "aircraft_code", - "cabin_class", - "passenger_count", + "mass_g", + "total_price_cents_usd", + "project_id", + "page", + "distance_m", + "transportation_method", + "package_mass_g", + "create_order", + "model", + "make", + "year", + "transaction_value_btc_sats", + "transaction_value_eth_gwei", + "gas_used", + "average_daily_balance_btc_sats", + "average_daily_balance_eth_gwei", + "timestamp", + "origin_aiport", + "destination_aiport", + "aircraft_code", + "cabin_class", + "passenger_count" ] def __init__(self, api_client=None): @@ -78,7 +81,7 @@ def cancel_order(self, id={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True + kwargs['_return_http_data_only'] = True return self.cancel_order_with_http_info(id, **kwargs) # noqa: E501 def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 @@ -108,54 +111,53 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] # 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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['id'] # 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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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 cancel_order" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] # verify the required parameter 'id' is set - if "id" not in local_var_params or local_var_params["id"] is None: - raise ApiValueError( - "Missing the required parameter `id` when calling `cancel_order`" - ) # noqa: E501 + if ('id' not in local_var_params or + local_var_params['id'] is None): + raise ApiValueError("Missing the required parameter `id` when calling `cancel_order`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in local_var_params: - path_params["id"] = local_var_params["id"] # noqa: E501 + if 'id' in local_var_params: + path_params['id'] = local_var_params['id'] # noqa: E501 query_params = [] @@ -175,32 +177,27 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/orders/{id}/cancel", - "PATCH", + '/v1/orders/{id}/cancel', 'PATCH', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="OrderResponse", # noqa: E501 + response_type='OrderResponse', # 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, - ) + 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_order(self, create_order_request={}, **kwargs): # noqa: E501 """Creates an order # noqa: E501 @@ -224,10 +221,8 @@ def create_order(self, create_order_request={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - return self.create_order_with_http_info( - create_order_request, **kwargs - ) # noqa: E501 + kwargs['_return_http_data_only'] = True + return self.create_order_with_http_info(create_order_request, **kwargs) # noqa: E501 def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: E501 """Creates an order # noqa: E501 @@ -256,51 +251,47 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: local_var_params = locals() - all_params = ["create_order_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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['create_order_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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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_order" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] # verify the required parameter 'create_order_request' is set - if ( - "create_order_request" not in local_var_params - or local_var_params["create_order_request"] is None - ): - raise ApiValueError( - "Missing the required parameter `create_order_request` when calling `create_order`" - ) # noqa: E501 + if ('create_order_request' not in local_var_params or + local_var_params['create_order_request'] is None): + raise ApiValueError("Missing the required parameter `create_order_request` when calling `create_order`") # noqa: E501 collection_formats = {} @@ -323,42 +314,34 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: local_var_files = {} body_params = None - if "create_order_request" in local_var_params: - body_params = local_var_params["create_order_request"] + if 'create_order_request' in local_var_params: + body_params = local_var_params['create_order_request'] # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + 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 + 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 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/orders", - "POST", + '/v1/orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="OrderResponse", # noqa: E501 + response_type='OrderResponse', # 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, - ) + 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 place_order(self, id={}, **kwargs): # noqa: E501 """Place an order # noqa: E501 @@ -382,7 +365,7 @@ def place_order(self, id={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True + kwargs['_return_http_data_only'] = True return self.place_order_with_http_info(id, **kwargs) # noqa: E501 def place_order_with_http_info(self, id, **kwargs): # noqa: E501 @@ -412,54 +395,53 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] # 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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['id'] # 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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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 place_order" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] # verify the required parameter 'id' is set - if "id" not in local_var_params or local_var_params["id"] is None: - raise ApiValueError( - "Missing the required parameter `id` when calling `place_order`" - ) # noqa: E501 + if ('id' not in local_var_params or + local_var_params['id'] is None): + raise ApiValueError("Missing the required parameter `id` when calling `place_order`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in local_var_params: - path_params["id"] = local_var_params["id"] # noqa: E501 + if 'id' in local_var_params: + path_params['id'] = local_var_params['id'] # noqa: E501 query_params = [] @@ -479,32 +461,27 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/orders/{id}/place", - "PATCH", + '/v1/orders/{id}/place', 'PATCH', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="OrderResponse", # noqa: E501 + response_type='OrderResponse', # 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, - ) + 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 retrieve_order(self, id={}, **kwargs): # noqa: E501 """Retrieves an order # noqa: E501 @@ -528,7 +505,7 @@ def retrieve_order(self, id={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True + kwargs['_return_http_data_only'] = True return self.retrieve_order_with_http_info(id, **kwargs) # noqa: E501 def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 @@ -558,54 +535,53 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] # 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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['id'] # 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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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 retrieve_order" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] # verify the required parameter 'id' is set - if "id" not in local_var_params or local_var_params["id"] is None: - raise ApiValueError( - "Missing the required parameter `id` when calling `retrieve_order`" - ) # noqa: E501 + if ('id' not in local_var_params or + local_var_params['id'] is None): + raise ApiValueError("Missing the required parameter `id` when calling `retrieve_order`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in local_var_params: - path_params["id"] = local_var_params["id"] # noqa: E501 + if 'id' in local_var_params: + path_params['id'] = local_var_params['id'] # noqa: E501 query_params = [] @@ -625,32 +601,27 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/orders/{id}", - "GET", + '/v1/orders/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="OrderResponse", # noqa: E501 + response_type='OrderResponse', # 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, - ) + 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 retrieve_orders(self, **kwargs): # noqa: E501 """Retrieves a list of orders # noqa: E501 @@ -677,7 +648,7 @@ def retrieve_orders(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True + kwargs['_return_http_data_only'] = True return self.retrieve_orders_with_http_info(**kwargs) # noqa: E501 def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 @@ -710,68 +681,57 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - 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") - 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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + 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') + 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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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 retrieve_orders" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] collection_formats = {} path_params = {} query_params = [] - 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 + 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 = [] @@ -789,29 +749,24 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/orders", - "GET", + '/v1/orders', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="OrderListResponse", # noqa: E501 + response_type='OrderListResponse', # 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, - ) + 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) diff --git a/patch_api/api/preferences_api.py b/patch_api/api/preferences_api.py index d6892a5..7fd2e45 100644 --- a/patch_api/api/preferences_api.py +++ b/patch_api/api/preferences_api.py @@ -18,7 +18,10 @@ # python 2 and python 3 compatibility library import six -from patch_api.exceptions import ApiTypeError, ApiValueError +from patch_api.exceptions import ( + ApiTypeError, + ApiValueError +) class PreferencesApi(object): @@ -29,28 +32,28 @@ class PreferencesApi(object): """ ALLOWED_QUERY_PARAMS = [ - "mass_g", - "total_price_cents_usd", - "project_id", - "page", - "distance_m", - "transportation_method", - "package_mass_g", - "create_order", - "model", - "make", - "year", - "transaction_value_btc_sats", - "transaction_value_eth_gwei", - "gas_used", - "average_daily_balance_btc_sats", - "average_daily_balance_eth_gwei", - "timestamp", - "origin_aiport", - "destination_aiport", - "aircraft_code", - "cabin_class", - "passenger_count", + "mass_g", + "total_price_cents_usd", + "project_id", + "page", + "distance_m", + "transportation_method", + "package_mass_g", + "create_order", + "model", + "make", + "year", + "transaction_value_btc_sats", + "transaction_value_eth_gwei", + "gas_used", + "average_daily_balance_btc_sats", + "average_daily_balance_eth_gwei", + "timestamp", + "origin_aiport", + "destination_aiport", + "aircraft_code", + "cabin_class", + "passenger_count" ] def __init__(self, api_client=None): @@ -78,14 +81,10 @@ def create_preference(self, create_preference_request={}, **kwargs): # noqa: E5 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - return self.create_preference_with_http_info( - create_preference_request, **kwargs - ) # noqa: E501 - - def create_preference_with_http_info( - self, create_preference_request, **kwargs - ): # noqa: E501 + kwargs['_return_http_data_only'] = True + return self.create_preference_with_http_info(create_preference_request, **kwargs) # noqa: E501 + + def create_preference_with_http_info(self, create_preference_request, **kwargs): # noqa: E501 """creates a project preference # noqa: E501 Creates a project preference for the given organization. If you have a `preference` in place, all of your orders will be directed to the project the preference points to. # noqa: E501 @@ -112,51 +111,47 @@ def create_preference_with_http_info( local_var_params = locals() - all_params = ["create_preference_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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['create_preference_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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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_preference" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] # verify the required parameter 'create_preference_request' is set - if ( - "create_preference_request" not in local_var_params - or local_var_params["create_preference_request"] is None - ): - raise ApiValueError( - "Missing the required parameter `create_preference_request` when calling `create_preference`" - ) # noqa: E501 + if ('create_preference_request' not in local_var_params or + local_var_params['create_preference_request'] is None): + raise ApiValueError("Missing the required parameter `create_preference_request` when calling `create_preference`") # noqa: E501 collection_formats = {} @@ -179,42 +174,34 @@ def create_preference_with_http_info( local_var_files = {} body_params = None - if "create_preference_request" in local_var_params: - body_params = local_var_params["create_preference_request"] + if 'create_preference_request' in local_var_params: + body_params = local_var_params['create_preference_request'] # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + 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 + 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 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/preferences", - "POST", + '/v1/preferences', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="PreferenceResponse", # noqa: E501 + response_type='PreferenceResponse', # 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, - ) + 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 delete_preference(self, id={}, **kwargs): # noqa: E501 """Deletes an organization's preference for a project # noqa: E501 @@ -238,7 +225,7 @@ def delete_preference(self, id={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True + kwargs['_return_http_data_only'] = True return self.delete_preference_with_http_info(id, **kwargs) # noqa: E501 def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 @@ -268,54 +255,53 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] # 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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['id'] # 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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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 delete_preference" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] # verify the required parameter 'id' is set - if "id" not in local_var_params or local_var_params["id"] is None: - raise ApiValueError( - "Missing the required parameter `id` when calling `delete_preference`" - ) # noqa: E501 + if ('id' not in local_var_params or + local_var_params['id'] is None): + raise ApiValueError("Missing the required parameter `id` when calling `delete_preference`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in local_var_params: - path_params["id"] = local_var_params["id"] # noqa: E501 + if 'id' in local_var_params: + path_params['id'] = local_var_params['id'] # noqa: E501 query_params = [] @@ -335,32 +321,27 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/preferences/{id}", - "DELETE", + '/v1/preferences/{id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="PreferenceResponse", # noqa: E501 + response_type='PreferenceResponse', # 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, - ) + 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 retrieve_preference(self, id={}, **kwargs): # noqa: E501 """Retrieve the preference # noqa: E501 @@ -384,7 +365,7 @@ def retrieve_preference(self, id={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True + kwargs['_return_http_data_only'] = True return self.retrieve_preference_with_http_info(id, **kwargs) # noqa: E501 def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 @@ -414,54 +395,53 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] # 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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['id'] # 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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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 retrieve_preference" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] # verify the required parameter 'id' is set - if "id" not in local_var_params or local_var_params["id"] is None: - raise ApiValueError( - "Missing the required parameter `id` when calling `retrieve_preference`" - ) # noqa: E501 + if ('id' not in local_var_params or + local_var_params['id'] is None): + raise ApiValueError("Missing the required parameter `id` when calling `retrieve_preference`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in local_var_params: - path_params["id"] = local_var_params["id"] # noqa: E501 + if 'id' in local_var_params: + path_params['id'] = local_var_params['id'] # noqa: E501 query_params = [] @@ -481,32 +461,27 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/preferences/{id}", - "GET", + '/v1/preferences/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="PreferenceResponse", # noqa: E501 + response_type='PreferenceResponse', # 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, - ) + 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 retrieve_preferences(self, **kwargs): # noqa: E501 """Retrieves a list of preferences # noqa: E501 @@ -530,7 +505,7 @@ def retrieve_preferences(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True + kwargs['_return_http_data_only'] = True return self.retrieve_preferences_with_http_info(**kwargs) # noqa: E501 def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 @@ -560,51 +535,51 @@ def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["page"] # 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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['page'] # 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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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 retrieve_preferences" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] collection_formats = {} path_params = {} query_params = [] - if "page" in local_var_params: - query_params.append(("page", local_var_params["page"])) # noqa: E501 + 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 = [] @@ -622,29 +597,24 @@ def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/preferences", - "GET", + '/v1/preferences', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="PreferenceListResponse", # noqa: E501 + response_type='PreferenceListResponse', # 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, - ) + 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) diff --git a/patch_api/api/projects_api.py b/patch_api/api/projects_api.py index 560e45a..8f98333 100644 --- a/patch_api/api/projects_api.py +++ b/patch_api/api/projects_api.py @@ -18,7 +18,10 @@ # python 2 and python 3 compatibility library import six -from patch_api.exceptions import ApiTypeError, ApiValueError +from patch_api.exceptions import ( + ApiTypeError, + ApiValueError +) class ProjectsApi(object): @@ -29,28 +32,28 @@ class ProjectsApi(object): """ ALLOWED_QUERY_PARAMS = [ - "mass_g", - "total_price_cents_usd", - "project_id", - "page", - "distance_m", - "transportation_method", - "package_mass_g", - "create_order", - "model", - "make", - "year", - "transaction_value_btc_sats", - "transaction_value_eth_gwei", - "gas_used", - "average_daily_balance_btc_sats", - "average_daily_balance_eth_gwei", - "timestamp", - "origin_aiport", - "destination_aiport", - "aircraft_code", - "cabin_class", - "passenger_count", + "mass_g", + "total_price_cents_usd", + "project_id", + "page", + "distance_m", + "transportation_method", + "package_mass_g", + "create_order", + "model", + "make", + "year", + "transaction_value_btc_sats", + "transaction_value_eth_gwei", + "gas_used", + "average_daily_balance_btc_sats", + "average_daily_balance_eth_gwei", + "timestamp", + "origin_aiport", + "destination_aiport", + "aircraft_code", + "cabin_class", + "passenger_count" ] def __init__(self, api_client=None): @@ -78,7 +81,7 @@ def retrieve_project(self, id={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True + kwargs['_return_http_data_only'] = True return self.retrieve_project_with_http_info(id, **kwargs) # noqa: E501 def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 @@ -108,54 +111,53 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] # 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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['id'] # 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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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 retrieve_project" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] # verify the required parameter 'id' is set - if "id" not in local_var_params or local_var_params["id"] is None: - raise ApiValueError( - "Missing the required parameter `id` when calling `retrieve_project`" - ) # noqa: E501 + if ('id' not in local_var_params or + local_var_params['id'] is None): + raise ApiValueError("Missing the required parameter `id` when calling `retrieve_project`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in local_var_params: - path_params["id"] = local_var_params["id"] # noqa: E501 + if 'id' in local_var_params: + path_params['id'] = local_var_params['id'] # noqa: E501 query_params = [] @@ -175,32 +177,27 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/projects/{id}", - "GET", + '/v1/projects/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ProjectResponse", # noqa: E501 + response_type='ProjectResponse', # 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, - ) + 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 retrieve_projects(self, **kwargs): # noqa: E501 """Retrieves a list of projects # noqa: E501 @@ -227,7 +224,7 @@ def retrieve_projects(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True + kwargs['_return_http_data_only'] = True return self.retrieve_projects_with_http_info(**kwargs) # noqa: E501 def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 @@ -260,59 +257,57 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["page", "country", "type", "minimum_available_mass"] # 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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + all_params = ['page', 'country', 'type', 'minimum_available_mass'] # 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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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 retrieve_projects" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] collection_formats = {} path_params = {} query_params = [] - if "page" in local_var_params: - query_params.append(("page", local_var_params["page"])) # noqa: E501 - if "country" in local_var_params: - query_params.append(("country", local_var_params["country"])) # noqa: E501 - if "type" in local_var_params: - query_params.append(("type", local_var_params["type"])) # noqa: E501 - if "minimum_available_mass" in local_var_params: - query_params.append( - ("minimum_available_mass", local_var_params["minimum_available_mass"]) - ) # noqa: E501 + if 'page' in local_var_params: + query_params.append(('page', local_var_params['page'])) # noqa: E501 + if 'country' in local_var_params: + query_params.append(('country', local_var_params['country'])) # noqa: E501 + if 'type' in local_var_params: + query_params.append(('type', local_var_params['type'])) # noqa: E501 + if 'minimum_available_mass' in local_var_params: + query_params.append(('minimum_available_mass', local_var_params['minimum_available_mass'])) # noqa: E501 # do not add duplicate keys to query_params list existing_keys = [] @@ -330,29 +325,24 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/projects", - "GET", + '/v1/projects', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ProjectListResponse", # noqa: E501 + response_type='ProjectListResponse', # 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, - ) + 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) diff --git a/patch_api/api/technology_types_api.py b/patch_api/api/technology_types_api.py index c34f141..caf5fbf 100644 --- a/patch_api/api/technology_types_api.py +++ b/patch_api/api/technology_types_api.py @@ -18,7 +18,10 @@ # python 2 and python 3 compatibility library import six -from patch_api.exceptions import ApiTypeError, ApiValueError +from patch_api.exceptions import ( + ApiTypeError, + ApiValueError +) class TechnologyTypesApi(object): @@ -29,28 +32,28 @@ class TechnologyTypesApi(object): """ ALLOWED_QUERY_PARAMS = [ - "mass_g", - "total_price_cents_usd", - "project_id", - "page", - "distance_m", - "transportation_method", - "package_mass_g", - "create_order", - "model", - "make", - "year", - "transaction_value_btc_sats", - "transaction_value_eth_gwei", - "gas_used", - "average_daily_balance_btc_sats", - "average_daily_balance_eth_gwei", - "timestamp", - "origin_aiport", - "destination_aiport", - "aircraft_code", - "cabin_class", - "passenger_count", + "mass_g", + "total_price_cents_usd", + "project_id", + "page", + "distance_m", + "transportation_method", + "package_mass_g", + "create_order", + "model", + "make", + "year", + "transaction_value_btc_sats", + "transaction_value_eth_gwei", + "gas_used", + "average_daily_balance_btc_sats", + "average_daily_balance_eth_gwei", + "timestamp", + "origin_aiport", + "destination_aiport", + "aircraft_code", + "cabin_class", + "passenger_count" ] def __init__(self, api_client=None): @@ -77,7 +80,7 @@ def retrieve_technology_types(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True + kwargs['_return_http_data_only'] = True return self.retrieve_technology_types_with_http_info(**kwargs) # noqa: E501 def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501 @@ -107,42 +110,42 @@ def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() all_params = [] # 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("transaction_value_eth_gwei") - all_params.append("gas_used") - all_params.append("transaction_value_btc_sats") - all_params.append("average_daily_balance_btc_sats") - all_params.append("average_daily_balance_eth_gwei") - all_params.append("timestamp") - all_params.append("origin_airport") - all_params.append("destination_airport") - all_params.append("aircraft_code") - all_params.append("cabin_class") - all_params.append("passenger_count") - - for key, val in six.iteritems(local_var_params["kwargs"]): + 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('transaction_value_eth_gwei') + all_params.append('gas_used') + all_params.append('transaction_value_btc_sats') + all_params.append('average_daily_balance_btc_sats') + all_params.append('average_daily_balance_eth_gwei') + all_params.append('timestamp') + all_params.append('origin_airport') + all_params.append('destination_airport') + all_params.append('aircraft_code') + all_params.append('cabin_class') + all_params.append('passenger_count') + + 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 retrieve_technology_types" % key ) local_var_params[key] = val - del local_var_params["kwargs"] + del local_var_params['kwargs'] collection_formats = {} @@ -166,29 +169,24 @@ def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 + auth_settings = ['bearer_auth'] # noqa: E501 return self.api_client.call_api( - "/v1/projects/technology_types", - "GET", + '/v1/projects/technology_types', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="TechnologyTypeListResponse", # noqa: E501 + response_type='TechnologyTypeListResponse', # 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, - ) + 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) diff --git a/patch_api/api_client.py b/patch_api/api_client.py index 7607491..5d00f48 100644 --- a/patch_api/api_client.py +++ b/patch_api/api_client.py @@ -59,28 +59,21 @@ class ApiClient(object): PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types NATIVE_TYPES_MAPPING = { - "int": int, - "long": int if six.PY3 else long, # noqa: F821 - "float": float, - "str": str, - "bool": bool, - "date": datetime.date, - "datetime": datetime.datetime, - "object": object, + 'int': int, + 'long': int if six.PY3 else long, # noqa: F821 + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, } _pool = None - def __init__( - self, - api_key=None, - configuration=None, - header_name=None, - header_value=None, - cookie=None, - pool_threads=1, - ): + def __init__(self, api_key=None, configuration=None, header_name=None, header_value=None, + cookie=None, pool_threads=1): if api_key is None: - raise ValueError("ApiClient must be initialized with an api_key") + raise ValueError('ApiClient must be initialized with an api_key') if configuration is None: configuration = Configuration() self.configuration = configuration @@ -92,7 +85,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = "patch-python/1.15.1" + self.user_agent = 'patch-python/1.15.2' def __del__(self): if self._pool: @@ -102,18 +95,18 @@ def __del__(self): def __getattr__(self, method): resource = { - "projects": ProjectsApi, - "orders": OrdersApi, - "preferences": PreferencesApi, - "estimates": EstimatesApi, - "technology_types": TechnologyTypesApi, + 'projects': ProjectsApi, + 'orders': OrdersApi, + 'preferences': PreferencesApi, + 'estimates': EstimatesApi, + 'technology_types': TechnologyTypesApi }[method] return resource(api_client=self) @property def pool(self): """Create thread pool on first request - avoids instantiating unused threadpool for blocking clients. + avoids instantiating unused threadpool for blocking clients. """ if self._pool is None: self._pool = ThreadPool(self.pool_threads) @@ -122,33 +115,21 @@ def pool(self): @property def user_agent(self): """User agent for this API client""" - return self.default_headers["User-Agent"] + return self.default_headers['User-Agent'] @user_agent.setter def user_agent(self, value): - self.default_headers["User-Agent"] = value + self.default_headers['User-Agent'] = value def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value def __call_api( - self, - resource_path, - method, - path_params=None, - query_params=None, - header_params=None, - body=None, - post_params=None, - files=None, - response_type=None, - auth_settings=None, - _return_http_data_only=None, - collection_formats=None, - _preload_content=True, - _request_timeout=None, - _host=None, - ): + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_type=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None, _host=None): config = self.configuration @@ -156,33 +137,36 @@ def __call_api( header_params = header_params or {} header_params.update(self.default_headers) if self.cookie: - header_params["Cookie"] = self.cookie + header_params['Cookie'] = self.cookie if header_params: header_params = self.sanitize_for_serialization(header_params) - header_params = dict( - self.parameters_to_tuples(header_params, collection_formats) - ) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) # path parameters if path_params: path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, collection_formats) + path_params = self.parameters_to_tuples(path_params, + collection_formats) for k, v in path_params: # specified safe chars, encode everything resource_path = resource_path.replace( - "{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param) + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) ) # query parameters if query_params: query_params = self.sanitize_for_serialization(query_params) - query_params = self.parameters_to_tuples(query_params, collection_formats) + query_params = self.parameters_to_tuples(query_params, + collection_formats) # post parameters if post_params or files: post_params = post_params if post_params else [] post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, collection_formats) + post_params = self.parameters_to_tuples(post_params, + collection_formats) post_params.extend(self.files_parameters(files)) # auth setting @@ -201,15 +185,10 @@ def __call_api( # perform request and return response response_data = self.request( - method, - url, - query_params=query_params, - headers=header_params, - post_params=post_params, - body=body, + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, _preload_content=_preload_content, - _request_timeout=_request_timeout, - ) + _request_timeout=_request_timeout) self.last_response = response_data @@ -222,9 +201,10 @@ def __call_api( return_data = None if _return_http_data_only: - return return_data + return (return_data) else: - return (return_data, response_data.status, response_data.getheaders()) + return (return_data, response_data.status, + response_data.getheaders()) def sanitize_for_serialization(self, obj): """Builds a JSON POST object. @@ -245,9 +225,11 @@ def sanitize_for_serialization(self, obj): elif isinstance(obj, self.PRIMITIVE_TYPES): return obj elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj] + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj) + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() @@ -259,16 +241,12 @@ def sanitize_for_serialization(self, obj): # and attributes which value is not None. # Convert attribute name to json key in # model definition for request. - obj_dict = { - obj.attribute_map[attr]: getattr(obj, attr) - for attr, _ in six.iteritems(obj.openapi_types) - if getattr(obj, attr) is not None - } + obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.openapi_types) + if getattr(obj, attr) is not None} - return { - key: self.sanitize_for_serialization(val) - for key, val in six.iteritems(obj_dict) - } + return {key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict)} def deserialize(self, response, response_type): """Deserializes response into an object. @@ -304,15 +282,15 @@ def __deserialize(self, data, klass): return None if type(klass) == str: - if klass.startswith("list["): - sub_kls = re.match(r"list\[(.*)\]", klass).group(1) - return [self.__deserialize(sub_data, sub_kls) for sub_data in data] + if klass.startswith('list['): + sub_kls = re.match(r'list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] - if klass.startswith("dict("): - sub_kls = re.match(r"dict\(([^,]*), (.*)\)", klass).group(2) - return { - k: self.__deserialize(v, sub_kls) for k, v in six.iteritems(data) - } + if klass.startswith('dict('): + sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data)} # convert str to class if klass in self.NATIVE_TYPES_MAPPING: @@ -331,25 +309,12 @@ def __deserialize(self, data, klass): else: return self.__deserialize_model(data, klass) - def call_api( - self, - resource_path, - method, - path_params=None, - query_params=None, - header_params=None, - body=None, - post_params=None, - files=None, - response_type=None, - auth_settings=None, - async_req=None, - _return_http_data_only=None, - collection_formats=None, - _preload_content=True, - _request_timeout=None, - _host=None, - ): + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, async_req=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None, _host=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -387,123 +352,80 @@ def call_api( then the method will return the response directly. """ if not async_req: - return self.__call_api( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_type, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host, - ) + return self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, files, + response_type, auth_settings, + _return_http_data_only, collection_formats, + _preload_content, _request_timeout, _host) else: - thread = self.pool.apply_async( - self.__call_api, - ( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_type, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host, - ), - ) + thread = self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, query_params, + header_params, body, + post_params, files, + response_type, auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host)) return thread - def request( - self, - method, - url, - query_params=None, - headers=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): + def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): """Makes the HTTP request using RESTClient.""" if method == "GET": - return self.rest_client.GET( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers, - ) + return self.rest_client.GET(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) elif method == "HEAD": - return self.rest_client.HEAD( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers, - ) + return self.rest_client.HEAD(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) elif method == "OPTIONS": - return self.rest_client.OPTIONS( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return self.rest_client.OPTIONS(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "POST": - return self.rest_client.POST( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return self.rest_client.POST(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "PUT": - return self.rest_client.PUT( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return self.rest_client.PUT(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "PATCH": - return self.rest_client.PATCH( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return self.rest_client.PATCH(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "DELETE": - return self.rest_client.DELETE( - url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return self.rest_client.DELETE(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) else: raise ApiValueError( "http method must be `GET`, `HEAD`, `OPTIONS`," @@ -520,23 +442,22 @@ def parameters_to_tuples(self, params, collection_formats): new_params = [] if collection_formats is None: collection_formats = {} - for k, v in ( - six.iteritems(params) if isinstance(params, dict) else params - ): # noqa: E501 + for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 if k in collection_formats: collection_format = collection_formats[k] - if collection_format == "multi": + if collection_format == 'multi': new_params.extend((k, value) for value in v) else: - if collection_format == "ssv": - delimiter = " " - elif collection_format == "tsv": - delimiter = "\t" - elif collection_format == "pipes": - delimiter = "|" + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' else: # csv is the default - delimiter = "," - new_params.append((k, delimiter.join(str(value) for value in v))) + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) else: new_params.append((k, v)) return new_params @@ -555,14 +476,13 @@ def files_parameters(self, files=None): continue file_names = v if type(v) is list else [v] for n in file_names: - with open(n, "rb") as f: + with open(n, 'rb') as f: filename = os.path.basename(f.name) filedata = f.read() - mimetype = ( - mimetypes.guess_type(filename)[0] - or "application/octet-stream" - ) - params.append(tuple([k, tuple([filename, filedata, mimetype])])) + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([k, tuple([filename, filedata, mimetype])])) return params @@ -577,10 +497,10 @@ def select_header_accept(self, accepts): accepts = [x.lower() for x in accepts] - if "application/json" in accepts: - return "application/json" + if 'application/json' in accepts: + return 'application/json' else: - return ", ".join(accepts) + return ', '.join(accepts) def select_header_content_type(self, content_types): """Returns `Content-Type` based on an array of content_types provided. @@ -589,12 +509,12 @@ def select_header_content_type(self, content_types): :return: Content-Type (e.g. application/json). """ if not content_types: - return "application/json" + return 'application/json' content_types = [x.lower() for x in content_types] - if "application/json" in content_types or "*/*" in content_types: - return "application/json" + if 'application/json' in content_types or '*/*' in content_types: + return 'application/json' else: return content_types[0] @@ -611,17 +531,17 @@ def update_params_for_auth(self, headers, querys, auth_settings): for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if not auth_setting["value"]: + if not auth_setting['value']: continue - elif auth_setting["in"] == "cookie": - headers["Cookie"] = auth_setting["value"] - elif auth_setting["in"] == "header": - headers[auth_setting["key"]] = auth_setting["value"] - elif auth_setting["in"] == "query": - querys.append((auth_setting["key"], auth_setting["value"])) + elif auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) else: raise ApiValueError( - "Authentication token must be in `query` or `header`" + 'Authentication token must be in `query` or `header`' ) def __deserialize_file(self, response): @@ -639,9 +559,8 @@ def __deserialize_file(self, response): content_disposition = response.getheader("Content-Disposition") if content_disposition: - filename = re.search( - r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition - ).group(1) + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) path = os.path.join(os.path.dirname(path), filename) with open(path, "wb") as f: @@ -679,13 +598,13 @@ def __deserialize_date(self, string): """ try: from dateutil.parser import parse - return parse(string).date() except ImportError: return string except ValueError: raise rest.ApiException( - status=0, reason="Failed to parse `{0}` as date object".format(string) + status=0, + reason="Failed to parse `{0}` as date object".format(string) ) def __deserialize_datatime(self, string): @@ -698,14 +617,16 @@ def __deserialize_datatime(self, string): """ try: from dateutil.parser import parse - return parse(string) except ImportError: return string except ValueError: raise rest.ApiException( status=0, - reason=("Failed to parse `{0}` as datetime object".format(string)), + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) ) def __deserialize_model(self, data, klass): @@ -716,23 +637,22 @@ def __deserialize_model(self, data, klass): :return: model object. """ - if not klass.openapi_types and not hasattr(klass, "get_real_child_model"): + if not klass.openapi_types and not hasattr(klass, + 'get_real_child_model'): return data kwargs = {} if klass.openapi_types is not None: for attr, attr_type in six.iteritems(klass.openapi_types): - if ( - data is not None - and klass.attribute_map[attr] in data - and isinstance(data, (list, dict)) - ): + if (data is not None and + klass.attribute_map[attr] in data and + isinstance(data, (list, dict))): value = data[klass.attribute_map[attr]] kwargs[attr] = self.__deserialize(value, attr_type) instance = klass(**kwargs) - if hasattr(instance, "get_real_child_model"): + if hasattr(instance, 'get_real_child_model'): klass_name = instance.get_real_child_model(data) if klass_name: instance = self.__deserialize(data, klass_name) diff --git a/patch_api/configuration.py b/patch_api/configuration.py index f5b53e0..0723390 100644 --- a/patch_api/configuration.py +++ b/patch_api/configuration.py @@ -56,16 +56,13 @@ class Configuration(object): _default = None - def __init__( - self, - host="https://api.patch.io", - api_key=None, - api_key_prefix=None, - username=None, - password=None, - discard_unknown_keys=False, - ): - """Constructor""" + def __init__(self, host="https://api.patch.io", + api_key=None, api_key_prefix=None, + username=None, password=None, + discard_unknown_keys=False, + ): + """Constructor + """ self.host = host """Default Base url """ @@ -101,7 +98,7 @@ def __init__( """ self.logger["package_logger"] = logging.getLogger("patch_api") self.logger["urllib3_logger"] = logging.getLogger("urllib3") - self.logger_format = "%(asctime)s %(levelname)s %(message)s" + self.logger_format = '%(asctime)s %(levelname)s %(message)s' """Log format """ self.logger_stream_handler = None @@ -149,7 +146,7 @@ def __init__( self.proxy_headers = None """Proxy headers """ - self.safe_chars_for_path_param = "" + self.safe_chars_for_path_param = '' """Safe chars for path_param """ self.retries = None @@ -163,7 +160,7 @@ def __deepcopy__(self, memo): result = cls.__new__(cls) memo[id(self)] = result for k, v in self.__dict__.items(): - if k not in ("logger", "logger_file_handler"): + if k not in ('logger', 'logger_file_handler'): setattr(result, k, copy.deepcopy(v, memo)) # shallow copy of loggers result.logger = copy.copy(self.logger) @@ -312,9 +309,9 @@ def get_basic_auth_token(self): password = "" if self.password is not None: password = self.password - return urllib3.util.make_headers(basic_auth=username + ":" + password).get( - "authorization" - ) + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') def auth_settings(self): """Gets Auth Settings dict for api client. @@ -323,11 +320,11 @@ def auth_settings(self): """ auth = {} if self.access_token is not None: - auth["bearer_auth"] = { - "type": "bearer", - "in": "header", - "key": "Authorization", - "value": "Bearer " + self.access_token, + auth['bearer_auth'] = { + 'type': 'bearer', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token } return auth @@ -336,15 +333,12 @@ def to_debug_report(self): :return: The report for debugging. """ - return ( - "Python SDK Debug Report:\n" - "OS: {env}\n" - "Python Version: {pyversion}\n" - "Version of the API: v1\n" - "SDK Package Version: 1.15.1".format( - env=sys.platform, pyversion=sys.version - ) - ) + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: v1\n"\ + "SDK Package Version: 1.15.2".\ + format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): """Gets an array of host settings @@ -353,14 +347,14 @@ def get_host_settings(self): """ return [ { - "url": "https://{defaultHost}", - "description": "No description provided", - "variables": { - "defaultHost": { - "description": "No description provided", - "default_value": "api.patch.io", + 'url': "https://{defaultHost}", + 'description': "No description provided", + 'variables': { + 'defaultHost': { + 'description': "No description provided", + 'default_value': "api.patch.io", + } } - }, } ] @@ -378,22 +372,22 @@ def get_host_from_settings(self, index, variables=None): except IndexError: raise ValueError( "Invalid index {0} when selecting the host settings. " - "Must be less than {1}".format(index, len(servers)) - ) + "Must be less than {1}".format(index, len(servers))) - url = server["url"] + url = server['url'] # go through variables and replace placeholders - for variable_name, variable in server["variables"].items(): - used_value = variables.get(variable_name, variable["default_value"]) + for variable_name, variable in server['variables'].items(): + used_value = variables.get( + variable_name, variable['default_value']) - if "enum_values" in variable and used_value not in variable["enum_values"]: + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: raise ValueError( "The variable `{0}` in the host URL has invalid value " "{1}. Must be {2}.".format( - variable_name, variables[variable_name], variable["enum_values"] - ) - ) + variable_name, variables[variable_name], + variable['enum_values'])) url = url.replace("{" + variable_name + "}", used_value) diff --git a/patch_api/exceptions.py b/patch_api/exceptions.py index 64b8229..e2bd822 100644 --- a/patch_api/exceptions.py +++ b/patch_api/exceptions.py @@ -19,8 +19,9 @@ class OpenApiException(Exception): class ApiTypeError(OpenApiException, TypeError): - def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None): - """Raises an exception for TypeErrors + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None): + """ Raises an exception for TypeErrors Args: msg (str): the exception message @@ -82,6 +83,7 @@ def __init__(self, msg, path_to_item=None): class ApiException(OpenApiException): + def __init__(self, status=None, reason=None, http_resp=None): if http_resp: self.status = http_resp.status @@ -96,9 +98,11 @@ def __init__(self, status=None, reason=None, http_resp=None): def __str__(self): """Custom error messages for exception""" - error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason) + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) if self.headers: - error_message += "HTTP response headers: {0}\n".format(self.headers) + error_message += "HTTP response headers: {0}\n".format( + self.headers) if self.body: error_message += "HTTP response body: {0}\n".format(self.body) diff --git a/patch_api/models/__init__.py b/patch_api/models/__init__.py index 1bb69c1..4b92628 100644 --- a/patch_api/models/__init__.py +++ b/patch_api/models/__init__.py @@ -16,27 +16,20 @@ # import models into model package from patch_api.models.allocation import Allocation -from patch_api.models.create_bitcoin_estimate_request import ( - CreateBitcoinEstimateRequest, -) -from patch_api.models.create_ethereum_estimate_request import ( - CreateEthereumEstimateRequest, -) +from patch_api.models.create_bitcoin_estimate_request import CreateBitcoinEstimateRequest +from patch_api.models.create_ethereum_estimate_request import CreateEthereumEstimateRequest from patch_api.models.create_flight_estimate_request import CreateFlightEstimateRequest from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest from patch_api.models.create_order_request import CreateOrderRequest from patch_api.models.create_preference_request import CreatePreferenceRequest -from patch_api.models.create_shipping_estimate_request import ( - CreateShippingEstimateRequest, -) +from patch_api.models.create_shipping_estimate_request import CreateShippingEstimateRequest from patch_api.models.create_success_response import CreateSuccessResponse -from patch_api.models.create_vehicle_estimate_request import ( - CreateVehicleEstimateRequest, -) +from patch_api.models.create_vehicle_estimate_request import CreateVehicleEstimateRequest from patch_api.models.error_response import ErrorResponse from patch_api.models.estimate import Estimate 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.meta_index_object import MetaIndexObject from patch_api.models.order import Order from patch_api.models.order_list_response import OrderListResponse diff --git a/patch_api/models/allocation.py b/patch_api/models/allocation.py index b6629ae..e37d829 100644 --- a/patch_api/models/allocation.py +++ b/patch_api/models/allocation.py @@ -33,13 +33,19 @@ class Allocation(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"id": "str", "production": "bool", "mass_g": "int"} - - attribute_map = {"id": "id", "production": "production", "mass_g": "mass_g"} - - def __init__( - self, id=None, production=None, mass_g=None, local_vars_configuration=None - ): # noqa: E501 + openapi_types = { + 'id': 'str', + 'production': 'bool', + 'mass_g': 'int' + } + + attribute_map = { + 'id': 'id', + 'production': 'production', + 'mass_g': 'mass_g' + } + + def __init__(self, id=None, production=None, mass_g=None, local_vars_configuration=None): # noqa: E501 """Allocation - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -74,9 +80,7 @@ def id(self, id): :param id: The id of this Allocation. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and id is None - ): # noqa: E501 + if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -101,12 +105,8 @@ def production(self, production): :param production: The production of this Allocation. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and production is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `production`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 + raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 self._production = production @@ -130,12 +130,8 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this Allocation. # noqa: E501 :type: int """ - if ( - self.local_vars_configuration.client_side_validation and mass_g is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and mass_g is None: # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must not be `None`") # noqa: E501 self._mass_g = mass_g @@ -146,20 +142,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/create_bitcoin_estimate_request.py b/patch_api/models/create_bitcoin_estimate_request.py index 27e11c9..c7b5fb1 100644 --- a/patch_api/models/create_bitcoin_estimate_request.py +++ b/patch_api/models/create_bitcoin_estimate_request.py @@ -34,30 +34,22 @@ class CreateBitcoinEstimateRequest(object): and the value is json key in definition. """ openapi_types = { - "timestamp": "datetime", - "transaction_value_btc_sats": "int", - "average_daily_balance_btc_sats": "int", - "project_id": "str", - "create_order": "bool", + 'timestamp': 'datetime', + 'transaction_value_btc_sats': 'int', + 'average_daily_balance_btc_sats': 'int', + 'project_id': 'str', + 'create_order': 'bool' } attribute_map = { - "timestamp": "timestamp", - "transaction_value_btc_sats": "transaction_value_btc_sats", - "average_daily_balance_btc_sats": "average_daily_balance_btc_sats", - "project_id": "project_id", - "create_order": "create_order", + 'timestamp': 'timestamp', + 'transaction_value_btc_sats': 'transaction_value_btc_sats', + 'average_daily_balance_btc_sats': 'average_daily_balance_btc_sats', + 'project_id': 'project_id', + 'create_order': 'create_order' } - def __init__( - self, - timestamp=None, - transaction_value_btc_sats=None, - average_daily_balance_btc_sats=None, - project_id=None, - create_order=False, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, timestamp=None, transaction_value_btc_sats=None, average_daily_balance_btc_sats=None, project_id=None, create_order=False, local_vars_configuration=None): # noqa: E501 """CreateBitcoinEstimateRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -188,20 +180,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/create_ethereum_estimate_request.py b/patch_api/models/create_ethereum_estimate_request.py index 6405cb8..4eddc84 100644 --- a/patch_api/models/create_ethereum_estimate_request.py +++ b/patch_api/models/create_ethereum_estimate_request.py @@ -34,33 +34,24 @@ class CreateEthereumEstimateRequest(object): and the value is json key in definition. """ openapi_types = { - "timestamp": "str", - "gas_used": "int", - "transaction_value_eth_gwei": "int", - "average_daily_balance_eth_gwei": "int", - "project_id": "str", - "create_order": "bool", + 'timestamp': 'str', + 'gas_used': 'int', + 'transaction_value_eth_gwei': 'int', + 'average_daily_balance_eth_gwei': 'int', + 'project_id': 'str', + 'create_order': 'bool' } attribute_map = { - "timestamp": "timestamp", - "gas_used": "gas_used", - "transaction_value_eth_gwei": "transaction_value_eth_gwei", - "average_daily_balance_eth_gwei": "average_daily_balance_eth_gwei", - "project_id": "project_id", - "create_order": "create_order", + 'timestamp': 'timestamp', + 'gas_used': 'gas_used', + 'transaction_value_eth_gwei': 'transaction_value_eth_gwei', + 'average_daily_balance_eth_gwei': 'average_daily_balance_eth_gwei', + 'project_id': 'project_id', + 'create_order': 'create_order' } - def __init__( - self, - timestamp=None, - gas_used=None, - transaction_value_eth_gwei=None, - average_daily_balance_eth_gwei=None, - project_id=None, - create_order=False, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, timestamp=None, gas_used=None, transaction_value_eth_gwei=None, average_daily_balance_eth_gwei=None, project_id=None, create_order=False, local_vars_configuration=None): # noqa: E501 """CreateEthereumEstimateRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -214,20 +205,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/create_flight_estimate_request.py b/patch_api/models/create_flight_estimate_request.py index c1e051d..a82382f 100644 --- a/patch_api/models/create_flight_estimate_request.py +++ b/patch_api/models/create_flight_estimate_request.py @@ -34,39 +34,28 @@ class CreateFlightEstimateRequest(object): and the value is json key in definition. """ openapi_types = { - "distance_m": "int", - "origin_airport": "str", - "destination_airport": "str", - "aircraft_code": "str", - "cabin_class": "str", - "passenger_count": "int", - "project_id": "str", - "create_order": "bool", + 'distance_m': 'int', + 'origin_airport': 'str', + 'destination_airport': 'str', + 'aircraft_code': 'str', + 'cabin_class': 'str', + 'passenger_count': 'int', + 'project_id': 'str', + 'create_order': 'bool' } attribute_map = { - "distance_m": "distance_m", - "origin_airport": "origin_airport", - "destination_airport": "destination_airport", - "aircraft_code": "aircraft_code", - "cabin_class": "cabin_class", - "passenger_count": "passenger_count", - "project_id": "project_id", - "create_order": "create_order", + 'distance_m': 'distance_m', + 'origin_airport': 'origin_airport', + 'destination_airport': 'destination_airport', + 'aircraft_code': 'aircraft_code', + 'cabin_class': 'cabin_class', + 'passenger_count': 'passenger_count', + 'project_id': 'project_id', + 'create_order': 'create_order' } - def __init__( - self, - distance_m=None, - origin_airport=None, - destination_airport=None, - aircraft_code=None, - cabin_class=None, - passenger_count=None, - project_id=None, - create_order=False, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, distance_m=None, origin_airport=None, destination_airport=None, aircraft_code=None, cabin_class=None, passenger_count=None, project_id=None, create_order=False, local_vars_configuration=None): # noqa: E501 """CreateFlightEstimateRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -109,22 +98,12 @@ def distance_m(self, distance_m): :param distance_m: The distance_m of this CreateFlightEstimateRequest. # noqa: E501 :type: int """ - if ( - self.local_vars_configuration.client_side_validation - and distance_m is not None - and distance_m > 400000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `distance_m`, must be a value less than or equal to `400000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and distance_m is not None - and distance_m < 0 - ): # noqa: E501 - raise ValueError( - "Invalid value for `distance_m`, must be a value greater than or equal to `0`" - ) # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + distance_m is not None and distance_m > 400000000): # noqa: E501 + raise ValueError("Invalid value for `distance_m`, must be a value less than or equal to `400000000`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + distance_m is not None and distance_m < 0): # noqa: E501 + raise ValueError("Invalid value for `distance_m`, must be a value greater than or equal to `0`") # noqa: E501 self._distance_m = distance_m @@ -282,20 +261,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/create_mass_estimate_request.py b/patch_api/models/create_mass_estimate_request.py index 34c1190..41a064e 100644 --- a/patch_api/models/create_mass_estimate_request.py +++ b/patch_api/models/create_mass_estimate_request.py @@ -33,21 +33,19 @@ class CreateMassEstimateRequest(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"mass_g": "int", "create_order": "bool", "project_id": "str"} + openapi_types = { + 'mass_g': 'int', + 'create_order': 'bool', + 'project_id': 'str' + } attribute_map = { - "mass_g": "mass_g", - "create_order": "create_order", - "project_id": "project_id", + 'mass_g': 'mass_g', + 'create_order': 'create_order', + 'project_id': 'project_id' } - def __init__( - self, - mass_g=None, - create_order=False, - project_id=None, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, mass_g=None, create_order=False, project_id=None, local_vars_configuration=None): # noqa: E501 """CreateMassEstimateRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -81,28 +79,14 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this CreateMassEstimateRequest. # noqa: E501 :type: int """ - if ( - self.local_vars_configuration.client_side_validation and mass_g is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must not be `None`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g > 2000000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value less than or equal to `2000000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g < 0 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value greater than or equal to `0`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and mass_g is None: # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must not be `None`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g > 2000000000): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `2000000000`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g < 0): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `0`") # noqa: E501 self._mass_g = mass_g @@ -155,20 +139,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/create_order_request.py b/patch_api/models/create_order_request.py index 098d6e7..fdfa476 100644 --- a/patch_api/models/create_order_request.py +++ b/patch_api/models/create_order_request.py @@ -34,27 +34,20 @@ class CreateOrderRequest(object): and the value is json key in definition. """ openapi_types = { - "mass_g": "int", - "total_price_cents_usd": "int", - "project_id": "str", - "metadata": "object", + 'mass_g': 'int', + 'total_price_cents_usd': 'int', + 'project_id': 'str', + 'metadata': 'object' } attribute_map = { - "mass_g": "mass_g", - "total_price_cents_usd": "total_price_cents_usd", - "project_id": "project_id", - "metadata": "metadata", + 'mass_g': 'mass_g', + 'total_price_cents_usd': 'total_price_cents_usd', + 'project_id': 'project_id', + 'metadata': 'metadata' } - def __init__( - self, - mass_g=None, - total_price_cents_usd=None, - project_id=None, - metadata=None, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, mass_g=None, total_price_cents_usd=None, project_id=None, metadata=None, local_vars_configuration=None): # noqa: E501 """CreateOrderRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -93,22 +86,12 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this CreateOrderRequest. # noqa: E501 :type: int """ - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g > 2000000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value less than or equal to `2000000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g < 0 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value greater than or equal to `0`" - ) # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g > 2000000000): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `2000000000`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g < 0): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `0`") # noqa: E501 self._mass_g = mass_g @@ -130,14 +113,9 @@ def total_price_cents_usd(self, total_price_cents_usd): :param total_price_cents_usd: The total_price_cents_usd of this CreateOrderRequest. # noqa: E501 :type: int """ - if ( - self.local_vars_configuration.client_side_validation - and total_price_cents_usd is not None - and total_price_cents_usd < 1 - ): # noqa: E501 - raise ValueError( - "Invalid value for `total_price_cents_usd`, must be a value greater than or equal to `1`" - ) # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + total_price_cents_usd is not None and total_price_cents_usd < 1): # noqa: E501 + raise ValueError("Invalid value for `total_price_cents_usd`, must be a value greater than or equal to `1`") # noqa: E501 self._total_price_cents_usd = total_price_cents_usd @@ -190,20 +168,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/create_preference_request.py b/patch_api/models/create_preference_request.py index d5e14a4..8abb43d 100644 --- a/patch_api/models/create_preference_request.py +++ b/patch_api/models/create_preference_request.py @@ -33,9 +33,13 @@ class CreatePreferenceRequest(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"project_id": "str"} + openapi_types = { + 'project_id': 'str' + } - attribute_map = {"project_id": "project_id"} + attribute_map = { + 'project_id': 'project_id' + } def __init__(self, project_id=None, local_vars_configuration=None): # noqa: E501 """CreatePreferenceRequest - a model defined in OpenAPI""" # noqa: E501 @@ -66,12 +70,8 @@ def project_id(self, project_id): :param project_id: The project_id of this CreatePreferenceRequest. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and project_id is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `project_id`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and project_id is None: # noqa: E501 + raise ValueError("Invalid value for `project_id`, must not be `None`") # noqa: E501 self._project_id = project_id @@ -82,20 +82,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/create_shipping_estimate_request.py b/patch_api/models/create_shipping_estimate_request.py index 818e3b7..163f88c 100644 --- a/patch_api/models/create_shipping_estimate_request.py +++ b/patch_api/models/create_shipping_estimate_request.py @@ -34,30 +34,22 @@ class CreateShippingEstimateRequest(object): and the value is json key in definition. """ openapi_types = { - "distance_m": "int", - "package_mass_g": "int", - "transportation_method": "str", - "project_id": "str", - "create_order": "bool", + 'distance_m': 'int', + 'package_mass_g': 'int', + 'transportation_method': 'str', + 'project_id': 'str', + 'create_order': 'bool' } attribute_map = { - "distance_m": "distance_m", - "package_mass_g": "package_mass_g", - "transportation_method": "transportation_method", - "project_id": "project_id", - "create_order": "create_order", + 'distance_m': 'distance_m', + 'package_mass_g': 'package_mass_g', + 'transportation_method': 'transportation_method', + 'project_id': 'project_id', + 'create_order': 'create_order' } - def __init__( - self, - distance_m=None, - package_mass_g=None, - transportation_method=None, - project_id=None, - create_order=False, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, distance_m=None, package_mass_g=None, transportation_method=None, project_id=None, create_order=False, local_vars_configuration=None): # noqa: E501 """CreateShippingEstimateRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -94,28 +86,14 @@ def distance_m(self, distance_m): :param distance_m: The distance_m of this CreateShippingEstimateRequest. # noqa: E501 :type: int """ - if ( - self.local_vars_configuration.client_side_validation and distance_m is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `distance_m`, must not be `None`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and distance_m is not None - and distance_m > 400000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `distance_m`, must be a value less than or equal to `400000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and distance_m is not None - and distance_m < 0 - ): # noqa: E501 - raise ValueError( - "Invalid value for `distance_m`, must be a value greater than or equal to `0`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and distance_m is None: # noqa: E501 + raise ValueError("Invalid value for `distance_m`, must not be `None`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + distance_m is not None and distance_m > 400000000): # noqa: E501 + raise ValueError("Invalid value for `distance_m`, must be a value less than or equal to `400000000`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + distance_m is not None and distance_m < 0): # noqa: E501 + raise ValueError("Invalid value for `distance_m`, must be a value greater than or equal to `0`") # noqa: E501 self._distance_m = distance_m @@ -137,29 +115,14 @@ def package_mass_g(self, package_mass_g): :param package_mass_g: The package_mass_g of this CreateShippingEstimateRequest. # noqa: E501 :type: int """ - if ( - self.local_vars_configuration.client_side_validation - and package_mass_g is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `package_mass_g`, must not be `None`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and package_mass_g is not None - and package_mass_g > 2000000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `package_mass_g`, must be a value less than or equal to `2000000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and package_mass_g is not None - and package_mass_g < 0 - ): # noqa: E501 - raise ValueError( - "Invalid value for `package_mass_g`, must be a value greater than or equal to `0`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and package_mass_g is None: # noqa: E501 + raise ValueError("Invalid value for `package_mass_g`, must not be `None`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + package_mass_g is not None and package_mass_g > 2000000000): # noqa: E501 + raise ValueError("Invalid value for `package_mass_g`, must be a value less than or equal to `2000000000`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + package_mass_g is not None and package_mass_g < 0): # noqa: E501 + raise ValueError("Invalid value for `package_mass_g`, must be a value greater than or equal to `0`") # noqa: E501 self._package_mass_g = package_mass_g @@ -181,22 +144,13 @@ def transportation_method(self, transportation_method): :param transportation_method: The transportation_method of this CreateShippingEstimateRequest. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation - and transportation_method is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `transportation_method`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and transportation_method is None: # noqa: E501 + raise ValueError("Invalid value for `transportation_method`, must not be `None`") # noqa: E501 allowed_values = ["air", "rail", "road", "sea"] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and transportation_method not in allowed_values - ): # noqa: E501 + if self.local_vars_configuration.client_side_validation and transportation_method not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `transportation_method` ({0}), must be one of {1}".format( # noqa: E501 - transportation_method, allowed_values - ) + "Invalid value for `transportation_method` ({0}), must be one of {1}" # noqa: E501 + .format(transportation_method, allowed_values) ) self._transportation_method = transportation_method @@ -250,20 +204,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/create_success_response.py b/patch_api/models/create_success_response.py index 5ba1d0f..badfc4a 100644 --- a/patch_api/models/create_success_response.py +++ b/patch_api/models/create_success_response.py @@ -33,13 +33,17 @@ class CreateSuccessResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"success": "bool", "error": "object"} + openapi_types = { + 'success': 'bool', + 'error': 'object' + } - attribute_map = {"success": "success", "error": "error"} + attribute_map = { + 'success': 'success', + 'error': 'error' + } - def __init__( - self, success=None, error=None, local_vars_configuration=None - ): # noqa: E501 + def __init__(self, success=None, error=None, local_vars_configuration=None): # noqa: E501 """CreateSuccessResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -70,12 +74,8 @@ def success(self, success): :param success: The success of this CreateSuccessResponse. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 self._success = success @@ -97,12 +97,8 @@ def error(self, error): :param error: The error of this CreateSuccessResponse. # noqa: E501 :type: object """ - if ( - self.local_vars_configuration.client_side_validation and error is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `error`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and error is None: # noqa: E501 + raise ValueError("Invalid value for `error`, must not be `None`") # noqa: E501 self._error = error @@ -113,20 +109,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/create_vehicle_estimate_request.py b/patch_api/models/create_vehicle_estimate_request.py index baa2e5b..72505fc 100644 --- a/patch_api/models/create_vehicle_estimate_request.py +++ b/patch_api/models/create_vehicle_estimate_request.py @@ -34,33 +34,24 @@ class CreateVehicleEstimateRequest(object): and the value is json key in definition. """ openapi_types = { - "distance_m": "int", - "make": "str", - "model": "str", - "year": "int", - "project_id": "str", - "create_order": "bool", + 'distance_m': 'int', + 'make': 'str', + 'model': 'str', + 'year': 'int', + 'project_id': 'str', + 'create_order': 'bool' } attribute_map = { - "distance_m": "distance_m", - "make": "make", - "model": "model", - "year": "year", - "project_id": "project_id", - "create_order": "create_order", + 'distance_m': 'distance_m', + 'make': 'make', + 'model': 'model', + 'year': 'year', + 'project_id': 'project_id', + 'create_order': 'create_order' } - def __init__( - self, - distance_m=None, - make=None, - model=None, - year=None, - project_id=None, - create_order=False, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, distance_m=None, make=None, model=None, year=None, project_id=None, create_order=False, local_vars_configuration=None): # noqa: E501 """CreateVehicleEstimateRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -99,28 +90,14 @@ def distance_m(self, distance_m): :param distance_m: The distance_m of this CreateVehicleEstimateRequest. # noqa: E501 :type: int """ - if ( - self.local_vars_configuration.client_side_validation and distance_m is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `distance_m`, must not be `None`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and distance_m is not None - and distance_m > 400000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `distance_m`, must be a value less than or equal to `400000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and distance_m is not None - and distance_m < 0 - ): # noqa: E501 - raise ValueError( - "Invalid value for `distance_m`, must be a value greater than or equal to `0`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and distance_m is None: # noqa: E501 + raise ValueError("Invalid value for `distance_m`, must not be `None`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + distance_m is not None and distance_m > 400000000): # noqa: E501 + raise ValueError("Invalid value for `distance_m`, must be a value less than or equal to `400000000`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + distance_m is not None and distance_m < 0): # noqa: E501 + raise ValueError("Invalid value for `distance_m`, must be a value greater than or equal to `0`") # noqa: E501 self._distance_m = distance_m @@ -184,14 +161,9 @@ def year(self, year): :param year: The year of this CreateVehicleEstimateRequest. # noqa: E501 :type: int """ - if ( - self.local_vars_configuration.client_side_validation - and year is not None - and year < 1900 - ): # noqa: E501 - raise ValueError( - "Invalid value for `year`, must be a value greater than or equal to `1900`" - ) # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + year is not None and year < 1900): # noqa: E501 + raise ValueError("Invalid value for `year`, must be a value greater than or equal to `1900`") # noqa: E501 self._year = year @@ -244,20 +216,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/error_response.py b/patch_api/models/error_response.py index 8303054..efb6ee8 100644 --- a/patch_api/models/error_response.py +++ b/patch_api/models/error_response.py @@ -33,13 +33,19 @@ class ErrorResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"success": "bool", "error": "object", "data": "object"} - - attribute_map = {"success": "success", "error": "error", "data": "data"} - - def __init__( - self, success=None, error=None, data=None, local_vars_configuration=None - ): # noqa: E501 + openapi_types = { + 'success': 'bool', + 'error': 'object', + 'data': 'object' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data' + } + + def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 """ErrorResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -72,12 +78,8 @@ def success(self, success): :param success: The success of this ErrorResponse. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 self._success = success @@ -99,12 +101,8 @@ def error(self, error): :param error: The error of this ErrorResponse. # noqa: E501 :type: object """ - if ( - self.local_vars_configuration.client_side_validation and error is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `error`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and error is None: # noqa: E501 + raise ValueError("Invalid value for `error`, must not be `None`") # noqa: E501 self._error = error @@ -136,20 +134,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/estimate.py b/patch_api/models/estimate.py index 3792db3..1ef336d 100644 --- a/patch_api/models/estimate.py +++ b/patch_api/models/estimate.py @@ -34,30 +34,22 @@ class Estimate(object): and the value is json key in definition. """ openapi_types = { - "id": "str", - "production": "bool", - "type": "str", - "mass_g": "int", - "order": "Order", + 'id': 'str', + 'production': 'bool', + 'type': 'str', + 'mass_g': 'int', + 'order': 'Order' } attribute_map = { - "id": "id", - "production": "production", - "type": "type", - "mass_g": "mass_g", - "order": "order", + 'id': 'id', + 'production': 'production', + 'type': 'type', + 'mass_g': 'mass_g', + 'order': 'order' } - def __init__( - self, - id=None, - production=None, - type=None, - mass_g=None, - order=None, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, id=None, production=None, type=None, mass_g=None, order=None, local_vars_configuration=None): # noqa: E501 """Estimate - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -97,9 +89,7 @@ def id(self, id): :param id: The id of this Estimate. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and id is None - ): # noqa: E501 + if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -124,12 +114,8 @@ def production(self, production): :param production: The production of this Estimate. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and production is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `production`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 + raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 self._production = production @@ -153,12 +139,8 @@ def type(self, type): :param type: The type of this Estimate. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and type is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `type`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501 + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 self._type = type @@ -215,20 +197,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/estimate_list_response.py b/patch_api/models/estimate_list_response.py index ccb0a68..1b42b43 100644 --- a/patch_api/models/estimate_list_response.py +++ b/patch_api/models/estimate_list_response.py @@ -34,27 +34,20 @@ class EstimateListResponse(object): and the value is json key in definition. """ openapi_types = { - "success": "bool", - "error": "object", - "data": "list[Estimate]", - "meta": "MetaIndexObject", + 'success': 'bool', + 'error': 'object', + 'data': 'list[Estimate]', + 'meta': 'MetaIndexObject' } attribute_map = { - "success": "success", - "error": "error", - "data": "data", - "meta": "meta", + 'success': 'success', + 'error': 'error', + 'data': 'data', + 'meta': 'meta' } - def __init__( - self, - success=None, - error=None, - data=None, - meta=None, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 """EstimateListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -89,12 +82,8 @@ def success(self, success): :param success: The success of this EstimateListResponse. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 self._success = success @@ -137,12 +126,8 @@ def data(self, data): :param data: The data of this EstimateListResponse. # noqa: E501 :type: list[Estimate] """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 self._data = data @@ -164,12 +149,8 @@ def meta(self, meta): :param meta: The meta of this EstimateListResponse. # noqa: E501 :type: MetaIndexObject """ - if ( - self.local_vars_configuration.client_side_validation and meta is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `meta`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 + raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 self._meta = meta @@ -180,20 +161,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/estimate_response.py b/patch_api/models/estimate_response.py index f15ac7c..bee841e 100644 --- a/patch_api/models/estimate_response.py +++ b/patch_api/models/estimate_response.py @@ -33,13 +33,19 @@ class EstimateResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"success": "bool", "error": "object", "data": "Estimate"} - - attribute_map = {"success": "success", "error": "error", "data": "data"} - - def __init__( - self, success=None, error=None, data=None, local_vars_configuration=None - ): # noqa: E501 + openapi_types = { + 'success': 'bool', + 'error': 'object', + 'data': 'Estimate' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data' + } + + def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 """EstimateResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -72,12 +78,8 @@ def success(self, success): :param success: The success of this EstimateResponse. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 self._success = success @@ -120,12 +122,8 @@ def data(self, data): :param data: The data of this EstimateResponse. # noqa: E501 :type: Estimate """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 self._data = data @@ -136,20 +134,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/highlight.py b/patch_api/models/highlight.py new file mode 100644 index 0000000..e7eec9e --- /dev/null +++ b/patch_api/models/highlight.py @@ -0,0 +1,153 @@ +# coding: utf-8 + +""" + Patch API V1 + + The core API used to integrate with Patch's service # noqa: E501 + + The version of the OpenAPI document: v1 + Contact: developers@usepatch.com + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from patch_api.configuration import Configuration + + +class Highlight(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'slug': 'str', + 'title': 'str' + } + + attribute_map = { + 'slug': 'slug', + 'title': 'title' + } + + def __init__(self, slug=None, title=None, local_vars_configuration=None): # noqa: E501 + """Highlight - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._slug = None + self._title = None + self.discriminator = None + + self.slug = slug + self.title = title + + @property + def slug(self): + """Gets the slug of this Highlight. # noqa: E501 + + A unique identifier for each highlight # noqa: E501 + + :return: The slug of this Highlight. # noqa: E501 + :rtype: str + """ + return self._slug + + @slug.setter + def slug(self, slug): + """Sets the slug of this Highlight. + + A unique identifier for each highlight # noqa: E501 + + :param slug: The slug of this Highlight. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and slug is None: # noqa: E501 + raise ValueError("Invalid value for `slug`, must not be `None`") # noqa: E501 + + self._slug = slug + + @property + def title(self): + """Gets the title of this Highlight. # noqa: E501 + + A short string that spotlights a characteristic about the project. # noqa: E501 + + :return: The title of this Highlight. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this Highlight. + + A short string that spotlights a characteristic about the project. # noqa: E501 + + :param title: The title of this Highlight. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and title is None: # noqa: E501 + raise ValueError("Invalid value for `title`, must not be `None`") # noqa: E501 + + self._title = title + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Highlight): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, Highlight): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/meta_index_object.py b/patch_api/models/meta_index_object.py index cbc5313..5de83d5 100644 --- a/patch_api/models/meta_index_object.py +++ b/patch_api/models/meta_index_object.py @@ -33,13 +33,17 @@ class MetaIndexObject(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"prev_page": "int", "next_page": "int"} + openapi_types = { + 'prev_page': 'int', + 'next_page': 'int' + } - attribute_map = {"prev_page": "prev_page", "next_page": "next_page"} + attribute_map = { + 'prev_page': 'prev_page', + 'next_page': 'next_page' + } - def __init__( - self, prev_page=None, next_page=None, local_vars_configuration=None - ): # noqa: E501 + def __init__(self, prev_page=None, next_page=None, local_vars_configuration=None): # noqa: E501 """MetaIndexObject - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -101,20 +105,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/order.py b/patch_api/models/order.py index fcf8ed5..a17da53 100644 --- a/patch_api/models/order.py +++ b/patch_api/models/order.py @@ -34,48 +34,34 @@ class Order(object): and the value is json key in definition. """ openapi_types = { - "id": "str", - "created_at": "datetime", - "mass_g": "int", - "production": "bool", - "state": "str", - "allocation_state": "str", - "price_cents_usd": "int", - "patch_fee_cents_usd": "int", - "allocations": "list[Allocation]", - "registry_url": "str", - "metadata": "object", + 'id': 'str', + 'created_at': 'datetime', + 'mass_g': 'int', + 'production': 'bool', + 'state': 'str', + 'allocation_state': 'str', + 'price_cents_usd': 'int', + 'patch_fee_cents_usd': 'int', + 'allocations': 'list[Allocation]', + 'registry_url': 'str', + 'metadata': 'object' } attribute_map = { - "id": "id", - "created_at": "created_at", - "mass_g": "mass_g", - "production": "production", - "state": "state", - "allocation_state": "allocation_state", - "price_cents_usd": "price_cents_usd", - "patch_fee_cents_usd": "patch_fee_cents_usd", - "allocations": "allocations", - "registry_url": "registry_url", - "metadata": "metadata", + 'id': 'id', + 'created_at': 'created_at', + 'mass_g': 'mass_g', + 'production': 'production', + 'state': 'state', + 'allocation_state': 'allocation_state', + 'price_cents_usd': 'price_cents_usd', + 'patch_fee_cents_usd': 'patch_fee_cents_usd', + 'allocations': 'allocations', + 'registry_url': 'registry_url', + 'metadata': 'metadata' } - def __init__( - self, - id=None, - created_at=None, - mass_g=None, - production=None, - state=None, - allocation_state=None, - price_cents_usd=None, - patch_fee_cents_usd=None, - allocations=None, - registry_url=None, - metadata=None, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, id=None, created_at=None, mass_g=None, production=None, state=None, allocation_state=None, price_cents_usd=None, patch_fee_cents_usd=None, allocations=None, registry_url=None, metadata=None, local_vars_configuration=None): # noqa: E501 """Order - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -128,9 +114,7 @@ def id(self, id): :param id: The id of this Order. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and id is None - ): # noqa: E501 + if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -178,28 +162,14 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this Order. # noqa: E501 :type: int """ - if ( - self.local_vars_configuration.client_side_validation and mass_g is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must not be `None`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g > 2000000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value less than or equal to `2000000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g < 0 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value greater than or equal to `0`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and mass_g is None: # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must not be `None`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g > 2000000000): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `2000000000`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g < 0): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `0`") # noqa: E501 self._mass_g = mass_g @@ -223,12 +193,8 @@ def production(self, production): :param production: The production of this Order. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and production is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `production`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 + raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 self._production = production @@ -252,27 +218,13 @@ def state(self, state): :param state: The state of this Order. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and state is None - ): # noqa: E501 + if self.local_vars_configuration.client_side_validation and state is None: # noqa: E501 + raise ValueError("Invalid value for `state`, must not be `None`") # noqa: E501 + allowed_values = ["draft", "placed", "processing", "complete", "cancelled"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and state not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `state`, must not be `None`" - ) # noqa: E501 - allowed_values = [ - "draft", - "placed", - "processing", - "complete", - "cancelled", - ] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and state not in allowed_values - ): # noqa: E501 - raise ValueError( - "Invalid value for `state` ({0}), must be one of {1}".format( # noqa: E501 - state, allowed_values - ) + "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 + .format(state, allowed_values) ) self._state = state @@ -297,22 +249,13 @@ def allocation_state(self, allocation_state): :param allocation_state: The allocation_state of this Order. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation - and allocation_state is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `allocation_state`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and allocation_state is None: # noqa: E501 + raise ValueError("Invalid value for `allocation_state`, must not be `None`") # noqa: E501 allowed_values = ["pending", "partially_allocated", "allocated"] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and allocation_state not in allowed_values - ): # noqa: E501 + if self.local_vars_configuration.client_side_validation and allocation_state not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `allocation_state` ({0}), must be one of {1}".format( # noqa: E501 - allocation_state, allowed_values - ) + "Invalid value for `allocation_state` ({0}), must be one of {1}" # noqa: E501 + .format(allocation_state, allowed_values) ) self._allocation_state = allocation_state @@ -383,12 +326,8 @@ def allocations(self, allocations): :param allocations: The allocations of this Order. # noqa: E501 :type: list[Allocation] """ - if ( - self.local_vars_configuration.client_side_validation and allocations is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `allocations`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and allocations is None: # noqa: E501 + raise ValueError("Invalid value for `allocations`, must not be `None`") # noqa: E501 self._allocations = allocations @@ -435,12 +374,8 @@ def metadata(self, metadata): :param metadata: The metadata of this Order. # noqa: E501 :type: object """ - if ( - self.local_vars_configuration.client_side_validation and metadata is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `metadata`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and metadata is None: # noqa: E501 + raise ValueError("Invalid value for `metadata`, must not be `None`") # noqa: E501 self._metadata = metadata @@ -451,20 +386,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/order_list_response.py b/patch_api/models/order_list_response.py index a558841..d9c6b4c 100644 --- a/patch_api/models/order_list_response.py +++ b/patch_api/models/order_list_response.py @@ -34,27 +34,20 @@ class OrderListResponse(object): and the value is json key in definition. """ openapi_types = { - "success": "bool", - "error": "object", - "data": "list[Order]", - "meta": "MetaIndexObject", + 'success': 'bool', + 'error': 'object', + 'data': 'list[Order]', + 'meta': 'MetaIndexObject' } attribute_map = { - "success": "success", - "error": "error", - "data": "data", - "meta": "meta", + 'success': 'success', + 'error': 'error', + 'data': 'data', + 'meta': 'meta' } - def __init__( - self, - success=None, - error=None, - data=None, - meta=None, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 """OrderListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -89,12 +82,8 @@ def success(self, success): :param success: The success of this OrderListResponse. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 self._success = success @@ -137,12 +126,8 @@ def data(self, data): :param data: The data of this OrderListResponse. # noqa: E501 :type: list[Order] """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 self._data = data @@ -164,12 +149,8 @@ def meta(self, meta): :param meta: The meta of this OrderListResponse. # noqa: E501 :type: MetaIndexObject """ - if ( - self.local_vars_configuration.client_side_validation and meta is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `meta`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 + raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 self._meta = meta @@ -180,20 +161,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/order_response.py b/patch_api/models/order_response.py index 971e9a1..ffc9f94 100644 --- a/patch_api/models/order_response.py +++ b/patch_api/models/order_response.py @@ -33,13 +33,19 @@ class OrderResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"success": "bool", "error": "object", "data": "Order"} - - attribute_map = {"success": "success", "error": "error", "data": "data"} - - def __init__( - self, success=None, error=None, data=None, local_vars_configuration=None - ): # noqa: E501 + openapi_types = { + 'success': 'bool', + 'error': 'object', + 'data': 'Order' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data' + } + + def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 """OrderResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -72,12 +78,8 @@ def success(self, success): :param success: The success of this OrderResponse. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 self._success = success @@ -120,12 +122,8 @@ def data(self, data): :param data: The data of this OrderResponse. # noqa: E501 :type: Order """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 self._data = data @@ -136,20 +134,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/parent_technology_type.py b/patch_api/models/parent_technology_type.py index 8b94940..3ebccce 100644 --- a/patch_api/models/parent_technology_type.py +++ b/patch_api/models/parent_technology_type.py @@ -33,13 +33,17 @@ class ParentTechnologyType(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"slug": "str", "name": "str"} + openapi_types = { + 'slug': 'str', + 'name': 'str' + } - attribute_map = {"slug": "slug", "name": "name"} + attribute_map = { + 'slug': 'slug', + 'name': 'name' + } - def __init__( - self, slug=None, name=None, local_vars_configuration=None - ): # noqa: E501 + def __init__(self, slug=None, name=None, local_vars_configuration=None): # noqa: E501 """ParentTechnologyType - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -107,20 +111,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/photo.py b/patch_api/models/photo.py index 65be8bc..7716e55 100644 --- a/patch_api/models/photo.py +++ b/patch_api/models/photo.py @@ -33,9 +33,15 @@ class Photo(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"url": "str", "id": "str"} + openapi_types = { + 'url': 'str', + 'id': 'str' + } - attribute_map = {"url": "url", "id": "id"} + attribute_map = { + 'url': 'url', + 'id': 'id' + } def __init__(self, url=None, id=None, local_vars_configuration=None): # noqa: E501 """Photo - a model defined in OpenAPI""" # noqa: E501 @@ -68,12 +74,8 @@ def url(self, url): :param url: The url of this Photo. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and url is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `url`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and url is None: # noqa: E501 + raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 self._url = url @@ -95,9 +97,7 @@ def id(self, id): :param id: The id of this Photo. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and id is None - ): # noqa: E501 + if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -109,20 +109,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/preference.py b/patch_api/models/preference.py index ad87aa0..ff30fc6 100644 --- a/patch_api/models/preference.py +++ b/patch_api/models/preference.py @@ -33,21 +33,19 @@ class Preference(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"id": "str", "allocation_percentage": "int", "project": "Project"} + openapi_types = { + 'id': 'str', + 'allocation_percentage': 'int', + 'project': 'Project' + } attribute_map = { - "id": "id", - "allocation_percentage": "allocation_percentage", - "project": "project", + 'id': 'id', + 'allocation_percentage': 'allocation_percentage', + 'project': 'project' } - def __init__( - self, - id=None, - allocation_percentage=None, - project=None, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, id=None, allocation_percentage=None, project=None, local_vars_configuration=None): # noqa: E501 """Preference - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -82,9 +80,7 @@ def id(self, id): :param id: The id of this Preference. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and id is None - ): # noqa: E501 + if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -109,13 +105,8 @@ def allocation_percentage(self, allocation_percentage): :param allocation_percentage: The allocation_percentage of this Preference. # noqa: E501 :type: int """ - if ( - self.local_vars_configuration.client_side_validation - and allocation_percentage is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `allocation_percentage`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and allocation_percentage is None: # noqa: E501 + raise ValueError("Invalid value for `allocation_percentage`, must not be `None`") # noqa: E501 self._allocation_percentage = allocation_percentage @@ -139,12 +130,8 @@ def project(self, project): :param project: The project of this Preference. # noqa: E501 :type: Project """ - if ( - self.local_vars_configuration.client_side_validation and project is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `project`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and project is None: # noqa: E501 + raise ValueError("Invalid value for `project`, must not be `None`") # noqa: E501 self._project = project @@ -155,20 +142,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/preference_list_response.py b/patch_api/models/preference_list_response.py index 0e06bef..7ed2d12 100644 --- a/patch_api/models/preference_list_response.py +++ b/patch_api/models/preference_list_response.py @@ -34,27 +34,20 @@ class PreferenceListResponse(object): and the value is json key in definition. """ openapi_types = { - "success": "bool", - "error": "object", - "data": "list[Preference]", - "meta": "MetaIndexObject", + 'success': 'bool', + 'error': 'object', + 'data': 'list[Preference]', + 'meta': 'MetaIndexObject' } attribute_map = { - "success": "success", - "error": "error", - "data": "data", - "meta": "meta", + 'success': 'success', + 'error': 'error', + 'data': 'data', + 'meta': 'meta' } - def __init__( - self, - success=None, - error=None, - data=None, - meta=None, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 """PreferenceListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -89,12 +82,8 @@ def success(self, success): :param success: The success of this PreferenceListResponse. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 self._success = success @@ -137,12 +126,8 @@ def data(self, data): :param data: The data of this PreferenceListResponse. # noqa: E501 :type: list[Preference] """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 self._data = data @@ -164,12 +149,8 @@ def meta(self, meta): :param meta: The meta of this PreferenceListResponse. # noqa: E501 :type: MetaIndexObject """ - if ( - self.local_vars_configuration.client_side_validation and meta is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `meta`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 + raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 self._meta = meta @@ -180,20 +161,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/preference_response.py b/patch_api/models/preference_response.py index 73d5fc4..4fa0965 100644 --- a/patch_api/models/preference_response.py +++ b/patch_api/models/preference_response.py @@ -33,13 +33,19 @@ class PreferenceResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"success": "bool", "error": "object", "data": "Preference"} - - attribute_map = {"success": "success", "error": "error", "data": "data"} - - def __init__( - self, success=None, error=None, data=None, local_vars_configuration=None - ): # noqa: E501 + openapi_types = { + 'success': 'bool', + 'error': 'object', + 'data': 'Preference' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data' + } + + def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 """PreferenceResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -72,12 +78,8 @@ def success(self, success): :param success: The success of this PreferenceResponse. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 self._success = success @@ -120,12 +122,8 @@ def data(self, data): :param data: The data of this PreferenceResponse. # noqa: E501 :type: Preference """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 self._data = data @@ -136,20 +134,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/project.py b/patch_api/models/project.py index eea2f86..48e69a7 100644 --- a/patch_api/models/project.py +++ b/patch_api/models/project.py @@ -34,72 +34,52 @@ class Project(object): and the value is json key in definition. """ openapi_types = { - "id": "str", - "production": "bool", - "name": "str", - "description": "str", - "type": "str", - "mechanism": "str", - "country": "str", - "state": "str", - "latitude": "float", - "longitude": "float", - "developer": "str", - "photos": "list[Photo]", - "average_price_per_tonne_cents_usd": "int", - "remaining_mass_g": "int", - "verifier": "str", - "standard": "Standard", - "sdgs": "list[Sdg]", - "tagline": "str", - "technology_type": "TechnologyType", + 'id': 'str', + 'production': 'bool', + 'name': 'str', + 'description': 'str', + 'type': 'str', + 'mechanism': 'str', + 'country': 'str', + 'state': 'str', + 'latitude': 'float', + 'longitude': 'float', + 'developer': 'str', + 'photos': 'list[Photo]', + 'average_price_per_tonne_cents_usd': 'int', + 'remaining_mass_g': 'int', + 'verifier': 'str', + 'standard': 'Standard', + 'sdgs': 'list[Sdg]', + 'tagline': 'str', + 'technology_type': 'TechnologyType', + 'highlights': 'list[Highlight]' } attribute_map = { - "id": "id", - "production": "production", - "name": "name", - "description": "description", - "type": "type", - "mechanism": "mechanism", - "country": "country", - "state": "state", - "latitude": "latitude", - "longitude": "longitude", - "developer": "developer", - "photos": "photos", - "average_price_per_tonne_cents_usd": "average_price_per_tonne_cents_usd", - "remaining_mass_g": "remaining_mass_g", - "verifier": "verifier", - "standard": "standard", - "sdgs": "sdgs", - "tagline": "tagline", - "technology_type": "technology_type", + 'id': 'id', + 'production': 'production', + 'name': 'name', + 'description': 'description', + 'type': 'type', + 'mechanism': 'mechanism', + 'country': 'country', + 'state': 'state', + 'latitude': 'latitude', + 'longitude': 'longitude', + 'developer': 'developer', + 'photos': 'photos', + 'average_price_per_tonne_cents_usd': 'average_price_per_tonne_cents_usd', + 'remaining_mass_g': 'remaining_mass_g', + 'verifier': 'verifier', + 'standard': 'standard', + 'sdgs': 'sdgs', + 'tagline': 'tagline', + 'technology_type': 'technology_type', + 'highlights': 'highlights' } - def __init__( - self, - id=None, - production=None, - name=None, - description=None, - type=None, - mechanism=None, - country=None, - state=None, - latitude=None, - longitude=None, - developer=None, - photos=None, - average_price_per_tonne_cents_usd=None, - remaining_mass_g=None, - verifier=None, - standard=None, - sdgs=None, - tagline=None, - technology_type=None, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, id=None, production=None, name=None, description=None, type=None, mechanism=None, country=None, state=None, latitude=None, longitude=None, developer=None, photos=None, average_price_per_tonne_cents_usd=None, remaining_mass_g=None, verifier=None, standard=None, sdgs=None, tagline=None, technology_type=None, highlights=None, local_vars_configuration=None): # noqa: E501 """Project - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -124,6 +104,7 @@ def __init__( self._sdgs = None self._tagline = None self._technology_type = None + self._highlights = None self.discriminator = None self.id = id @@ -149,6 +130,7 @@ def __init__( if tagline is not None: self.tagline = tagline self.technology_type = technology_type + self.highlights = highlights @property def id(self): @@ -170,9 +152,7 @@ def id(self, id): :param id: The id of this Project. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and id is None - ): # noqa: E501 + if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -197,12 +177,8 @@ def production(self, production): :param production: The production of this Project. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and production is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `production`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 + raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 self._production = production @@ -226,12 +202,8 @@ def name(self, name): :param name: The name of this Project. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and name is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501 + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -255,12 +227,8 @@ def description(self, description): :param description: The description of this Project. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and description is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `description`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and description is None: # noqa: E501 + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 self._description = description @@ -308,14 +276,10 @@ def mechanism(self, mechanism): :type: str """ allowed_values = ["removal", "avoidance"] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and mechanism not in allowed_values - ): # noqa: E501 + if self.local_vars_configuration.client_side_validation and mechanism not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `mechanism` ({0}), must be one of {1}".format( # noqa: E501 - mechanism, allowed_values - ) + "Invalid value for `mechanism` ({0}), must be one of {1}" # noqa: E501 + .format(mechanism, allowed_values) ) self._mechanism = mechanism @@ -340,12 +304,8 @@ def country(self, country): :param country: The country of this Project. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and country is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `country`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and country is None: # noqa: E501 + raise ValueError("Invalid value for `country`, must not be `None`") # noqa: E501 self._country = country @@ -438,12 +398,8 @@ def developer(self, developer): :param developer: The developer of this Project. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and developer is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `developer`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and developer is None: # noqa: E501 + raise ValueError("Invalid value for `developer`, must not be `None`") # noqa: E501 self._developer = developer @@ -490,13 +446,8 @@ def average_price_per_tonne_cents_usd(self, average_price_per_tonne_cents_usd): :param average_price_per_tonne_cents_usd: The average_price_per_tonne_cents_usd of this Project. # noqa: E501 :type: int """ - if ( - self.local_vars_configuration.client_side_validation - and average_price_per_tonne_cents_usd is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `average_price_per_tonne_cents_usd`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and average_price_per_tonne_cents_usd is None: # noqa: E501 + raise ValueError("Invalid value for `average_price_per_tonne_cents_usd`, must not be `None`") # noqa: E501 self._average_price_per_tonne_cents_usd = average_price_per_tonne_cents_usd @@ -520,13 +471,8 @@ def remaining_mass_g(self, remaining_mass_g): :param remaining_mass_g: The remaining_mass_g of this Project. # noqa: E501 :type: int """ - if ( - self.local_vars_configuration.client_side_validation - and remaining_mass_g is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `remaining_mass_g`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and remaining_mass_g is None: # noqa: E501 + raise ValueError("Invalid value for `remaining_mass_g`, must not be `None`") # noqa: E501 self._remaining_mass_g = remaining_mass_g @@ -640,16 +586,36 @@ def technology_type(self, technology_type): :param technology_type: The technology_type of this Project. # noqa: E501 :type: TechnologyType """ - if ( - self.local_vars_configuration.client_side_validation - and technology_type is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `technology_type`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and technology_type is None: # noqa: E501 + raise ValueError("Invalid value for `technology_type`, must not be `None`") # noqa: E501 self._technology_type = technology_type + @property + def highlights(self): + """Gets the highlights of this Project. # noqa: E501 + + An array of objects containing the highlight's slug and title. A highlight's title is a short string that spotlights a characteristic about the project. # noqa: E501 + + :return: The highlights of this Project. # noqa: E501 + :rtype: list[Highlight] + """ + return self._highlights + + @highlights.setter + def highlights(self, highlights): + """Sets the highlights of this Project. + + An array of objects containing the highlight's slug and title. A highlight's title is a short string that spotlights a characteristic about the project. # noqa: E501 + + :param highlights: The highlights of this Project. # noqa: E501 + :type: list[Highlight] + """ + if self.local_vars_configuration.client_side_validation and highlights is None: # noqa: E501 + raise ValueError("Invalid value for `highlights`, must not be `None`") # noqa: E501 + + self._highlights = highlights + def to_dict(self): """Returns the model properties as a dict""" result = {} @@ -657,20 +623,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/project_list_response.py b/patch_api/models/project_list_response.py index 466d482..7b627cd 100644 --- a/patch_api/models/project_list_response.py +++ b/patch_api/models/project_list_response.py @@ -34,27 +34,20 @@ class ProjectListResponse(object): and the value is json key in definition. """ openapi_types = { - "success": "bool", - "error": "object", - "data": "list[Project]", - "meta": "MetaIndexObject", + 'success': 'bool', + 'error': 'object', + 'data': 'list[Project]', + 'meta': 'MetaIndexObject' } attribute_map = { - "success": "success", - "error": "error", - "data": "data", - "meta": "meta", + 'success': 'success', + 'error': 'error', + 'data': 'data', + 'meta': 'meta' } - def __init__( - self, - success=None, - error=None, - data=None, - meta=None, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 """ProjectListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -89,12 +82,8 @@ def success(self, success): :param success: The success of this ProjectListResponse. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 self._success = success @@ -137,12 +126,8 @@ def data(self, data): :param data: The data of this ProjectListResponse. # noqa: E501 :type: list[Project] """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 self._data = data @@ -164,12 +149,8 @@ def meta(self, meta): :param meta: The meta of this ProjectListResponse. # noqa: E501 :type: MetaIndexObject """ - if ( - self.local_vars_configuration.client_side_validation and meta is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `meta`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 + raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 self._meta = meta @@ -180,20 +161,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/project_response.py b/patch_api/models/project_response.py index 3de074c..25a1b93 100644 --- a/patch_api/models/project_response.py +++ b/patch_api/models/project_response.py @@ -33,13 +33,19 @@ class ProjectResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"success": "bool", "error": "object", "data": "Project"} - - attribute_map = {"success": "success", "error": "error", "data": "data"} - - def __init__( - self, success=None, error=None, data=None, local_vars_configuration=None - ): # noqa: E501 + openapi_types = { + 'success': 'bool', + 'error': 'object', + 'data': 'Project' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data' + } + + def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 """ProjectResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -72,12 +78,8 @@ def success(self, success): :param success: The success of this ProjectResponse. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 self._success = success @@ -120,12 +122,8 @@ def data(self, data): :param data: The data of this ProjectResponse. # noqa: E501 :type: Project """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 self._data = data @@ -136,20 +134,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/sdg.py b/patch_api/models/sdg.py index 9c3e143..0faebdd 100644 --- a/patch_api/models/sdg.py +++ b/patch_api/models/sdg.py @@ -34,27 +34,20 @@ class Sdg(object): and the value is json key in definition. """ openapi_types = { - "title": "str", - "number": "int", - "description": "str", - "url": "str", + 'title': 'str', + 'number': 'int', + 'description': 'str', + 'url': 'str' } attribute_map = { - "title": "title", - "number": "number", - "description": "description", - "url": "url", + 'title': 'title', + 'number': 'number', + 'description': 'description', + 'url': 'url' } - def __init__( - self, - title=None, - number=None, - description=None, - url=None, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, title=None, number=None, description=None, url=None, local_vars_configuration=None): # noqa: E501 """Sdg - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -91,12 +84,8 @@ def title(self, title): :param title: The title of this Sdg. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and title is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `title`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and title is None: # noqa: E501 + raise ValueError("Invalid value for `title`, must not be `None`") # noqa: E501 self._title = title @@ -120,12 +109,8 @@ def number(self, number): :param number: The number of this Sdg. # noqa: E501 :type: int """ - if ( - self.local_vars_configuration.client_side_validation and number is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `number`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and number is None: # noqa: E501 + raise ValueError("Invalid value for `number`, must not be `None`") # noqa: E501 self._number = number @@ -149,12 +134,8 @@ def description(self, description): :param description: The description of this Sdg. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and description is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `description`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and description is None: # noqa: E501 + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 self._description = description @@ -178,12 +159,8 @@ def url(self, url): :param url: The url of this Sdg. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and url is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `url`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and url is None: # noqa: E501 + raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 self._url = url @@ -194,20 +171,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/standard.py b/patch_api/models/standard.py index 40f18a1..42c874d 100644 --- a/patch_api/models/standard.py +++ b/patch_api/models/standard.py @@ -33,13 +33,19 @@ class Standard(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"type": "str", "acronym": "str", "description": "str"} - - attribute_map = {"type": "type", "acronym": "acronym", "description": "description"} - - def __init__( - self, type=None, acronym=None, description=None, local_vars_configuration=None - ): # noqa: E501 + openapi_types = { + 'type': 'str', + 'acronym': 'str', + 'description': 'str' + } + + attribute_map = { + 'type': 'type', + 'acronym': 'acronym', + 'description': 'description' + } + + def __init__(self, type=None, acronym=None, description=None, local_vars_configuration=None): # noqa: E501 """Standard - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -74,12 +80,8 @@ def type(self, type): :param type: The type of this Standard. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and type is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `type`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501 + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 self._type = type @@ -103,12 +105,8 @@ def acronym(self, acronym): :param acronym: The acronym of this Standard. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and acronym is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `acronym`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and acronym is None: # noqa: E501 + raise ValueError("Invalid value for `acronym`, must not be `None`") # noqa: E501 self._acronym = acronym @@ -132,12 +130,8 @@ def description(self, description): :param description: The description of this Standard. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and description is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `description`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and description is None: # noqa: E501 + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 self._description = description @@ -148,20 +142,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/technology_type.py b/patch_api/models/technology_type.py index 9f59dac..c8ca3e2 100644 --- a/patch_api/models/technology_type.py +++ b/patch_api/models/technology_type.py @@ -34,24 +34,18 @@ class TechnologyType(object): and the value is json key in definition. """ openapi_types = { - "slug": "str", - "name": "str", - "parent_technology_type": "ParentTechnologyType", + 'slug': 'str', + 'name': 'str', + 'parent_technology_type': 'ParentTechnologyType' } attribute_map = { - "slug": "slug", - "name": "name", - "parent_technology_type": "parent_technology_type", + 'slug': 'slug', + 'name': 'name', + 'parent_technology_type': 'parent_technology_type' } - def __init__( - self, - slug=None, - name=None, - parent_technology_type=None, - local_vars_configuration=None, - ): # noqa: E501 + def __init__(self, slug=None, name=None, parent_technology_type=None, local_vars_configuration=None): # noqa: E501 """TechnologyType - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -87,12 +81,8 @@ def slug(self, slug): :param slug: The slug of this TechnologyType. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and slug is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `slug`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and slug is None: # noqa: E501 + raise ValueError("Invalid value for `slug`, must not be `None`") # noqa: E501 self._slug = slug @@ -116,12 +106,8 @@ def name(self, name): :param name: The name of this TechnologyType. # noqa: E501 :type: str """ - if ( - self.local_vars_configuration.client_side_validation and name is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501 + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -153,20 +139,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/models/technology_type_list_response.py b/patch_api/models/technology_type_list_response.py index a6d3d18..4037ed3 100644 --- a/patch_api/models/technology_type_list_response.py +++ b/patch_api/models/technology_type_list_response.py @@ -34,16 +34,18 @@ class TechnologyTypeListResponse(object): and the value is json key in definition. """ openapi_types = { - "success": "bool", - "error": "object", - "data": "list[TechnologyType]", + 'success': 'bool', + 'error': 'object', + 'data': 'list[TechnologyType]' } - attribute_map = {"success": "success", "error": "error", "data": "data"} + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data' + } - def __init__( - self, success=None, error=None, data=None, local_vars_configuration=None - ): # noqa: E501 + def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 """TechnologyTypeListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -76,12 +78,8 @@ def success(self, success): :param success: The success of this TechnologyTypeListResponse. # noqa: E501 :type: bool """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 self._success = success @@ -124,12 +122,8 @@ def data(self, data): :param data: The data of this TechnologyTypeListResponse. # noqa: E501 :type: list[TechnologyType] """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 self._data = data @@ -140,20 +134,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value diff --git a/patch_api/rest.py b/patch_api/rest.py index 20090ee..96b66ec 100644 --- a/patch_api/rest.py +++ b/patch_api/rest.py @@ -20,7 +20,6 @@ import ssl import certifi - # python 2 and python 3 compatibility library import six from six.moves.urllib.parse import urlencode @@ -34,6 +33,7 @@ class RESTResponse(io.IOBase): + def __init__(self, resp): self.urllib3_response = resp self.status = resp.status @@ -50,6 +50,7 @@ def getheader(self, name, default=None): class RESTClientObject(object): + def __init__(self, api_key, configuration, pools_size=4, maxsize=None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 @@ -74,12 +75,10 @@ def __init__(self, api_key, configuration, pools_size=4, maxsize=None): addition_pool_args = {} if configuration.assert_hostname is not None: - addition_pool_args[ - "assert_hostname" - ] = configuration.assert_hostname # noqa: E501 + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 if configuration.retries is not None: - addition_pool_args["retries"] = configuration.retries + addition_pool_args['retries'] = configuration.retries if maxsize is None: if configuration.connection_pool_maxsize is not None: @@ -118,39 +117,31 @@ def recursive_urlencode(self, d): >>> recursive_urlencode(data) u'a=b%26c&j=k&d[e][f%26g]=h%2Ai' """ - def recursion(d, base=[]): pairs = [] for key, value in d.items(): new_base = base + [key] - if hasattr(value, "values"): + if hasattr(value, 'values'): pairs += recursion(value, new_base) else: new_pair = None if len(new_base) > 1: first = urllib.parse.quote(new_base.pop(0)) rest = map(lambda x: urllib.parse.quote(x), new_base) - new_pair = "%s[%s]=%s" % ( - first, - "][".join(rest), - urllib.parse.quote(str(value)), - ) + new_pair = "%s[%s]=%s" % (first, ']['.join(rest), urllib.parse.quote(str(value))) else: - new_pair = "%s=%s" % ( - urllib.parse.quote(str(key)), - urllib.parse.quote(str(value)), - ) + new_pair = "%s=%s" % (urllib.parse.quote(str(key)), urllib.parse.quote(str(value))) pairs.append(new_pair) return pairs - return "&".join(recursion(d)) + return '&'.join(recursion(d)) def encoded_query_params(self, query_params): if not query_params: - return "" + return '' - final_query_params = "" + final_query_params = '' for key, value in query_params: if isinstance(value, dict): nested_param = {} @@ -163,19 +154,11 @@ def encoded_query_params(self, query_params): final_query_params += "&" final_query_params += urlencode(query_params) - return "?" + final_query_params - - def request( - self, - method, - url, - query_params=None, - headers=None, - body=None, - post_params=None, - _preload_content=True, - _request_timeout=None, - ): + return '?' + final_query_params + + def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, + _request_timeout=None): """Perform requests. :param method: http request method @@ -195,7 +178,8 @@ def request( (connection, read) timeouts. """ method = method.upper() - assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"] + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', + 'PATCH', 'OPTIONS'] if post_params and body: raise ApiValueError( @@ -207,76 +191,64 @@ def request( timeout = None if _request_timeout: - if isinstance( - _request_timeout, (int,) if six.PY3 else (int, long) - ): # noqa: E501,F821 + if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 timeout = urllib3.Timeout(total=_request_timeout) - elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: + elif (isinstance(_request_timeout, tuple) and + len(_request_timeout) == 2): timeout = urllib3.Timeout( - connect=_request_timeout[0], read=_request_timeout[1] - ) + connect=_request_timeout[0], read=_request_timeout[1]) - if "Content-Type" not in headers: - headers["Content-Type"] = "application/json" + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' - if "Authorization" not in headers: - headers["Authorization"] = "Bearer " + self.api_key + if 'Authorization' not in headers: + headers['Authorization'] = 'Bearer ' + self.api_key try: # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]: + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: url += self.encoded_query_params(query_params) - if re.search("json", headers["Content-Type"], re.IGNORECASE): + if re.search('json', headers['Content-Type'], re.IGNORECASE): request_body = None if body is not None: request_body = json.dumps(body) r = self.pool_manager.request( - method, - url, + method, url, body=request_body, preload_content=_preload_content, timeout=timeout, - headers=headers, - ) - elif ( - headers["Content-Type"] == "application/x-www-form-urlencoded" - ): # noqa: E501 + headers=headers) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 r = self.pool_manager.request( - method, - url, + method, url, fields=post_params, encode_multipart=False, preload_content=_preload_content, timeout=timeout, - headers=headers, - ) - elif headers["Content-Type"] == "multipart/form-data": + headers=headers) + elif headers['Content-Type'] == 'multipart/form-data': # must del headers['Content-Type'], or the correct # Content-Type which generated by urllib3 will be # overwritten. - del headers["Content-Type"] + del headers['Content-Type'] r = self.pool_manager.request( - method, - url, + method, url, fields=post_params, encode_multipart=True, preload_content=_preload_content, timeout=timeout, - headers=headers, - ) + headers=headers) # Pass a `string` parameter directly in the body to support # other content types than Json when `body` argument is # provided in serialized form elif isinstance(body, str) or isinstance(body, bytes): request_body = body r = self.pool_manager.request( - method, - url, + method, url, body=request_body, preload_content=_preload_content, timeout=timeout, - headers=headers, - ) + headers=headers) else: # Cannot generate the request from given parameters msg = """Cannot prepare a request message for provided @@ -286,13 +258,10 @@ def request( # For `GET`, `HEAD` else: url += self.encoded_query_params(query_params) - r = self.pool_manager.request( - method, - url, - preload_content=_preload_content, - timeout=timeout, - headers=headers, - ) + r = self.pool_manager.request(method, url, + preload_content=_preload_content, + timeout=timeout, + headers=headers) except urllib3.exceptions.SSLError as e: msg = "{0}\n{1}".format(type(e).__name__, str(e)) raise ApiException(status=0, reason=msg) @@ -303,7 +272,7 @@ def request( # In the python 3, the response.data is bytes. # we need to decode it to string. if six.PY3: - r.data = r.data.decode("utf8") + r.data = r.data.decode('utf8') # log response body logger.debug("response body: %s", r.data) @@ -313,139 +282,67 @@ def request( return r - def GET( - self, - url, - headers=None, - query_params=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "GET", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params, - ) - - def HEAD( - self, - url, - headers=None, - query_params=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "HEAD", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params, - ) - - def OPTIONS( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "OPTIONS", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def DELETE( - self, - url, - headers=None, - query_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "DELETE", - url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def POST( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "POST", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def PUT( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "PUT", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def PATCH( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "PATCH", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + def GET(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def HEAD(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def DELETE(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def POST(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PUT(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PATCH(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) diff --git a/setup.py b/setup.py index 6c23023..ea9ff3a 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "patch-api" -VERSION = "1.15.1" +VERSION = "1.15.2" # To install the library, run the following # # python setup.py install @@ -21,9 +21,9 @@ # http://pypi.python.org/pypi/setuptools REQUIRES = [ - "urllib3 >= 1.25.3", - "python-dateutil", - "certifi", + "urllib3 >= 1.25.3", + "python-dateutil", + "certifi", ] setup( @@ -40,5 +40,5 @@ include_package_data=True, long_description="""\ The core API used to integrate with Patch's service # noqa: E501 - """, + """ ) diff --git a/test/test_projects_api.py b/test/test_projects_api.py index e2a4c8a..1f3976e 100644 --- a/test/test_projects_api.py +++ b/test/test_projects_api.py @@ -43,6 +43,7 @@ def test_retrieve_project(self): self.assertTrue(hasattr(project, "tagline")) self.assertTrue(hasattr(project, "latitude")) self.assertTrue(hasattr(project, "longitude")) + self.assertTrue(hasattr(project, "highlights")) self.assertTrue(isinstance(project.mechanism, str)) self.assertTrue(isinstance(project.state, str)) From be12dbf51d7a254b97c9d491c8410b8e4295c886 Mon Sep 17 00:00:00 2001 From: Paul Cothenet Date: Tue, 9 Nov 2021 12:13:52 -0800 Subject: [PATCH 2/6] Run all of the things without python --- Dockerfile | 27 +++++++++++++++++++++++++++ Makefile | 17 +++++++++-------- 2 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..939ba87 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM python:3.8.6 AS base + + +FROM base AS lint + +RUN pip install black + +WORKDIR /data +ENTRYPOINT ["black"] + + +FROM base AS build + +COPY requirements.txt . +RUN pip install -r requirements.txt + +CMD [ "python", "setup.py", "install" ] + + +FROM build as test + +COPY test-requirements.txt . +RUN pip install -r test-requirements.txt + +COPY . . + +ENTRYPOINT ["python", "-m", "unittest", "discover", "test/"] \ No newline at end of file diff --git a/Makefile b/Makefile index 5e5c18b..b760e03 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,19 @@ SHELL = /bin/bash -build: install lint +build: lint install install: - pip install -r requirements.txt && \ - python setup.py install + docker build --target build . -t patch-python-build && \ + docker run --rm -v $(PWD)/build:/build patch-python-lint . lint: - pip install black && \ - black . + docker build --target lint . -t patch-python-lint && \ + docker run --rm -v $(PWD):/data patch-python-lint . test: - pip install -r test-requirements.txt && \ - pip install -r requirements.txt && \ - python -m unittest discover test/ + docker build --target test . -t patch-python-test && \ + docker run --rm \ + -e SANDBOX_API_KEY=${SANDBOX_API_KEY} \ + patch-python-test .PHONY: build lint test From aa0579cbe6a0431faa38b5afad22b4a58503482d Mon Sep 17 00:00:00 2001 From: Paul Cothenet Date: Tue, 9 Nov 2021 12:19:45 -0800 Subject: [PATCH 3/6] Touch-up --- Dockerfile | 11 ++++++++--- Makefile | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 939ba87..fbbde8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,15 +9,20 @@ WORKDIR /data ENTRYPOINT ["black"] -FROM base AS build +FROM base AS dependencies COPY requirements.txt . RUN pip install -r requirements.txt -CMD [ "python", "setup.py", "install" ] +FROM dependencies AS build -FROM build as test +COPY . . + +ENTRYPOINT [ "python", "setup.py", "install" ] + + +FROM dependencies as test COPY test-requirements.txt . RUN pip install -r test-requirements.txt diff --git a/Makefile b/Makefile index b760e03..2f37cd9 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ build: lint install install: docker build --target build . -t patch-python-build && \ - docker run --rm -v $(PWD)/build:/build patch-python-lint . + docker run --rm -v $(PWD)/build:/build patch-python-build lint: docker build --target lint . -t patch-python-lint && \ From 544ee815e1b26a1b572d3072797ae4f9f7c3e67a Mon Sep 17 00:00:00 2001 From: Aliana Melendez Date: Tue, 9 Nov 2021 16:55:04 -0500 Subject: [PATCH 4/6] Rerun makefile with new docker setup --- patch_api/api/estimates_api.py | 996 ++++++++++-------- patch_api/api/orders_api.py | 579 +++++----- patch_api/api/preferences_api.py | 462 ++++---- patch_api/api/projects_api.py | 256 ++--- patch_api/api/technology_types_api.py | 136 +-- patch_api/api_client.py | 424 +++++--- patch_api/configuration.py | 86 +- patch_api/exceptions.py | 12 +- patch_api/models/__init__.py | 17 +- patch_api/models/allocation.py | 60 +- .../models/create_bitcoin_estimate_request.py | 50 +- .../create_ethereum_estimate_request.py | 55 +- .../models/create_flight_estimate_request.py | 87 +- .../models/create_mass_estimate_request.py | 70 +- patch_api/models/create_order_request.py | 78 +- patch_api/models/create_preference_request.py | 36 +- .../create_shipping_estimate_request.py | 130 ++- patch_api/models/create_success_response.py | 50 +- .../models/create_vehicle_estimate_request.py | 96 +- patch_api/models/error_response.py | 56 +- patch_api/models/estimate.py | 70 +- patch_api/models/estimate_list_response.py | 69 +- patch_api/models/estimate_response.py | 56 +- patch_api/models/highlight.py | 50 +- patch_api/models/meta_index_object.py | 34 +- patch_api/models/order.py | 183 +++- patch_api/models/order_list_response.py | 69 +- patch_api/models/order_response.py | 56 +- patch_api/models/parent_technology_type.py | 34 +- patch_api/models/photo.py | 42 +- patch_api/models/preference.py | 61 +- patch_api/models/preference_list_response.py | 69 +- patch_api/models/preference_response.py | 56 +- patch_api/models/project.py | 230 ++-- patch_api/models/project_list_response.py | 69 +- patch_api/models/project_response.py | 56 +- patch_api/models/sdg.py | 77 +- patch_api/models/standard.py | 64 +- patch_api/models/technology_type.py | 56 +- .../models/technology_type_list_response.py | 52 +- patch_api/rest.py | 317 ++++-- setup.py | 8 +- 42 files changed, 3195 insertions(+), 2319 deletions(-) diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py index 82539b5..8f42f75 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -18,10 +18,7 @@ # python 2 and python 3 compatibility library import six -from patch_api.exceptions import ( - ApiTypeError, - ApiValueError -) +from patch_api.exceptions import ApiTypeError, ApiValueError class EstimatesApi(object): @@ -32,34 +29,36 @@ class EstimatesApi(object): """ ALLOWED_QUERY_PARAMS = [ - "mass_g", - "total_price_cents_usd", - "project_id", - "page", - "distance_m", - "transportation_method", - "package_mass_g", - "create_order", - "model", - "make", - "year", - "transaction_value_btc_sats", - "transaction_value_eth_gwei", - "gas_used", - "average_daily_balance_btc_sats", - "average_daily_balance_eth_gwei", - "timestamp", - "origin_aiport", - "destination_aiport", - "aircraft_code", - "cabin_class", - "passenger_count" + "mass_g", + "total_price_cents_usd", + "project_id", + "page", + "distance_m", + "transportation_method", + "package_mass_g", + "create_order", + "model", + "make", + "year", + "transaction_value_btc_sats", + "transaction_value_eth_gwei", + "gas_used", + "average_daily_balance_btc_sats", + "average_daily_balance_eth_gwei", + "timestamp", + "origin_aiport", + "destination_aiport", + "aircraft_code", + "cabin_class", + "passenger_count", ] def __init__(self, api_client=None): self.api_client = api_client - def create_bitcoin_estimate(self, create_bitcoin_estimate_request={}, **kwargs): # noqa: E501 + 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 @@ -81,10 +80,14 @@ def create_bitcoin_estimate(self, create_bitcoin_estimate_request={}, **kwargs): 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 + 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 @@ -111,47 +114,51 @@ def create_bitcoin_estimate_with_http_info(self, create_bitcoin_estimate_request 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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + 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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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'] + 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 + 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 = {} @@ -174,36 +181,46 @@ def create_bitcoin_estimate_with_http_info(self, create_bitcoin_estimate_request local_var_files = {} body_params = None - if 'create_bitcoin_estimate_request' in local_var_params: - body_params = local_var_params['create_bitcoin_estimate_request'] + 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 + 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 + 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 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/estimates/crypto/btc', 'POST', + "/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 + 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_ethereum_estimate(self, create_ethereum_estimate_request={}, **kwargs): # noqa: E501 + 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_ethereum_estimate( + self, create_ethereum_estimate_request={}, **kwargs + ): # noqa: E501 """Create an ethereum estimate # noqa: E501 Creates an ethereum 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 @@ -225,10 +242,14 @@ def create_ethereum_estimate(self, create_ethereum_estimate_request={}, **kwargs If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True - return self.create_ethereum_estimate_with_http_info(create_ethereum_estimate_request, **kwargs) # noqa: E501 - - def create_ethereum_estimate_with_http_info(self, create_ethereum_estimate_request, **kwargs): # noqa: E501 + kwargs["_return_http_data_only"] = True + return self.create_ethereum_estimate_with_http_info( + create_ethereum_estimate_request, **kwargs + ) # noqa: E501 + + def create_ethereum_estimate_with_http_info( + self, create_ethereum_estimate_request, **kwargs + ): # noqa: E501 """Create an ethereum estimate # noqa: E501 Creates an ethereum 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 @@ -255,47 +276,51 @@ def create_ethereum_estimate_with_http_info(self, create_ethereum_estimate_reque local_var_params = locals() - all_params = ['create_ethereum_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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["create_ethereum_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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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_ethereum_estimate" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'create_ethereum_estimate_request' is set - if ('create_ethereum_estimate_request' not in local_var_params or - local_var_params['create_ethereum_estimate_request'] is None): - raise ApiValueError("Missing the required parameter `create_ethereum_estimate_request` when calling `create_ethereum_estimate`") # noqa: E501 + if ( + "create_ethereum_estimate_request" not in local_var_params + or local_var_params["create_ethereum_estimate_request"] is None + ): + raise ApiValueError( + "Missing the required parameter `create_ethereum_estimate_request` when calling `create_ethereum_estimate`" + ) # noqa: E501 collection_formats = {} @@ -318,36 +343,46 @@ def create_ethereum_estimate_with_http_info(self, create_ethereum_estimate_reque local_var_files = {} body_params = None - if 'create_ethereum_estimate_request' in local_var_params: - body_params = local_var_params['create_ethereum_estimate_request'] + if "create_ethereum_estimate_request" in local_var_params: + body_params = local_var_params["create_ethereum_estimate_request"] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + 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 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/estimates/crypto/eth', 'POST', + "/v1/estimates/crypto/eth", + "POST", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='EstimateResponse', # noqa: E501 + 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 + 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 """Create a flight estimate given the distance traveled in meters # noqa: E501 Creates a flight 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 @@ -369,10 +404,14 @@ def create_flight_estimate(self, create_flight_estimate_request={}, **kwargs): If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True - return self.create_flight_estimate_with_http_info(create_flight_estimate_request, **kwargs) # noqa: E501 - - def create_flight_estimate_with_http_info(self, create_flight_estimate_request, **kwargs): # noqa: E501 + kwargs["_return_http_data_only"] = True + return self.create_flight_estimate_with_http_info( + create_flight_estimate_request, **kwargs + ) # noqa: E501 + + def create_flight_estimate_with_http_info( + self, create_flight_estimate_request, **kwargs + ): # noqa: E501 """Create a flight estimate given the distance traveled in meters # noqa: E501 Creates a flight 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 @@ -399,47 +438,51 @@ def create_flight_estimate_with_http_info(self, create_flight_estimate_request, local_var_params = locals() - all_params = ['create_flight_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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["create_flight_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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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_flight_estimate" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'create_flight_estimate_request' is set - if ('create_flight_estimate_request' not in local_var_params or - local_var_params['create_flight_estimate_request'] is None): - raise ApiValueError("Missing the required parameter `create_flight_estimate_request` when calling `create_flight_estimate`") # noqa: E501 + if ( + "create_flight_estimate_request" not in local_var_params + or local_var_params["create_flight_estimate_request"] is None + ): + raise ApiValueError( + "Missing the required parameter `create_flight_estimate_request` when calling `create_flight_estimate`" + ) # noqa: E501 collection_formats = {} @@ -462,36 +505,46 @@ def create_flight_estimate_with_http_info(self, create_flight_estimate_request, local_var_files = {} body_params = None - if 'create_flight_estimate_request' in local_var_params: - body_params = local_var_params['create_flight_estimate_request'] + if "create_flight_estimate_request" in local_var_params: + body_params = local_var_params["create_flight_estimate_request"] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + 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 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/estimates/flight', 'POST', + "/v1/estimates/flight", + "POST", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='EstimateResponse', # noqa: E501 + 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_mass_estimate(self, create_mass_estimate_request={}, **kwargs): # noqa: E501 + 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_mass_estimate( + self, create_mass_estimate_request={}, **kwargs + ): # noqa: E501 """Create an estimate based on mass of CO2 # noqa: E501 Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate. # noqa: E501 @@ -513,10 +566,14 @@ def create_mass_estimate(self, create_mass_estimate_request={}, **kwargs): # no If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True - return self.create_mass_estimate_with_http_info(create_mass_estimate_request, **kwargs) # noqa: E501 - - def create_mass_estimate_with_http_info(self, create_mass_estimate_request, **kwargs): # noqa: E501 + kwargs["_return_http_data_only"] = True + return self.create_mass_estimate_with_http_info( + create_mass_estimate_request, **kwargs + ) # noqa: E501 + + def create_mass_estimate_with_http_info( + self, create_mass_estimate_request, **kwargs + ): # noqa: E501 """Create an estimate based on mass of CO2 # noqa: E501 Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate. # noqa: E501 @@ -543,47 +600,51 @@ def create_mass_estimate_with_http_info(self, create_mass_estimate_request, **kw local_var_params = locals() - all_params = ['create_mass_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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["create_mass_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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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_mass_estimate" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'create_mass_estimate_request' is set - if ('create_mass_estimate_request' not in local_var_params or - local_var_params['create_mass_estimate_request'] is None): - raise ApiValueError("Missing the required parameter `create_mass_estimate_request` when calling `create_mass_estimate`") # noqa: E501 + if ( + "create_mass_estimate_request" not in local_var_params + or local_var_params["create_mass_estimate_request"] is None + ): + raise ApiValueError( + "Missing the required parameter `create_mass_estimate_request` when calling `create_mass_estimate`" + ) # noqa: E501 collection_formats = {} @@ -606,36 +667,46 @@ def create_mass_estimate_with_http_info(self, create_mass_estimate_request, **kw local_var_files = {} body_params = None - if 'create_mass_estimate_request' in local_var_params: - body_params = local_var_params['create_mass_estimate_request'] + if "create_mass_estimate_request" in local_var_params: + body_params = local_var_params["create_mass_estimate_request"] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + 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 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/estimates/mass', 'POST', + "/v1/estimates/mass", + "POST", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='EstimateResponse', # noqa: E501 + 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_shipping_estimate(self, create_shipping_estimate_request={}, **kwargs): # noqa: E501 + 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_shipping_estimate( + self, create_shipping_estimate_request={}, **kwargs + ): # noqa: E501 """Create a shipping estimate given the distance traveled in meters, package weight, and transportation method. # noqa: E501 Creates a shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters. # noqa: E501 @@ -657,10 +728,14 @@ def create_shipping_estimate(self, create_shipping_estimate_request={}, **kwargs If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True - return self.create_shipping_estimate_with_http_info(create_shipping_estimate_request, **kwargs) # noqa: E501 - - def create_shipping_estimate_with_http_info(self, create_shipping_estimate_request, **kwargs): # noqa: E501 + kwargs["_return_http_data_only"] = True + return self.create_shipping_estimate_with_http_info( + create_shipping_estimate_request, **kwargs + ) # noqa: E501 + + def create_shipping_estimate_with_http_info( + self, create_shipping_estimate_request, **kwargs + ): # noqa: E501 """Create a shipping estimate given the distance traveled in meters, package weight, and transportation method. # noqa: E501 Creates a shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters. # noqa: E501 @@ -687,47 +762,51 @@ def create_shipping_estimate_with_http_info(self, create_shipping_estimate_reque local_var_params = locals() - all_params = ['create_shipping_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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["create_shipping_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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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_shipping_estimate" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'create_shipping_estimate_request' is set - if ('create_shipping_estimate_request' not in local_var_params or - local_var_params['create_shipping_estimate_request'] is None): - raise ApiValueError("Missing the required parameter `create_shipping_estimate_request` when calling `create_shipping_estimate`") # noqa: E501 + if ( + "create_shipping_estimate_request" not in local_var_params + or local_var_params["create_shipping_estimate_request"] is None + ): + raise ApiValueError( + "Missing the required parameter `create_shipping_estimate_request` when calling `create_shipping_estimate`" + ) # noqa: E501 collection_formats = {} @@ -750,36 +829,46 @@ def create_shipping_estimate_with_http_info(self, create_shipping_estimate_reque local_var_files = {} body_params = None - if 'create_shipping_estimate_request' in local_var_params: - body_params = local_var_params['create_shipping_estimate_request'] + if "create_shipping_estimate_request" in local_var_params: + body_params = local_var_params["create_shipping_estimate_request"] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + 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 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/estimates/shipping', 'POST', + "/v1/estimates/shipping", + "POST", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='EstimateResponse', # noqa: E501 + 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_vehicle_estimate(self, create_vehicle_estimate_request={}, **kwargs): # noqa: E501 + 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_vehicle_estimate( + self, create_vehicle_estimate_request={}, **kwargs + ): # noqa: E501 """Create a vehicle estimate given the distance traveled in meters and the type of vehicle # noqa: E501 Creates an estimate and calculates the amount of CO2 to be compensated depending on the distance and the vehicle. An order in the `draft` state may be created based on the parameters, linked to the estimate. # noqa: E501 @@ -801,10 +890,14 @@ def create_vehicle_estimate(self, create_vehicle_estimate_request={}, **kwargs): If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True - return self.create_vehicle_estimate_with_http_info(create_vehicle_estimate_request, **kwargs) # noqa: E501 - - def create_vehicle_estimate_with_http_info(self, create_vehicle_estimate_request, **kwargs): # noqa: E501 + kwargs["_return_http_data_only"] = True + return self.create_vehicle_estimate_with_http_info( + create_vehicle_estimate_request, **kwargs + ) # noqa: E501 + + def create_vehicle_estimate_with_http_info( + self, create_vehicle_estimate_request, **kwargs + ): # noqa: E501 """Create a vehicle estimate given the distance traveled in meters and the type of vehicle # noqa: E501 Creates an estimate and calculates the amount of CO2 to be compensated depending on the distance and the vehicle. An order in the `draft` state may be created based on the parameters, linked to the estimate. # noqa: E501 @@ -831,47 +924,51 @@ def create_vehicle_estimate_with_http_info(self, create_vehicle_estimate_request local_var_params = locals() - all_params = ['create_vehicle_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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["create_vehicle_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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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_vehicle_estimate" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'create_vehicle_estimate_request' is set - if ('create_vehicle_estimate_request' not in local_var_params or - local_var_params['create_vehicle_estimate_request'] is None): - raise ApiValueError("Missing the required parameter `create_vehicle_estimate_request` when calling `create_vehicle_estimate`") # noqa: E501 + if ( + "create_vehicle_estimate_request" not in local_var_params + or local_var_params["create_vehicle_estimate_request"] is None + ): + raise ApiValueError( + "Missing the required parameter `create_vehicle_estimate_request` when calling `create_vehicle_estimate`" + ) # noqa: E501 collection_formats = {} @@ -894,34 +991,42 @@ def create_vehicle_estimate_with_http_info(self, create_vehicle_estimate_request local_var_files = {} body_params = None - if 'create_vehicle_estimate_request' in local_var_params: - body_params = local_var_params['create_vehicle_estimate_request'] + if "create_vehicle_estimate_request" in local_var_params: + body_params = local_var_params["create_vehicle_estimate_request"] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + 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 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/estimates/vehicle', 'POST', + "/v1/estimates/vehicle", + "POST", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='EstimateResponse', # noqa: E501 + 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) + 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 retrieve_estimate(self, id={}, **kwargs): # noqa: E501 """Retrieves an estimate # noqa: E501 @@ -945,7 +1050,7 @@ def retrieve_estimate(self, id={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_estimate_with_http_info(id, **kwargs) # noqa: E501 def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 @@ -975,53 +1080,54 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['id'] # 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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["id"] # 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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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 retrieve_estimate" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'id' is set - if ('id' not in local_var_params or - local_var_params['id'] is None): - raise ApiValueError("Missing the required parameter `id` when calling `retrieve_estimate`") # noqa: E501 + if "id" not in local_var_params or local_var_params["id"] is None: + raise ApiValueError( + "Missing the required parameter `id` when calling `retrieve_estimate`" + ) # noqa: E501 collection_formats = {} path_params = {} - if 'id' in local_var_params: - path_params['id'] = local_var_params['id'] # noqa: E501 + if "id" in local_var_params: + path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] @@ -1041,27 +1147,32 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/estimates/{id}', 'GET', + "/v1/estimates/{id}", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='EstimateResponse', # noqa: E501 + 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) + 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 retrieve_estimates(self, **kwargs): # noqa: E501 """Retrieves a list of estimates # noqa: E501 @@ -1085,7 +1196,7 @@ def retrieve_estimates(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_estimates_with_http_info(**kwargs) # noqa: E501 def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 @@ -1115,51 +1226,51 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['page'] # 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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["page"] # 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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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 retrieve_estimates" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] collection_formats = {} path_params = {} query_params = [] - if 'page' in local_var_params: - query_params.append(('page', local_var_params['page'])) # noqa: E501 + 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 = [] @@ -1177,24 +1288,29 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/estimates', 'GET', + "/v1/estimates", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='EstimateListResponse', # noqa: E501 + response_type="EstimateListResponse", # 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) + 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, + ) diff --git a/patch_api/api/orders_api.py b/patch_api/api/orders_api.py index 51f9cb9..ee20417 100644 --- a/patch_api/api/orders_api.py +++ b/patch_api/api/orders_api.py @@ -18,10 +18,7 @@ # python 2 and python 3 compatibility library import six -from patch_api.exceptions import ( - ApiTypeError, - ApiValueError -) +from patch_api.exceptions import ApiTypeError, ApiValueError class OrdersApi(object): @@ -32,28 +29,28 @@ class OrdersApi(object): """ ALLOWED_QUERY_PARAMS = [ - "mass_g", - "total_price_cents_usd", - "project_id", - "page", - "distance_m", - "transportation_method", - "package_mass_g", - "create_order", - "model", - "make", - "year", - "transaction_value_btc_sats", - "transaction_value_eth_gwei", - "gas_used", - "average_daily_balance_btc_sats", - "average_daily_balance_eth_gwei", - "timestamp", - "origin_aiport", - "destination_aiport", - "aircraft_code", - "cabin_class", - "passenger_count" + "mass_g", + "total_price_cents_usd", + "project_id", + "page", + "distance_m", + "transportation_method", + "package_mass_g", + "create_order", + "model", + "make", + "year", + "transaction_value_btc_sats", + "transaction_value_eth_gwei", + "gas_used", + "average_daily_balance_btc_sats", + "average_daily_balance_eth_gwei", + "timestamp", + "origin_aiport", + "destination_aiport", + "aircraft_code", + "cabin_class", + "passenger_count", ] def __init__(self, api_client=None): @@ -81,7 +78,7 @@ def cancel_order(self, id={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.cancel_order_with_http_info(id, **kwargs) # noqa: E501 def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 @@ -111,53 +108,54 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['id'] # 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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["id"] # 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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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 cancel_order" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'id' is set - if ('id' not in local_var_params or - local_var_params['id'] is None): - raise ApiValueError("Missing the required parameter `id` when calling `cancel_order`") # noqa: E501 + if "id" not in local_var_params or local_var_params["id"] is None: + raise ApiValueError( + "Missing the required parameter `id` when calling `cancel_order`" + ) # noqa: E501 collection_formats = {} path_params = {} - if 'id' in local_var_params: - path_params['id'] = local_var_params['id'] # noqa: E501 + if "id" in local_var_params: + path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] @@ -177,27 +175,32 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/orders/{id}/cancel', 'PATCH', + "/v1/orders/{id}/cancel", + "PATCH", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='OrderResponse', # noqa: E501 + response_type="OrderResponse", # 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) + 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_order(self, create_order_request={}, **kwargs): # noqa: E501 """Creates an order # noqa: E501 @@ -221,8 +224,10 @@ def create_order(self, create_order_request={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True - return self.create_order_with_http_info(create_order_request, **kwargs) # noqa: E501 + kwargs["_return_http_data_only"] = True + return self.create_order_with_http_info( + create_order_request, **kwargs + ) # noqa: E501 def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: E501 """Creates an order # noqa: E501 @@ -251,47 +256,51 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: local_var_params = locals() - all_params = ['create_order_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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["create_order_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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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_order" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'create_order_request' is set - if ('create_order_request' not in local_var_params or - local_var_params['create_order_request'] is None): - raise ApiValueError("Missing the required parameter `create_order_request` when calling `create_order`") # noqa: E501 + if ( + "create_order_request" not in local_var_params + or local_var_params["create_order_request"] is None + ): + raise ApiValueError( + "Missing the required parameter `create_order_request` when calling `create_order`" + ) # noqa: E501 collection_formats = {} @@ -314,34 +323,42 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: local_var_files = {} body_params = None - if 'create_order_request' in local_var_params: - body_params = local_var_params['create_order_request'] + if "create_order_request" in local_var_params: + body_params = local_var_params["create_order_request"] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + 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 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/orders', 'POST', + "/v1/orders", + "POST", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='OrderResponse', # noqa: E501 + response_type="OrderResponse", # 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) + 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 place_order(self, id={}, **kwargs): # noqa: E501 """Place an order # noqa: E501 @@ -365,7 +382,7 @@ def place_order(self, id={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.place_order_with_http_info(id, **kwargs) # noqa: E501 def place_order_with_http_info(self, id, **kwargs): # noqa: E501 @@ -395,53 +412,54 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['id'] # 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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["id"] # 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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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 place_order" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'id' is set - if ('id' not in local_var_params or - local_var_params['id'] is None): - raise ApiValueError("Missing the required parameter `id` when calling `place_order`") # noqa: E501 + if "id" not in local_var_params or local_var_params["id"] is None: + raise ApiValueError( + "Missing the required parameter `id` when calling `place_order`" + ) # noqa: E501 collection_formats = {} path_params = {} - if 'id' in local_var_params: - path_params['id'] = local_var_params['id'] # noqa: E501 + if "id" in local_var_params: + path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] @@ -461,27 +479,32 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/orders/{id}/place', 'PATCH', + "/v1/orders/{id}/place", + "PATCH", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='OrderResponse', # noqa: E501 + response_type="OrderResponse", # 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) + 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 retrieve_order(self, id={}, **kwargs): # noqa: E501 """Retrieves an order # noqa: E501 @@ -505,7 +528,7 @@ def retrieve_order(self, id={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_order_with_http_info(id, **kwargs) # noqa: E501 def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 @@ -535,53 +558,54 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['id'] # 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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["id"] # 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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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 retrieve_order" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'id' is set - if ('id' not in local_var_params or - local_var_params['id'] is None): - raise ApiValueError("Missing the required parameter `id` when calling `retrieve_order`") # noqa: E501 + if "id" not in local_var_params or local_var_params["id"] is None: + raise ApiValueError( + "Missing the required parameter `id` when calling `retrieve_order`" + ) # noqa: E501 collection_formats = {} path_params = {} - if 'id' in local_var_params: - path_params['id'] = local_var_params['id'] # noqa: E501 + if "id" in local_var_params: + path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] @@ -601,27 +625,32 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/orders/{id}', 'GET', + "/v1/orders/{id}", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='OrderResponse', # noqa: E501 + response_type="OrderResponse", # 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) + 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 retrieve_orders(self, **kwargs): # noqa: E501 """Retrieves a list of orders # noqa: E501 @@ -648,7 +677,7 @@ def retrieve_orders(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_orders_with_http_info(**kwargs) # noqa: E501 def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 @@ -681,57 +710,68 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - 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') - 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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + 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") + 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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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 retrieve_orders" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] collection_formats = {} path_params = {} query_params = [] - 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 + 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 = [] @@ -749,24 +789,29 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/orders', 'GET', + "/v1/orders", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='OrderListResponse', # noqa: E501 + response_type="OrderListResponse", # 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) + 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, + ) diff --git a/patch_api/api/preferences_api.py b/patch_api/api/preferences_api.py index 7fd2e45..d6892a5 100644 --- a/patch_api/api/preferences_api.py +++ b/patch_api/api/preferences_api.py @@ -18,10 +18,7 @@ # python 2 and python 3 compatibility library import six -from patch_api.exceptions import ( - ApiTypeError, - ApiValueError -) +from patch_api.exceptions import ApiTypeError, ApiValueError class PreferencesApi(object): @@ -32,28 +29,28 @@ class PreferencesApi(object): """ ALLOWED_QUERY_PARAMS = [ - "mass_g", - "total_price_cents_usd", - "project_id", - "page", - "distance_m", - "transportation_method", - "package_mass_g", - "create_order", - "model", - "make", - "year", - "transaction_value_btc_sats", - "transaction_value_eth_gwei", - "gas_used", - "average_daily_balance_btc_sats", - "average_daily_balance_eth_gwei", - "timestamp", - "origin_aiport", - "destination_aiport", - "aircraft_code", - "cabin_class", - "passenger_count" + "mass_g", + "total_price_cents_usd", + "project_id", + "page", + "distance_m", + "transportation_method", + "package_mass_g", + "create_order", + "model", + "make", + "year", + "transaction_value_btc_sats", + "transaction_value_eth_gwei", + "gas_used", + "average_daily_balance_btc_sats", + "average_daily_balance_eth_gwei", + "timestamp", + "origin_aiport", + "destination_aiport", + "aircraft_code", + "cabin_class", + "passenger_count", ] def __init__(self, api_client=None): @@ -81,10 +78,14 @@ def create_preference(self, create_preference_request={}, **kwargs): # noqa: E5 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True - return self.create_preference_with_http_info(create_preference_request, **kwargs) # noqa: E501 - - def create_preference_with_http_info(self, create_preference_request, **kwargs): # noqa: E501 + kwargs["_return_http_data_only"] = True + return self.create_preference_with_http_info( + create_preference_request, **kwargs + ) # noqa: E501 + + def create_preference_with_http_info( + self, create_preference_request, **kwargs + ): # noqa: E501 """creates a project preference # noqa: E501 Creates a project preference for the given organization. If you have a `preference` in place, all of your orders will be directed to the project the preference points to. # noqa: E501 @@ -111,47 +112,51 @@ def create_preference_with_http_info(self, create_preference_request, **kwargs): local_var_params = locals() - all_params = ['create_preference_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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["create_preference_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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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_preference" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'create_preference_request' is set - if ('create_preference_request' not in local_var_params or - local_var_params['create_preference_request'] is None): - raise ApiValueError("Missing the required parameter `create_preference_request` when calling `create_preference`") # noqa: E501 + if ( + "create_preference_request" not in local_var_params + or local_var_params["create_preference_request"] is None + ): + raise ApiValueError( + "Missing the required parameter `create_preference_request` when calling `create_preference`" + ) # noqa: E501 collection_formats = {} @@ -174,34 +179,42 @@ def create_preference_with_http_info(self, create_preference_request, **kwargs): local_var_files = {} body_params = None - if 'create_preference_request' in local_var_params: - body_params = local_var_params['create_preference_request'] + if "create_preference_request" in local_var_params: + body_params = local_var_params["create_preference_request"] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + 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 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/preferences', 'POST', + "/v1/preferences", + "POST", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='PreferenceResponse', # noqa: E501 + response_type="PreferenceResponse", # 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) + 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 delete_preference(self, id={}, **kwargs): # noqa: E501 """Deletes an organization's preference for a project # noqa: E501 @@ -225,7 +238,7 @@ def delete_preference(self, id={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.delete_preference_with_http_info(id, **kwargs) # noqa: E501 def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 @@ -255,53 +268,54 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['id'] # 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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["id"] # 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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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 delete_preference" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'id' is set - if ('id' not in local_var_params or - local_var_params['id'] is None): - raise ApiValueError("Missing the required parameter `id` when calling `delete_preference`") # noqa: E501 + if "id" not in local_var_params or local_var_params["id"] is None: + raise ApiValueError( + "Missing the required parameter `id` when calling `delete_preference`" + ) # noqa: E501 collection_formats = {} path_params = {} - if 'id' in local_var_params: - path_params['id'] = local_var_params['id'] # noqa: E501 + if "id" in local_var_params: + path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] @@ -321,27 +335,32 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/preferences/{id}', 'DELETE', + "/v1/preferences/{id}", + "DELETE", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='PreferenceResponse', # noqa: E501 + response_type="PreferenceResponse", # 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) + 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 retrieve_preference(self, id={}, **kwargs): # noqa: E501 """Retrieve the preference # noqa: E501 @@ -365,7 +384,7 @@ def retrieve_preference(self, id={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_preference_with_http_info(id, **kwargs) # noqa: E501 def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 @@ -395,53 +414,54 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['id'] # 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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["id"] # 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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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 retrieve_preference" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'id' is set - if ('id' not in local_var_params or - local_var_params['id'] is None): - raise ApiValueError("Missing the required parameter `id` when calling `retrieve_preference`") # noqa: E501 + if "id" not in local_var_params or local_var_params["id"] is None: + raise ApiValueError( + "Missing the required parameter `id` when calling `retrieve_preference`" + ) # noqa: E501 collection_formats = {} path_params = {} - if 'id' in local_var_params: - path_params['id'] = local_var_params['id'] # noqa: E501 + if "id" in local_var_params: + path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] @@ -461,27 +481,32 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/preferences/{id}', 'GET', + "/v1/preferences/{id}", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='PreferenceResponse', # noqa: E501 + response_type="PreferenceResponse", # 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) + 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 retrieve_preferences(self, **kwargs): # noqa: E501 """Retrieves a list of preferences # noqa: E501 @@ -505,7 +530,7 @@ def retrieve_preferences(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_preferences_with_http_info(**kwargs) # noqa: E501 def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 @@ -535,51 +560,51 @@ def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['page'] # 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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["page"] # 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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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 retrieve_preferences" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] collection_formats = {} path_params = {} query_params = [] - if 'page' in local_var_params: - query_params.append(('page', local_var_params['page'])) # noqa: E501 + 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 = [] @@ -597,24 +622,29 @@ def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/preferences', 'GET', + "/v1/preferences", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='PreferenceListResponse', # noqa: E501 + response_type="PreferenceListResponse", # 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) + 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, + ) diff --git a/patch_api/api/projects_api.py b/patch_api/api/projects_api.py index 8f98333..560e45a 100644 --- a/patch_api/api/projects_api.py +++ b/patch_api/api/projects_api.py @@ -18,10 +18,7 @@ # python 2 and python 3 compatibility library import six -from patch_api.exceptions import ( - ApiTypeError, - ApiValueError -) +from patch_api.exceptions import ApiTypeError, ApiValueError class ProjectsApi(object): @@ -32,28 +29,28 @@ class ProjectsApi(object): """ ALLOWED_QUERY_PARAMS = [ - "mass_g", - "total_price_cents_usd", - "project_id", - "page", - "distance_m", - "transportation_method", - "package_mass_g", - "create_order", - "model", - "make", - "year", - "transaction_value_btc_sats", - "transaction_value_eth_gwei", - "gas_used", - "average_daily_balance_btc_sats", - "average_daily_balance_eth_gwei", - "timestamp", - "origin_aiport", - "destination_aiport", - "aircraft_code", - "cabin_class", - "passenger_count" + "mass_g", + "total_price_cents_usd", + "project_id", + "page", + "distance_m", + "transportation_method", + "package_mass_g", + "create_order", + "model", + "make", + "year", + "transaction_value_btc_sats", + "transaction_value_eth_gwei", + "gas_used", + "average_daily_balance_btc_sats", + "average_daily_balance_eth_gwei", + "timestamp", + "origin_aiport", + "destination_aiport", + "aircraft_code", + "cabin_class", + "passenger_count", ] def __init__(self, api_client=None): @@ -81,7 +78,7 @@ def retrieve_project(self, id={}, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_project_with_http_info(id, **kwargs) # noqa: E501 def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 @@ -111,53 +108,54 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['id'] # 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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["id"] # 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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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 retrieve_project" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'id' is set - if ('id' not in local_var_params or - local_var_params['id'] is None): - raise ApiValueError("Missing the required parameter `id` when calling `retrieve_project`") # noqa: E501 + if "id" not in local_var_params or local_var_params["id"] is None: + raise ApiValueError( + "Missing the required parameter `id` when calling `retrieve_project`" + ) # noqa: E501 collection_formats = {} path_params = {} - if 'id' in local_var_params: - path_params['id'] = local_var_params['id'] # noqa: E501 + if "id" in local_var_params: + path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] @@ -177,27 +175,32 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/projects/{id}', 'GET', + "/v1/projects/{id}", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='ProjectResponse', # noqa: E501 + response_type="ProjectResponse", # 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) + 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 retrieve_projects(self, **kwargs): # noqa: E501 """Retrieves a list of projects # noqa: E501 @@ -224,7 +227,7 @@ def retrieve_projects(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_projects_with_http_info(**kwargs) # noqa: E501 def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 @@ -257,57 +260,59 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['page', 'country', 'type', 'minimum_available_mass'] # 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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + all_params = ["page", "country", "type", "minimum_available_mass"] # 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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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 retrieve_projects" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] collection_formats = {} path_params = {} query_params = [] - if 'page' in local_var_params: - query_params.append(('page', local_var_params['page'])) # noqa: E501 - if 'country' in local_var_params: - query_params.append(('country', local_var_params['country'])) # noqa: E501 - if 'type' in local_var_params: - query_params.append(('type', local_var_params['type'])) # noqa: E501 - if 'minimum_available_mass' in local_var_params: - query_params.append(('minimum_available_mass', local_var_params['minimum_available_mass'])) # noqa: E501 + if "page" in local_var_params: + query_params.append(("page", local_var_params["page"])) # noqa: E501 + if "country" in local_var_params: + query_params.append(("country", local_var_params["country"])) # noqa: E501 + if "type" in local_var_params: + query_params.append(("type", local_var_params["type"])) # noqa: E501 + if "minimum_available_mass" in local_var_params: + query_params.append( + ("minimum_available_mass", local_var_params["minimum_available_mass"]) + ) # noqa: E501 # do not add duplicate keys to query_params list existing_keys = [] @@ -325,24 +330,29 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/projects', 'GET', + "/v1/projects", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='ProjectListResponse', # noqa: E501 + response_type="ProjectListResponse", # 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) + 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, + ) diff --git a/patch_api/api/technology_types_api.py b/patch_api/api/technology_types_api.py index caf5fbf..c34f141 100644 --- a/patch_api/api/technology_types_api.py +++ b/patch_api/api/technology_types_api.py @@ -18,10 +18,7 @@ # python 2 and python 3 compatibility library import six -from patch_api.exceptions import ( - ApiTypeError, - ApiValueError -) +from patch_api.exceptions import ApiTypeError, ApiValueError class TechnologyTypesApi(object): @@ -32,28 +29,28 @@ class TechnologyTypesApi(object): """ ALLOWED_QUERY_PARAMS = [ - "mass_g", - "total_price_cents_usd", - "project_id", - "page", - "distance_m", - "transportation_method", - "package_mass_g", - "create_order", - "model", - "make", - "year", - "transaction_value_btc_sats", - "transaction_value_eth_gwei", - "gas_used", - "average_daily_balance_btc_sats", - "average_daily_balance_eth_gwei", - "timestamp", - "origin_aiport", - "destination_aiport", - "aircraft_code", - "cabin_class", - "passenger_count" + "mass_g", + "total_price_cents_usd", + "project_id", + "page", + "distance_m", + "transportation_method", + "package_mass_g", + "create_order", + "model", + "make", + "year", + "transaction_value_btc_sats", + "transaction_value_eth_gwei", + "gas_used", + "average_daily_balance_btc_sats", + "average_daily_balance_eth_gwei", + "timestamp", + "origin_aiport", + "destination_aiport", + "aircraft_code", + "cabin_class", + "passenger_count", ] def __init__(self, api_client=None): @@ -80,7 +77,7 @@ def retrieve_technology_types(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_technology_types_with_http_info(**kwargs) # noqa: E501 def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501 @@ -110,42 +107,42 @@ def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() all_params = [] # 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('transaction_value_eth_gwei') - all_params.append('gas_used') - all_params.append('transaction_value_btc_sats') - all_params.append('average_daily_balance_btc_sats') - all_params.append('average_daily_balance_eth_gwei') - all_params.append('timestamp') - all_params.append('origin_airport') - all_params.append('destination_airport') - all_params.append('aircraft_code') - all_params.append('cabin_class') - all_params.append('passenger_count') - - for key, val in six.iteritems(local_var_params['kwargs']): + 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("transaction_value_eth_gwei") + all_params.append("gas_used") + all_params.append("transaction_value_btc_sats") + all_params.append("average_daily_balance_btc_sats") + all_params.append("average_daily_balance_eth_gwei") + all_params.append("timestamp") + all_params.append("origin_airport") + all_params.append("destination_airport") + all_params.append("aircraft_code") + all_params.append("cabin_class") + all_params.append("passenger_count") + + 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 retrieve_technology_types" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] collection_formats = {} @@ -169,24 +166,29 @@ def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/projects/technology_types', 'GET', + "/v1/projects/technology_types", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='TechnologyTypeListResponse', # noqa: E501 + response_type="TechnologyTypeListResponse", # 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) + 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, + ) diff --git a/patch_api/api_client.py b/patch_api/api_client.py index 5d00f48..f9850af 100644 --- a/patch_api/api_client.py +++ b/patch_api/api_client.py @@ -59,21 +59,28 @@ class ApiClient(object): PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types NATIVE_TYPES_MAPPING = { - 'int': int, - 'long': int if six.PY3 else long, # noqa: F821 - 'float': float, - 'str': str, - 'bool': bool, - 'date': datetime.date, - 'datetime': datetime.datetime, - 'object': object, + "int": int, + "long": int if six.PY3 else long, # noqa: F821 + "float": float, + "str": str, + "bool": bool, + "date": datetime.date, + "datetime": datetime.datetime, + "object": object, } _pool = None - def __init__(self, api_key=None, configuration=None, header_name=None, header_value=None, - cookie=None, pool_threads=1): + def __init__( + self, + api_key=None, + configuration=None, + header_name=None, + header_value=None, + cookie=None, + pool_threads=1, + ): if api_key is None: - raise ValueError('ApiClient must be initialized with an api_key') + raise ValueError("ApiClient must be initialized with an api_key") if configuration is None: configuration = Configuration() self.configuration = configuration @@ -85,7 +92,7 @@ def __init__(self, api_key=None, configuration=None, header_name=None, header_va self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'patch-python/1.15.2' + self.user_agent = "patch-python/1.15.2" def __del__(self): if self._pool: @@ -95,18 +102,18 @@ def __del__(self): def __getattr__(self, method): resource = { - 'projects': ProjectsApi, - 'orders': OrdersApi, - 'preferences': PreferencesApi, - 'estimates': EstimatesApi, - 'technology_types': TechnologyTypesApi + "projects": ProjectsApi, + "orders": OrdersApi, + "preferences": PreferencesApi, + "estimates": EstimatesApi, + "technology_types": TechnologyTypesApi, }[method] return resource(api_client=self) @property def pool(self): """Create thread pool on first request - avoids instantiating unused threadpool for blocking clients. + avoids instantiating unused threadpool for blocking clients. """ if self._pool is None: self._pool = ThreadPool(self.pool_threads) @@ -115,21 +122,33 @@ def pool(self): @property def user_agent(self): """User agent for this API client""" - return self.default_headers['User-Agent'] + return self.default_headers["User-Agent"] @user_agent.setter def user_agent(self, value): - self.default_headers['User-Agent'] = value + self.default_headers["User-Agent"] = value def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value def __call_api( - self, resource_path, method, path_params=None, - query_params=None, header_params=None, body=None, post_params=None, - files=None, response_type=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + self, + resource_path, + method, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + response_type=None, + auth_settings=None, + _return_http_data_only=None, + collection_formats=None, + _preload_content=True, + _request_timeout=None, + _host=None, + ): config = self.configuration @@ -137,36 +156,33 @@ def __call_api( header_params = header_params or {} header_params.update(self.default_headers) if self.cookie: - header_params['Cookie'] = self.cookie + header_params["Cookie"] = self.cookie if header_params: header_params = self.sanitize_for_serialization(header_params) - header_params = dict(self.parameters_to_tuples(header_params, - collection_formats)) + header_params = dict( + self.parameters_to_tuples(header_params, collection_formats) + ) # path parameters if path_params: path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, - collection_formats) + path_params = self.parameters_to_tuples(path_params, collection_formats) for k, v in path_params: # specified safe chars, encode everything resource_path = resource_path.replace( - '{%s}' % k, - quote(str(v), safe=config.safe_chars_for_path_param) + "{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param) ) # query parameters if query_params: query_params = self.sanitize_for_serialization(query_params) - query_params = self.parameters_to_tuples(query_params, - collection_formats) + query_params = self.parameters_to_tuples(query_params, collection_formats) # post parameters if post_params or files: post_params = post_params if post_params else [] post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, - collection_formats) + post_params = self.parameters_to_tuples(post_params, collection_formats) post_params.extend(self.files_parameters(files)) # auth setting @@ -185,10 +201,15 @@ def __call_api( # perform request and return response response_data = self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, + method, + url, + query_params=query_params, + headers=header_params, + post_params=post_params, + body=body, _preload_content=_preload_content, - _request_timeout=_request_timeout) + _request_timeout=_request_timeout, + ) self.last_response = response_data @@ -201,10 +222,9 @@ def __call_api( return_data = None if _return_http_data_only: - return (return_data) + return return_data else: - return (return_data, response_data.status, - response_data.getheaders()) + return (return_data, response_data.status, response_data.getheaders()) def sanitize_for_serialization(self, obj): """Builds a JSON POST object. @@ -225,11 +245,9 @@ def sanitize_for_serialization(self, obj): elif isinstance(obj, self.PRIMITIVE_TYPES): return obj elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) - for sub_obj in obj] + return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj] elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) - for sub_obj in obj) + return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() @@ -241,12 +259,16 @@ def sanitize_for_serialization(self, obj): # and attributes which value is not None. # Convert attribute name to json key in # model definition for request. - obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) - for attr, _ in six.iteritems(obj.openapi_types) - if getattr(obj, attr) is not None} + obj_dict = { + obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.openapi_types) + if getattr(obj, attr) is not None + } - return {key: self.sanitize_for_serialization(val) - for key, val in six.iteritems(obj_dict)} + return { + key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict) + } def deserialize(self, response, response_type): """Deserializes response into an object. @@ -282,15 +304,15 @@ def __deserialize(self, data, klass): return None if type(klass) == str: - if klass.startswith('list['): - sub_kls = re.match(r'list\[(.*)\]', klass).group(1) - return [self.__deserialize(sub_data, sub_kls) - for sub_data in data] + if klass.startswith("list["): + sub_kls = re.match(r"list\[(.*)\]", klass).group(1) + return [self.__deserialize(sub_data, sub_kls) for sub_data in data] - if klass.startswith('dict('): - sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) - return {k: self.__deserialize(v, sub_kls) - for k, v in six.iteritems(data)} + if klass.startswith("dict("): + sub_kls = re.match(r"dict\(([^,]*), (.*)\)", klass).group(2) + return { + k: self.__deserialize(v, sub_kls) for k, v in six.iteritems(data) + } # convert str to class if klass in self.NATIVE_TYPES_MAPPING: @@ -309,12 +331,25 @@ def __deserialize(self, data, klass): else: return self.__deserialize_model(data, klass) - def call_api(self, resource_path, method, - path_params=None, query_params=None, header_params=None, - body=None, post_params=None, files=None, - response_type=None, auth_settings=None, async_req=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + def call_api( + self, + resource_path, + method, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + response_type=None, + auth_settings=None, + async_req=None, + _return_http_data_only=None, + collection_formats=None, + _preload_content=True, + _request_timeout=None, + _host=None, + ): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -352,80 +387,123 @@ def call_api(self, resource_path, method, then the method will return the response directly. """ if not async_req: - return self.__call_api(resource_path, method, - path_params, query_params, header_params, - body, post_params, files, - response_type, auth_settings, - _return_http_data_only, collection_formats, - _preload_content, _request_timeout, _host) + return self.__call_api( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host, + ) else: - thread = self.pool.apply_async(self.__call_api, (resource_path, - method, path_params, query_params, - header_params, body, - post_params, files, - response_type, auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host)) + thread = self.pool.apply_async( + self.__call_api, + ( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host, + ), + ) return thread - def request(self, method, url, query_params=None, headers=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): + def request( + self, + method, + url, + query_params=None, + headers=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): """Makes the HTTP request using RESTClient.""" if method == "GET": - return self.rest_client.GET(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) + return self.rest_client.GET( + url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers, + ) elif method == "HEAD": - return self.rest_client.HEAD(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) + return self.rest_client.HEAD( + url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers, + ) elif method == "OPTIONS": - return self.rest_client.OPTIONS(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.OPTIONS( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "POST": - return self.rest_client.POST(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.POST( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "PUT": - return self.rest_client.PUT(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.PUT( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "PATCH": - return self.rest_client.PATCH(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.PATCH( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "DELETE": - return self.rest_client.DELETE(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.DELETE( + url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) else: raise ApiValueError( "http method must be `GET`, `HEAD`, `OPTIONS`," @@ -442,22 +520,23 @@ def parameters_to_tuples(self, params, collection_formats): new_params = [] if collection_formats is None: collection_formats = {} - for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + for k, v in ( + six.iteritems(params) if isinstance(params, dict) else params + ): # noqa: E501 if k in collection_formats: collection_format = collection_formats[k] - if collection_format == 'multi': + if collection_format == "multi": new_params.extend((k, value) for value in v) else: - if collection_format == 'ssv': - delimiter = ' ' - elif collection_format == 'tsv': - delimiter = '\t' - elif collection_format == 'pipes': - delimiter = '|' + if collection_format == "ssv": + delimiter = " " + elif collection_format == "tsv": + delimiter = "\t" + elif collection_format == "pipes": + delimiter = "|" else: # csv is the default - delimiter = ',' - new_params.append( - (k, delimiter.join(str(value) for value in v))) + delimiter = "," + new_params.append((k, delimiter.join(str(value) for value in v))) else: new_params.append((k, v)) return new_params @@ -476,13 +555,14 @@ def files_parameters(self, files=None): continue file_names = v if type(v) is list else [v] for n in file_names: - with open(n, 'rb') as f: + with open(n, "rb") as f: filename = os.path.basename(f.name) filedata = f.read() - mimetype = (mimetypes.guess_type(filename)[0] or - 'application/octet-stream') - params.append( - tuple([k, tuple([filename, filedata, mimetype])])) + mimetype = ( + mimetypes.guess_type(filename)[0] + or "application/octet-stream" + ) + params.append(tuple([k, tuple([filename, filedata, mimetype])])) return params @@ -497,10 +577,10 @@ def select_header_accept(self, accepts): accepts = [x.lower() for x in accepts] - if 'application/json' in accepts: - return 'application/json' + if "application/json" in accepts: + return "application/json" else: - return ', '.join(accepts) + return ", ".join(accepts) def select_header_content_type(self, content_types): """Returns `Content-Type` based on an array of content_types provided. @@ -509,12 +589,12 @@ def select_header_content_type(self, content_types): :return: Content-Type (e.g. application/json). """ if not content_types: - return 'application/json' + return "application/json" content_types = [x.lower() for x in content_types] - if 'application/json' in content_types or '*/*' in content_types: - return 'application/json' + if "application/json" in content_types or "*/*" in content_types: + return "application/json" else: return content_types[0] @@ -531,17 +611,17 @@ def update_params_for_auth(self, headers, querys, auth_settings): for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if not auth_setting['value']: + if not auth_setting["value"]: continue - elif auth_setting['in'] == 'cookie': - headers['Cookie'] = auth_setting['value'] - elif auth_setting['in'] == 'header': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - querys.append((auth_setting['key'], auth_setting['value'])) + elif auth_setting["in"] == "cookie": + headers["Cookie"] = auth_setting["value"] + elif auth_setting["in"] == "header": + headers[auth_setting["key"]] = auth_setting["value"] + elif auth_setting["in"] == "query": + querys.append((auth_setting["key"], auth_setting["value"])) else: raise ApiValueError( - 'Authentication token must be in `query` or `header`' + "Authentication token must be in `query` or `header`" ) def __deserialize_file(self, response): @@ -559,8 +639,9 @@ def __deserialize_file(self, response): content_disposition = response.getheader("Content-Disposition") if content_disposition: - filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', - content_disposition).group(1) + filename = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition + ).group(1) path = os.path.join(os.path.dirname(path), filename) with open(path, "wb") as f: @@ -598,13 +679,13 @@ def __deserialize_date(self, string): """ try: from dateutil.parser import parse + return parse(string).date() except ImportError: return string except ValueError: raise rest.ApiException( - status=0, - reason="Failed to parse `{0}` as date object".format(string) + status=0, reason="Failed to parse `{0}` as date object".format(string) ) def __deserialize_datatime(self, string): @@ -617,16 +698,14 @@ def __deserialize_datatime(self, string): """ try: from dateutil.parser import parse + return parse(string) except ImportError: return string except ValueError: raise rest.ApiException( status=0, - reason=( - "Failed to parse `{0}` as datetime object" - .format(string) - ) + reason=("Failed to parse `{0}` as datetime object".format(string)), ) def __deserialize_model(self, data, klass): @@ -637,22 +716,23 @@ def __deserialize_model(self, data, klass): :return: model object. """ - if not klass.openapi_types and not hasattr(klass, - 'get_real_child_model'): + if not klass.openapi_types and not hasattr(klass, "get_real_child_model"): return data kwargs = {} if klass.openapi_types is not None: for attr, attr_type in six.iteritems(klass.openapi_types): - if (data is not None and - klass.attribute_map[attr] in data and - isinstance(data, (list, dict))): + if ( + data is not None + and klass.attribute_map[attr] in data + and isinstance(data, (list, dict)) + ): value = data[klass.attribute_map[attr]] kwargs[attr] = self.__deserialize(value, attr_type) instance = klass(**kwargs) - if hasattr(instance, 'get_real_child_model'): + if hasattr(instance, "get_real_child_model"): klass_name = instance.get_real_child_model(data) if klass_name: instance = self.__deserialize(data, klass_name) diff --git a/patch_api/configuration.py b/patch_api/configuration.py index 0723390..b8f55a1 100644 --- a/patch_api/configuration.py +++ b/patch_api/configuration.py @@ -56,13 +56,16 @@ class Configuration(object): _default = None - def __init__(self, host="https://api.patch.io", - api_key=None, api_key_prefix=None, - username=None, password=None, - discard_unknown_keys=False, - ): - """Constructor - """ + def __init__( + self, + host="https://api.patch.io", + api_key=None, + api_key_prefix=None, + username=None, + password=None, + discard_unknown_keys=False, + ): + """Constructor""" self.host = host """Default Base url """ @@ -98,7 +101,7 @@ def __init__(self, host="https://api.patch.io", """ self.logger["package_logger"] = logging.getLogger("patch_api") self.logger["urllib3_logger"] = logging.getLogger("urllib3") - self.logger_format = '%(asctime)s %(levelname)s %(message)s' + self.logger_format = "%(asctime)s %(levelname)s %(message)s" """Log format """ self.logger_stream_handler = None @@ -146,7 +149,7 @@ def __init__(self, host="https://api.patch.io", self.proxy_headers = None """Proxy headers """ - self.safe_chars_for_path_param = '' + self.safe_chars_for_path_param = "" """Safe chars for path_param """ self.retries = None @@ -160,7 +163,7 @@ def __deepcopy__(self, memo): result = cls.__new__(cls) memo[id(self)] = result for k, v in self.__dict__.items(): - if k not in ('logger', 'logger_file_handler'): + if k not in ("logger", "logger_file_handler"): setattr(result, k, copy.deepcopy(v, memo)) # shallow copy of loggers result.logger = copy.copy(self.logger) @@ -309,9 +312,9 @@ def get_basic_auth_token(self): password = "" if self.password is not None: password = self.password - return urllib3.util.make_headers( - basic_auth=username + ':' + password - ).get('authorization') + return urllib3.util.make_headers(basic_auth=username + ":" + password).get( + "authorization" + ) def auth_settings(self): """Gets Auth Settings dict for api client. @@ -320,11 +323,11 @@ def auth_settings(self): """ auth = {} if self.access_token is not None: - auth['bearer_auth'] = { - 'type': 'bearer', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token + auth["bearer_auth"] = { + "type": "bearer", + "in": "header", + "key": "Authorization", + "value": "Bearer " + self.access_token, } return auth @@ -333,12 +336,15 @@ def to_debug_report(self): :return: The report for debugging. """ - return "Python SDK Debug Report:\n"\ - "OS: {env}\n"\ - "Python Version: {pyversion}\n"\ - "Version of the API: v1\n"\ - "SDK Package Version: 1.15.2".\ - format(env=sys.platform, pyversion=sys.version) + return ( + "Python SDK Debug Report:\n" + "OS: {env}\n" + "Python Version: {pyversion}\n" + "Version of the API: v1\n" + "SDK Package Version: 1.15.2".format( + env=sys.platform, pyversion=sys.version + ) + ) def get_host_settings(self): """Gets an array of host settings @@ -347,14 +353,14 @@ def get_host_settings(self): """ return [ { - 'url': "https://{defaultHost}", - 'description': "No description provided", - 'variables': { - 'defaultHost': { - 'description': "No description provided", - 'default_value': "api.patch.io", - } + "url": "https://{defaultHost}", + "description": "No description provided", + "variables": { + "defaultHost": { + "description": "No description provided", + "default_value": "api.patch.io", } + }, } ] @@ -372,22 +378,22 @@ def get_host_from_settings(self, index, variables=None): except IndexError: raise ValueError( "Invalid index {0} when selecting the host settings. " - "Must be less than {1}".format(index, len(servers))) + "Must be less than {1}".format(index, len(servers)) + ) - url = server['url'] + url = server["url"] # go through variables and replace placeholders - for variable_name, variable in server['variables'].items(): - used_value = variables.get( - variable_name, variable['default_value']) + for variable_name, variable in server["variables"].items(): + used_value = variables.get(variable_name, variable["default_value"]) - if 'enum_values' in variable \ - and used_value not in variable['enum_values']: + if "enum_values" in variable and used_value not in variable["enum_values"]: raise ValueError( "The variable `{0}` in the host URL has invalid value " "{1}. Must be {2}.".format( - variable_name, variables[variable_name], - variable['enum_values'])) + variable_name, variables[variable_name], variable["enum_values"] + ) + ) url = url.replace("{" + variable_name + "}", used_value) diff --git a/patch_api/exceptions.py b/patch_api/exceptions.py index e2bd822..64b8229 100644 --- a/patch_api/exceptions.py +++ b/patch_api/exceptions.py @@ -19,9 +19,8 @@ class OpenApiException(Exception): class ApiTypeError(OpenApiException, TypeError): - def __init__(self, msg, path_to_item=None, valid_classes=None, - key_type=None): - """ Raises an exception for TypeErrors + def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None): + """Raises an exception for TypeErrors Args: msg (str): the exception message @@ -83,7 +82,6 @@ def __init__(self, msg, path_to_item=None): class ApiException(OpenApiException): - def __init__(self, status=None, reason=None, http_resp=None): if http_resp: self.status = http_resp.status @@ -98,11 +96,9 @@ def __init__(self, status=None, reason=None, http_resp=None): def __str__(self): """Custom error messages for exception""" - error_message = "({0})\n"\ - "Reason: {1}\n".format(self.status, self.reason) + error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason) if self.headers: - error_message += "HTTP response headers: {0}\n".format( - self.headers) + error_message += "HTTP response headers: {0}\n".format(self.headers) if self.body: error_message += "HTTP response body: {0}\n".format(self.body) diff --git a/patch_api/models/__init__.py b/patch_api/models/__init__.py index 4b92628..1bb69c1 100644 --- a/patch_api/models/__init__.py +++ b/patch_api/models/__init__.py @@ -16,20 +16,27 @@ # import models into model package from patch_api.models.allocation import Allocation -from patch_api.models.create_bitcoin_estimate_request import CreateBitcoinEstimateRequest -from patch_api.models.create_ethereum_estimate_request import CreateEthereumEstimateRequest +from patch_api.models.create_bitcoin_estimate_request import ( + CreateBitcoinEstimateRequest, +) +from patch_api.models.create_ethereum_estimate_request import ( + CreateEthereumEstimateRequest, +) from patch_api.models.create_flight_estimate_request import CreateFlightEstimateRequest from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest from patch_api.models.create_order_request import CreateOrderRequest from patch_api.models.create_preference_request import CreatePreferenceRequest -from patch_api.models.create_shipping_estimate_request import CreateShippingEstimateRequest +from patch_api.models.create_shipping_estimate_request import ( + CreateShippingEstimateRequest, +) from patch_api.models.create_success_response import CreateSuccessResponse -from patch_api.models.create_vehicle_estimate_request import CreateVehicleEstimateRequest +from patch_api.models.create_vehicle_estimate_request import ( + CreateVehicleEstimateRequest, +) from patch_api.models.error_response import ErrorResponse from patch_api.models.estimate import Estimate 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.meta_index_object import MetaIndexObject from patch_api.models.order import Order from patch_api.models.order_list_response import OrderListResponse diff --git a/patch_api/models/allocation.py b/patch_api/models/allocation.py index e37d829..b6629ae 100644 --- a/patch_api/models/allocation.py +++ b/patch_api/models/allocation.py @@ -33,19 +33,13 @@ class Allocation(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'id': 'str', - 'production': 'bool', - 'mass_g': 'int' - } - - attribute_map = { - 'id': 'id', - 'production': 'production', - 'mass_g': 'mass_g' - } - - def __init__(self, id=None, production=None, mass_g=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"id": "str", "production": "bool", "mass_g": "int"} + + attribute_map = {"id": "id", "production": "production", "mass_g": "mass_g"} + + def __init__( + self, id=None, production=None, mass_g=None, local_vars_configuration=None + ): # noqa: E501 """Allocation - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -80,7 +74,9 @@ def id(self, id): :param id: The id of this Allocation. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and id is None + ): # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -105,8 +101,12 @@ def production(self, production): :param production: The production of this Allocation. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 - raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and production is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `production`, must not be `None`" + ) # noqa: E501 self._production = production @@ -130,8 +130,12 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this Allocation. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and mass_g is None: # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and mass_g is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must not be `None`" + ) # noqa: E501 self._mass_g = mass_g @@ -142,18 +146,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/create_bitcoin_estimate_request.py b/patch_api/models/create_bitcoin_estimate_request.py index c7b5fb1..27e11c9 100644 --- a/patch_api/models/create_bitcoin_estimate_request.py +++ b/patch_api/models/create_bitcoin_estimate_request.py @@ -34,22 +34,30 @@ class CreateBitcoinEstimateRequest(object): and the value is json key in definition. """ openapi_types = { - 'timestamp': 'datetime', - 'transaction_value_btc_sats': 'int', - 'average_daily_balance_btc_sats': 'int', - 'project_id': 'str', - 'create_order': 'bool' + "timestamp": "datetime", + "transaction_value_btc_sats": "int", + "average_daily_balance_btc_sats": "int", + "project_id": "str", + "create_order": "bool", } attribute_map = { - 'timestamp': 'timestamp', - 'transaction_value_btc_sats': 'transaction_value_btc_sats', - 'average_daily_balance_btc_sats': 'average_daily_balance_btc_sats', - 'project_id': 'project_id', - 'create_order': 'create_order' + "timestamp": "timestamp", + "transaction_value_btc_sats": "transaction_value_btc_sats", + "average_daily_balance_btc_sats": "average_daily_balance_btc_sats", + "project_id": "project_id", + "create_order": "create_order", } - def __init__(self, timestamp=None, transaction_value_btc_sats=None, average_daily_balance_btc_sats=None, project_id=None, create_order=False, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + timestamp=None, + transaction_value_btc_sats=None, + average_daily_balance_btc_sats=None, + project_id=None, + create_order=False, + local_vars_configuration=None, + ): # noqa: E501 """CreateBitcoinEstimateRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -180,18 +188,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/create_ethereum_estimate_request.py b/patch_api/models/create_ethereum_estimate_request.py index 4eddc84..6405cb8 100644 --- a/patch_api/models/create_ethereum_estimate_request.py +++ b/patch_api/models/create_ethereum_estimate_request.py @@ -34,24 +34,33 @@ class CreateEthereumEstimateRequest(object): and the value is json key in definition. """ openapi_types = { - 'timestamp': 'str', - 'gas_used': 'int', - 'transaction_value_eth_gwei': 'int', - 'average_daily_balance_eth_gwei': 'int', - 'project_id': 'str', - 'create_order': 'bool' + "timestamp": "str", + "gas_used": "int", + "transaction_value_eth_gwei": "int", + "average_daily_balance_eth_gwei": "int", + "project_id": "str", + "create_order": "bool", } attribute_map = { - 'timestamp': 'timestamp', - 'gas_used': 'gas_used', - 'transaction_value_eth_gwei': 'transaction_value_eth_gwei', - 'average_daily_balance_eth_gwei': 'average_daily_balance_eth_gwei', - 'project_id': 'project_id', - 'create_order': 'create_order' + "timestamp": "timestamp", + "gas_used": "gas_used", + "transaction_value_eth_gwei": "transaction_value_eth_gwei", + "average_daily_balance_eth_gwei": "average_daily_balance_eth_gwei", + "project_id": "project_id", + "create_order": "create_order", } - def __init__(self, timestamp=None, gas_used=None, transaction_value_eth_gwei=None, average_daily_balance_eth_gwei=None, project_id=None, create_order=False, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + timestamp=None, + gas_used=None, + transaction_value_eth_gwei=None, + average_daily_balance_eth_gwei=None, + project_id=None, + create_order=False, + local_vars_configuration=None, + ): # noqa: E501 """CreateEthereumEstimateRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -205,18 +214,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/create_flight_estimate_request.py b/patch_api/models/create_flight_estimate_request.py index a82382f..c1e051d 100644 --- a/patch_api/models/create_flight_estimate_request.py +++ b/patch_api/models/create_flight_estimate_request.py @@ -34,28 +34,39 @@ class CreateFlightEstimateRequest(object): and the value is json key in definition. """ openapi_types = { - 'distance_m': 'int', - 'origin_airport': 'str', - 'destination_airport': 'str', - 'aircraft_code': 'str', - 'cabin_class': 'str', - 'passenger_count': 'int', - 'project_id': 'str', - 'create_order': 'bool' + "distance_m": "int", + "origin_airport": "str", + "destination_airport": "str", + "aircraft_code": "str", + "cabin_class": "str", + "passenger_count": "int", + "project_id": "str", + "create_order": "bool", } attribute_map = { - 'distance_m': 'distance_m', - 'origin_airport': 'origin_airport', - 'destination_airport': 'destination_airport', - 'aircraft_code': 'aircraft_code', - 'cabin_class': 'cabin_class', - 'passenger_count': 'passenger_count', - 'project_id': 'project_id', - 'create_order': 'create_order' + "distance_m": "distance_m", + "origin_airport": "origin_airport", + "destination_airport": "destination_airport", + "aircraft_code": "aircraft_code", + "cabin_class": "cabin_class", + "passenger_count": "passenger_count", + "project_id": "project_id", + "create_order": "create_order", } - def __init__(self, distance_m=None, origin_airport=None, destination_airport=None, aircraft_code=None, cabin_class=None, passenger_count=None, project_id=None, create_order=False, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + distance_m=None, + origin_airport=None, + destination_airport=None, + aircraft_code=None, + cabin_class=None, + passenger_count=None, + project_id=None, + create_order=False, + local_vars_configuration=None, + ): # noqa: E501 """CreateFlightEstimateRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -98,12 +109,22 @@ def distance_m(self, distance_m): :param distance_m: The distance_m of this CreateFlightEstimateRequest. # noqa: E501 :type: int """ - if (self.local_vars_configuration.client_side_validation and - distance_m is not None and distance_m > 400000000): # noqa: E501 - raise ValueError("Invalid value for `distance_m`, must be a value less than or equal to `400000000`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - distance_m is not None and distance_m < 0): # noqa: E501 - raise ValueError("Invalid value for `distance_m`, must be a value greater than or equal to `0`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and distance_m is not None + and distance_m > 400000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `distance_m`, must be a value less than or equal to `400000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and distance_m is not None + and distance_m < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `distance_m`, must be a value greater than or equal to `0`" + ) # noqa: E501 self._distance_m = distance_m @@ -261,18 +282,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/create_mass_estimate_request.py b/patch_api/models/create_mass_estimate_request.py index 41a064e..34c1190 100644 --- a/patch_api/models/create_mass_estimate_request.py +++ b/patch_api/models/create_mass_estimate_request.py @@ -33,19 +33,21 @@ class CreateMassEstimateRequest(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'mass_g': 'int', - 'create_order': 'bool', - 'project_id': 'str' - } + openapi_types = {"mass_g": "int", "create_order": "bool", "project_id": "str"} attribute_map = { - 'mass_g': 'mass_g', - 'create_order': 'create_order', - 'project_id': 'project_id' + "mass_g": "mass_g", + "create_order": "create_order", + "project_id": "project_id", } - def __init__(self, mass_g=None, create_order=False, project_id=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + mass_g=None, + create_order=False, + project_id=None, + local_vars_configuration=None, + ): # noqa: E501 """CreateMassEstimateRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -79,14 +81,28 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this CreateMassEstimateRequest. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and mass_g is None: # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must not be `None`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g > 2000000000): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `2000000000`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g < 0): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `0`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and mass_g is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must not be `None`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g > 2000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value less than or equal to `2000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value greater than or equal to `0`" + ) # noqa: E501 self._mass_g = mass_g @@ -139,18 +155,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/create_order_request.py b/patch_api/models/create_order_request.py index fdfa476..098d6e7 100644 --- a/patch_api/models/create_order_request.py +++ b/patch_api/models/create_order_request.py @@ -34,20 +34,27 @@ class CreateOrderRequest(object): and the value is json key in definition. """ openapi_types = { - 'mass_g': 'int', - 'total_price_cents_usd': 'int', - 'project_id': 'str', - 'metadata': 'object' + "mass_g": "int", + "total_price_cents_usd": "int", + "project_id": "str", + "metadata": "object", } attribute_map = { - 'mass_g': 'mass_g', - 'total_price_cents_usd': 'total_price_cents_usd', - 'project_id': 'project_id', - 'metadata': 'metadata' + "mass_g": "mass_g", + "total_price_cents_usd": "total_price_cents_usd", + "project_id": "project_id", + "metadata": "metadata", } - def __init__(self, mass_g=None, total_price_cents_usd=None, project_id=None, metadata=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + mass_g=None, + total_price_cents_usd=None, + project_id=None, + metadata=None, + local_vars_configuration=None, + ): # noqa: E501 """CreateOrderRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -86,12 +93,22 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this CreateOrderRequest. # noqa: E501 :type: int """ - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g > 2000000000): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `2000000000`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g < 0): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `0`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g > 2000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value less than or equal to `2000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value greater than or equal to `0`" + ) # noqa: E501 self._mass_g = mass_g @@ -113,9 +130,14 @@ def total_price_cents_usd(self, total_price_cents_usd): :param total_price_cents_usd: The total_price_cents_usd of this CreateOrderRequest. # noqa: E501 :type: int """ - if (self.local_vars_configuration.client_side_validation and - total_price_cents_usd is not None and total_price_cents_usd < 1): # noqa: E501 - raise ValueError("Invalid value for `total_price_cents_usd`, must be a value greater than or equal to `1`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and total_price_cents_usd is not None + and total_price_cents_usd < 1 + ): # noqa: E501 + raise ValueError( + "Invalid value for `total_price_cents_usd`, must be a value greater than or equal to `1`" + ) # noqa: E501 self._total_price_cents_usd = total_price_cents_usd @@ -168,18 +190,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/create_preference_request.py b/patch_api/models/create_preference_request.py index 8abb43d..d5e14a4 100644 --- a/patch_api/models/create_preference_request.py +++ b/patch_api/models/create_preference_request.py @@ -33,13 +33,9 @@ class CreatePreferenceRequest(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'project_id': 'str' - } + openapi_types = {"project_id": "str"} - attribute_map = { - 'project_id': 'project_id' - } + attribute_map = {"project_id": "project_id"} def __init__(self, project_id=None, local_vars_configuration=None): # noqa: E501 """CreatePreferenceRequest - a model defined in OpenAPI""" # noqa: E501 @@ -70,8 +66,12 @@ def project_id(self, project_id): :param project_id: The project_id of this CreatePreferenceRequest. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and project_id is None: # noqa: E501 - raise ValueError("Invalid value for `project_id`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and project_id is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `project_id`, must not be `None`" + ) # noqa: E501 self._project_id = project_id @@ -82,18 +82,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/create_shipping_estimate_request.py b/patch_api/models/create_shipping_estimate_request.py index 163f88c..818e3b7 100644 --- a/patch_api/models/create_shipping_estimate_request.py +++ b/patch_api/models/create_shipping_estimate_request.py @@ -34,22 +34,30 @@ class CreateShippingEstimateRequest(object): and the value is json key in definition. """ openapi_types = { - 'distance_m': 'int', - 'package_mass_g': 'int', - 'transportation_method': 'str', - 'project_id': 'str', - 'create_order': 'bool' + "distance_m": "int", + "package_mass_g": "int", + "transportation_method": "str", + "project_id": "str", + "create_order": "bool", } attribute_map = { - 'distance_m': 'distance_m', - 'package_mass_g': 'package_mass_g', - 'transportation_method': 'transportation_method', - 'project_id': 'project_id', - 'create_order': 'create_order' + "distance_m": "distance_m", + "package_mass_g": "package_mass_g", + "transportation_method": "transportation_method", + "project_id": "project_id", + "create_order": "create_order", } - def __init__(self, distance_m=None, package_mass_g=None, transportation_method=None, project_id=None, create_order=False, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + distance_m=None, + package_mass_g=None, + transportation_method=None, + project_id=None, + create_order=False, + local_vars_configuration=None, + ): # noqa: E501 """CreateShippingEstimateRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -86,14 +94,28 @@ def distance_m(self, distance_m): :param distance_m: The distance_m of this CreateShippingEstimateRequest. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and distance_m is None: # noqa: E501 - raise ValueError("Invalid value for `distance_m`, must not be `None`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - distance_m is not None and distance_m > 400000000): # noqa: E501 - raise ValueError("Invalid value for `distance_m`, must be a value less than or equal to `400000000`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - distance_m is not None and distance_m < 0): # noqa: E501 - raise ValueError("Invalid value for `distance_m`, must be a value greater than or equal to `0`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and distance_m is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `distance_m`, must not be `None`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and distance_m is not None + and distance_m > 400000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `distance_m`, must be a value less than or equal to `400000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and distance_m is not None + and distance_m < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `distance_m`, must be a value greater than or equal to `0`" + ) # noqa: E501 self._distance_m = distance_m @@ -115,14 +137,29 @@ def package_mass_g(self, package_mass_g): :param package_mass_g: The package_mass_g of this CreateShippingEstimateRequest. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and package_mass_g is None: # noqa: E501 - raise ValueError("Invalid value for `package_mass_g`, must not be `None`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - package_mass_g is not None and package_mass_g > 2000000000): # noqa: E501 - raise ValueError("Invalid value for `package_mass_g`, must be a value less than or equal to `2000000000`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - package_mass_g is not None and package_mass_g < 0): # noqa: E501 - raise ValueError("Invalid value for `package_mass_g`, must be a value greater than or equal to `0`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and package_mass_g is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `package_mass_g`, must not be `None`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and package_mass_g is not None + and package_mass_g > 2000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `package_mass_g`, must be a value less than or equal to `2000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and package_mass_g is not None + and package_mass_g < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `package_mass_g`, must be a value greater than or equal to `0`" + ) # noqa: E501 self._package_mass_g = package_mass_g @@ -144,13 +181,22 @@ def transportation_method(self, transportation_method): :param transportation_method: The transportation_method of this CreateShippingEstimateRequest. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and transportation_method is None: # noqa: E501 - raise ValueError("Invalid value for `transportation_method`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and transportation_method is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `transportation_method`, must not be `None`" + ) # noqa: E501 allowed_values = ["air", "rail", "road", "sea"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and transportation_method not in allowed_values: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and transportation_method not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `transportation_method` ({0}), must be one of {1}" # noqa: E501 - .format(transportation_method, allowed_values) + "Invalid value for `transportation_method` ({0}), must be one of {1}".format( # noqa: E501 + transportation_method, allowed_values + ) ) self._transportation_method = transportation_method @@ -204,18 +250,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/create_success_response.py b/patch_api/models/create_success_response.py index badfc4a..5ba1d0f 100644 --- a/patch_api/models/create_success_response.py +++ b/patch_api/models/create_success_response.py @@ -33,17 +33,13 @@ class CreateSuccessResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'success': 'bool', - 'error': 'object' - } + openapi_types = {"success": "bool", "error": "object"} - attribute_map = { - 'success': 'success', - 'error': 'error' - } + attribute_map = {"success": "success", "error": "error"} - def __init__(self, success=None, error=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, success=None, error=None, local_vars_configuration=None + ): # noqa: E501 """CreateSuccessResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -74,8 +70,12 @@ def success(self, success): :param success: The success of this CreateSuccessResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -97,8 +97,12 @@ def error(self, error): :param error: The error of this CreateSuccessResponse. # noqa: E501 :type: object """ - if self.local_vars_configuration.client_side_validation and error is None: # noqa: E501 - raise ValueError("Invalid value for `error`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and error is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `error`, must not be `None`" + ) # noqa: E501 self._error = error @@ -109,18 +113,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/create_vehicle_estimate_request.py b/patch_api/models/create_vehicle_estimate_request.py index 72505fc..baa2e5b 100644 --- a/patch_api/models/create_vehicle_estimate_request.py +++ b/patch_api/models/create_vehicle_estimate_request.py @@ -34,24 +34,33 @@ class CreateVehicleEstimateRequest(object): and the value is json key in definition. """ openapi_types = { - 'distance_m': 'int', - 'make': 'str', - 'model': 'str', - 'year': 'int', - 'project_id': 'str', - 'create_order': 'bool' + "distance_m": "int", + "make": "str", + "model": "str", + "year": "int", + "project_id": "str", + "create_order": "bool", } attribute_map = { - 'distance_m': 'distance_m', - 'make': 'make', - 'model': 'model', - 'year': 'year', - 'project_id': 'project_id', - 'create_order': 'create_order' + "distance_m": "distance_m", + "make": "make", + "model": "model", + "year": "year", + "project_id": "project_id", + "create_order": "create_order", } - def __init__(self, distance_m=None, make=None, model=None, year=None, project_id=None, create_order=False, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + distance_m=None, + make=None, + model=None, + year=None, + project_id=None, + create_order=False, + local_vars_configuration=None, + ): # noqa: E501 """CreateVehicleEstimateRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -90,14 +99,28 @@ def distance_m(self, distance_m): :param distance_m: The distance_m of this CreateVehicleEstimateRequest. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and distance_m is None: # noqa: E501 - raise ValueError("Invalid value for `distance_m`, must not be `None`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - distance_m is not None and distance_m > 400000000): # noqa: E501 - raise ValueError("Invalid value for `distance_m`, must be a value less than or equal to `400000000`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - distance_m is not None and distance_m < 0): # noqa: E501 - raise ValueError("Invalid value for `distance_m`, must be a value greater than or equal to `0`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and distance_m is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `distance_m`, must not be `None`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and distance_m is not None + and distance_m > 400000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `distance_m`, must be a value less than or equal to `400000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and distance_m is not None + and distance_m < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `distance_m`, must be a value greater than or equal to `0`" + ) # noqa: E501 self._distance_m = distance_m @@ -161,9 +184,14 @@ def year(self, year): :param year: The year of this CreateVehicleEstimateRequest. # noqa: E501 :type: int """ - if (self.local_vars_configuration.client_side_validation and - year is not None and year < 1900): # noqa: E501 - raise ValueError("Invalid value for `year`, must be a value greater than or equal to `1900`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and year is not None + and year < 1900 + ): # noqa: E501 + raise ValueError( + "Invalid value for `year`, must be a value greater than or equal to `1900`" + ) # noqa: E501 self._year = year @@ -216,18 +244,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/error_response.py b/patch_api/models/error_response.py index efb6ee8..8303054 100644 --- a/patch_api/models/error_response.py +++ b/patch_api/models/error_response.py @@ -33,19 +33,13 @@ class ErrorResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'object' - } - - attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data' - } - - def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"success": "bool", "error": "object", "data": "object"} + + attribute_map = {"success": "success", "error": "error", "data": "data"} + + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 """ErrorResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +72,12 @@ def success(self, success): :param success: The success of this ErrorResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -101,8 +99,12 @@ def error(self, error): :param error: The error of this ErrorResponse. # noqa: E501 :type: object """ - if self.local_vars_configuration.client_side_validation and error is None: # noqa: E501 - raise ValueError("Invalid value for `error`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and error is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `error`, must not be `None`" + ) # noqa: E501 self._error = error @@ -134,18 +136,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/estimate.py b/patch_api/models/estimate.py index 1ef336d..3792db3 100644 --- a/patch_api/models/estimate.py +++ b/patch_api/models/estimate.py @@ -34,22 +34,30 @@ class Estimate(object): and the value is json key in definition. """ openapi_types = { - 'id': 'str', - 'production': 'bool', - 'type': 'str', - 'mass_g': 'int', - 'order': 'Order' + "id": "str", + "production": "bool", + "type": "str", + "mass_g": "int", + "order": "Order", } attribute_map = { - 'id': 'id', - 'production': 'production', - 'type': 'type', - 'mass_g': 'mass_g', - 'order': 'order' + "id": "id", + "production": "production", + "type": "type", + "mass_g": "mass_g", + "order": "order", } - def __init__(self, id=None, production=None, type=None, mass_g=None, order=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + production=None, + type=None, + mass_g=None, + order=None, + local_vars_configuration=None, + ): # noqa: E501 """Estimate - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -89,7 +97,9 @@ def id(self, id): :param id: The id of this Estimate. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and id is None + ): # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -114,8 +124,12 @@ def production(self, production): :param production: The production of this Estimate. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 - raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and production is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `production`, must not be `None`" + ) # noqa: E501 self._production = production @@ -139,8 +153,12 @@ def type(self, type): :param type: The type of this Estimate. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501 - raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and type is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `type`, must not be `None`" + ) # noqa: E501 self._type = type @@ -197,18 +215,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/estimate_list_response.py b/patch_api/models/estimate_list_response.py index 1b42b43..ccb0a68 100644 --- a/patch_api/models/estimate_list_response.py +++ b/patch_api/models/estimate_list_response.py @@ -34,20 +34,27 @@ class EstimateListResponse(object): and the value is json key in definition. """ openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'list[Estimate]', - 'meta': 'MetaIndexObject' + "success": "bool", + "error": "object", + "data": "list[Estimate]", + "meta": "MetaIndexObject", } attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data', - 'meta': 'meta' + "success": "success", + "error": "error", + "data": "data", + "meta": "meta", } - def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + success=None, + error=None, + data=None, + meta=None, + local_vars_configuration=None, + ): # noqa: E501 """EstimateListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -82,8 +89,12 @@ def success(self, success): :param success: The success of this EstimateListResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -126,8 +137,12 @@ def data(self, data): :param data: The data of this EstimateListResponse. # noqa: E501 :type: list[Estimate] """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -149,8 +164,12 @@ def meta(self, meta): :param meta: The meta of this EstimateListResponse. # noqa: E501 :type: MetaIndexObject """ - if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 - raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and meta is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `meta`, must not be `None`" + ) # noqa: E501 self._meta = meta @@ -161,18 +180,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/estimate_response.py b/patch_api/models/estimate_response.py index bee841e..f15ac7c 100644 --- a/patch_api/models/estimate_response.py +++ b/patch_api/models/estimate_response.py @@ -33,19 +33,13 @@ class EstimateResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'Estimate' - } - - attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data' - } - - def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"success": "bool", "error": "object", "data": "Estimate"} + + attribute_map = {"success": "success", "error": "error", "data": "data"} + + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 """EstimateResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +72,12 @@ def success(self, success): :param success: The success of this EstimateResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -122,8 +120,12 @@ def data(self, data): :param data: The data of this EstimateResponse. # noqa: E501 :type: Estimate """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -134,18 +136,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/highlight.py b/patch_api/models/highlight.py index e7eec9e..d33d028 100644 --- a/patch_api/models/highlight.py +++ b/patch_api/models/highlight.py @@ -33,17 +33,13 @@ class Highlight(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'slug': 'str', - 'title': 'str' - } + openapi_types = {"slug": "str", "title": "str"} - attribute_map = { - 'slug': 'slug', - 'title': 'title' - } + attribute_map = {"slug": "slug", "title": "title"} - def __init__(self, slug=None, title=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, slug=None, title=None, local_vars_configuration=None + ): # noqa: E501 """Highlight - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -76,8 +72,12 @@ def slug(self, slug): :param slug: The slug of this Highlight. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and slug is None: # noqa: E501 - raise ValueError("Invalid value for `slug`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and slug is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `slug`, must not be `None`" + ) # noqa: E501 self._slug = slug @@ -101,8 +101,12 @@ def title(self, title): :param title: The title of this Highlight. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and title is None: # noqa: E501 - raise ValueError("Invalid value for `title`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and title is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `title`, must not be `None`" + ) # noqa: E501 self._title = title @@ -113,18 +117,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/meta_index_object.py b/patch_api/models/meta_index_object.py index 5de83d5..cbc5313 100644 --- a/patch_api/models/meta_index_object.py +++ b/patch_api/models/meta_index_object.py @@ -33,17 +33,13 @@ class MetaIndexObject(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'prev_page': 'int', - 'next_page': 'int' - } + openapi_types = {"prev_page": "int", "next_page": "int"} - attribute_map = { - 'prev_page': 'prev_page', - 'next_page': 'next_page' - } + attribute_map = {"prev_page": "prev_page", "next_page": "next_page"} - def __init__(self, prev_page=None, next_page=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, prev_page=None, next_page=None, local_vars_configuration=None + ): # noqa: E501 """MetaIndexObject - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -105,18 +101,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/order.py b/patch_api/models/order.py index a17da53..fcf8ed5 100644 --- a/patch_api/models/order.py +++ b/patch_api/models/order.py @@ -34,34 +34,48 @@ class Order(object): and the value is json key in definition. """ openapi_types = { - 'id': 'str', - 'created_at': 'datetime', - 'mass_g': 'int', - 'production': 'bool', - 'state': 'str', - 'allocation_state': 'str', - 'price_cents_usd': 'int', - 'patch_fee_cents_usd': 'int', - 'allocations': 'list[Allocation]', - 'registry_url': 'str', - 'metadata': 'object' + "id": "str", + "created_at": "datetime", + "mass_g": "int", + "production": "bool", + "state": "str", + "allocation_state": "str", + "price_cents_usd": "int", + "patch_fee_cents_usd": "int", + "allocations": "list[Allocation]", + "registry_url": "str", + "metadata": "object", } attribute_map = { - 'id': 'id', - 'created_at': 'created_at', - 'mass_g': 'mass_g', - 'production': 'production', - 'state': 'state', - 'allocation_state': 'allocation_state', - 'price_cents_usd': 'price_cents_usd', - 'patch_fee_cents_usd': 'patch_fee_cents_usd', - 'allocations': 'allocations', - 'registry_url': 'registry_url', - 'metadata': 'metadata' + "id": "id", + "created_at": "created_at", + "mass_g": "mass_g", + "production": "production", + "state": "state", + "allocation_state": "allocation_state", + "price_cents_usd": "price_cents_usd", + "patch_fee_cents_usd": "patch_fee_cents_usd", + "allocations": "allocations", + "registry_url": "registry_url", + "metadata": "metadata", } - def __init__(self, id=None, created_at=None, mass_g=None, production=None, state=None, allocation_state=None, price_cents_usd=None, patch_fee_cents_usd=None, allocations=None, registry_url=None, metadata=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + created_at=None, + mass_g=None, + production=None, + state=None, + allocation_state=None, + price_cents_usd=None, + patch_fee_cents_usd=None, + allocations=None, + registry_url=None, + metadata=None, + local_vars_configuration=None, + ): # noqa: E501 """Order - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -114,7 +128,9 @@ def id(self, id): :param id: The id of this Order. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and id is None + ): # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -162,14 +178,28 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this Order. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and mass_g is None: # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must not be `None`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g > 2000000000): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `2000000000`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g < 0): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `0`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and mass_g is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must not be `None`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g > 2000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value less than or equal to `2000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value greater than or equal to `0`" + ) # noqa: E501 self._mass_g = mass_g @@ -193,8 +223,12 @@ def production(self, production): :param production: The production of this Order. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 - raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and production is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `production`, must not be `None`" + ) # noqa: E501 self._production = production @@ -218,13 +252,27 @@ def state(self, state): :param state: The state of this Order. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and state is None: # noqa: E501 - raise ValueError("Invalid value for `state`, must not be `None`") # noqa: E501 - allowed_values = ["draft", "placed", "processing", "complete", "cancelled"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and state not in allowed_values: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and state is None + ): # noqa: E501 raise ValueError( - "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 - .format(state, allowed_values) + "Invalid value for `state`, must not be `None`" + ) # noqa: E501 + allowed_values = [ + "draft", + "placed", + "processing", + "complete", + "cancelled", + ] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and state not in allowed_values + ): # noqa: E501 + raise ValueError( + "Invalid value for `state` ({0}), must be one of {1}".format( # noqa: E501 + state, allowed_values + ) ) self._state = state @@ -249,13 +297,22 @@ def allocation_state(self, allocation_state): :param allocation_state: The allocation_state of this Order. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and allocation_state is None: # noqa: E501 - raise ValueError("Invalid value for `allocation_state`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and allocation_state is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `allocation_state`, must not be `None`" + ) # noqa: E501 allowed_values = ["pending", "partially_allocated", "allocated"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and allocation_state not in allowed_values: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and allocation_state not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `allocation_state` ({0}), must be one of {1}" # noqa: E501 - .format(allocation_state, allowed_values) + "Invalid value for `allocation_state` ({0}), must be one of {1}".format( # noqa: E501 + allocation_state, allowed_values + ) ) self._allocation_state = allocation_state @@ -326,8 +383,12 @@ def allocations(self, allocations): :param allocations: The allocations of this Order. # noqa: E501 :type: list[Allocation] """ - if self.local_vars_configuration.client_side_validation and allocations is None: # noqa: E501 - raise ValueError("Invalid value for `allocations`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and allocations is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `allocations`, must not be `None`" + ) # noqa: E501 self._allocations = allocations @@ -374,8 +435,12 @@ def metadata(self, metadata): :param metadata: The metadata of this Order. # noqa: E501 :type: object """ - if self.local_vars_configuration.client_side_validation and metadata is None: # noqa: E501 - raise ValueError("Invalid value for `metadata`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and metadata is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `metadata`, must not be `None`" + ) # noqa: E501 self._metadata = metadata @@ -386,18 +451,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/order_list_response.py b/patch_api/models/order_list_response.py index d9c6b4c..a558841 100644 --- a/patch_api/models/order_list_response.py +++ b/patch_api/models/order_list_response.py @@ -34,20 +34,27 @@ class OrderListResponse(object): and the value is json key in definition. """ openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'list[Order]', - 'meta': 'MetaIndexObject' + "success": "bool", + "error": "object", + "data": "list[Order]", + "meta": "MetaIndexObject", } attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data', - 'meta': 'meta' + "success": "success", + "error": "error", + "data": "data", + "meta": "meta", } - def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + success=None, + error=None, + data=None, + meta=None, + local_vars_configuration=None, + ): # noqa: E501 """OrderListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -82,8 +89,12 @@ def success(self, success): :param success: The success of this OrderListResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -126,8 +137,12 @@ def data(self, data): :param data: The data of this OrderListResponse. # noqa: E501 :type: list[Order] """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -149,8 +164,12 @@ def meta(self, meta): :param meta: The meta of this OrderListResponse. # noqa: E501 :type: MetaIndexObject """ - if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 - raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and meta is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `meta`, must not be `None`" + ) # noqa: E501 self._meta = meta @@ -161,18 +180,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/order_response.py b/patch_api/models/order_response.py index ffc9f94..971e9a1 100644 --- a/patch_api/models/order_response.py +++ b/patch_api/models/order_response.py @@ -33,19 +33,13 @@ class OrderResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'Order' - } - - attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data' - } - - def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"success": "bool", "error": "object", "data": "Order"} + + attribute_map = {"success": "success", "error": "error", "data": "data"} + + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 """OrderResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +72,12 @@ def success(self, success): :param success: The success of this OrderResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -122,8 +120,12 @@ def data(self, data): :param data: The data of this OrderResponse. # noqa: E501 :type: Order """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -134,18 +136,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/parent_technology_type.py b/patch_api/models/parent_technology_type.py index 3ebccce..8b94940 100644 --- a/patch_api/models/parent_technology_type.py +++ b/patch_api/models/parent_technology_type.py @@ -33,17 +33,13 @@ class ParentTechnologyType(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'slug': 'str', - 'name': 'str' - } + openapi_types = {"slug": "str", "name": "str"} - attribute_map = { - 'slug': 'slug', - 'name': 'name' - } + attribute_map = {"slug": "slug", "name": "name"} - def __init__(self, slug=None, name=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, slug=None, name=None, local_vars_configuration=None + ): # noqa: E501 """ParentTechnologyType - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -111,18 +107,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/photo.py b/patch_api/models/photo.py index 7716e55..65be8bc 100644 --- a/patch_api/models/photo.py +++ b/patch_api/models/photo.py @@ -33,15 +33,9 @@ class Photo(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'url': 'str', - 'id': 'str' - } + openapi_types = {"url": "str", "id": "str"} - attribute_map = { - 'url': 'url', - 'id': 'id' - } + attribute_map = {"url": "url", "id": "id"} def __init__(self, url=None, id=None, local_vars_configuration=None): # noqa: E501 """Photo - a model defined in OpenAPI""" # noqa: E501 @@ -74,8 +68,12 @@ def url(self, url): :param url: The url of this Photo. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and url is None: # noqa: E501 - raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and url is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `url`, must not be `None`" + ) # noqa: E501 self._url = url @@ -97,7 +95,9 @@ def id(self, id): :param id: The id of this Photo. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and id is None + ): # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -109,18 +109,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/preference.py b/patch_api/models/preference.py index ff30fc6..ad87aa0 100644 --- a/patch_api/models/preference.py +++ b/patch_api/models/preference.py @@ -33,19 +33,21 @@ class Preference(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'id': 'str', - 'allocation_percentage': 'int', - 'project': 'Project' - } + openapi_types = {"id": "str", "allocation_percentage": "int", "project": "Project"} attribute_map = { - 'id': 'id', - 'allocation_percentage': 'allocation_percentage', - 'project': 'project' + "id": "id", + "allocation_percentage": "allocation_percentage", + "project": "project", } - def __init__(self, id=None, allocation_percentage=None, project=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + allocation_percentage=None, + project=None, + local_vars_configuration=None, + ): # noqa: E501 """Preference - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -80,7 +82,9 @@ def id(self, id): :param id: The id of this Preference. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and id is None + ): # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -105,8 +109,13 @@ def allocation_percentage(self, allocation_percentage): :param allocation_percentage: The allocation_percentage of this Preference. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and allocation_percentage is None: # noqa: E501 - raise ValueError("Invalid value for `allocation_percentage`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and allocation_percentage is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `allocation_percentage`, must not be `None`" + ) # noqa: E501 self._allocation_percentage = allocation_percentage @@ -130,8 +139,12 @@ def project(self, project): :param project: The project of this Preference. # noqa: E501 :type: Project """ - if self.local_vars_configuration.client_side_validation and project is None: # noqa: E501 - raise ValueError("Invalid value for `project`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and project is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `project`, must not be `None`" + ) # noqa: E501 self._project = project @@ -142,18 +155,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/preference_list_response.py b/patch_api/models/preference_list_response.py index 7ed2d12..0e06bef 100644 --- a/patch_api/models/preference_list_response.py +++ b/patch_api/models/preference_list_response.py @@ -34,20 +34,27 @@ class PreferenceListResponse(object): and the value is json key in definition. """ openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'list[Preference]', - 'meta': 'MetaIndexObject' + "success": "bool", + "error": "object", + "data": "list[Preference]", + "meta": "MetaIndexObject", } attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data', - 'meta': 'meta' + "success": "success", + "error": "error", + "data": "data", + "meta": "meta", } - def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + success=None, + error=None, + data=None, + meta=None, + local_vars_configuration=None, + ): # noqa: E501 """PreferenceListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -82,8 +89,12 @@ def success(self, success): :param success: The success of this PreferenceListResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -126,8 +137,12 @@ def data(self, data): :param data: The data of this PreferenceListResponse. # noqa: E501 :type: list[Preference] """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -149,8 +164,12 @@ def meta(self, meta): :param meta: The meta of this PreferenceListResponse. # noqa: E501 :type: MetaIndexObject """ - if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 - raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and meta is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `meta`, must not be `None`" + ) # noqa: E501 self._meta = meta @@ -161,18 +180,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/preference_response.py b/patch_api/models/preference_response.py index 4fa0965..73d5fc4 100644 --- a/patch_api/models/preference_response.py +++ b/patch_api/models/preference_response.py @@ -33,19 +33,13 @@ class PreferenceResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'Preference' - } - - attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data' - } - - def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"success": "bool", "error": "object", "data": "Preference"} + + attribute_map = {"success": "success", "error": "error", "data": "data"} + + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 """PreferenceResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +72,12 @@ def success(self, success): :param success: The success of this PreferenceResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -122,8 +120,12 @@ def data(self, data): :param data: The data of this PreferenceResponse. # noqa: E501 :type: Preference """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -134,18 +136,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/project.py b/patch_api/models/project.py index 48e69a7..eea2f86 100644 --- a/patch_api/models/project.py +++ b/patch_api/models/project.py @@ -34,52 +34,72 @@ class Project(object): and the value is json key in definition. """ openapi_types = { - 'id': 'str', - 'production': 'bool', - 'name': 'str', - 'description': 'str', - 'type': 'str', - 'mechanism': 'str', - 'country': 'str', - 'state': 'str', - 'latitude': 'float', - 'longitude': 'float', - 'developer': 'str', - 'photos': 'list[Photo]', - 'average_price_per_tonne_cents_usd': 'int', - 'remaining_mass_g': 'int', - 'verifier': 'str', - 'standard': 'Standard', - 'sdgs': 'list[Sdg]', - 'tagline': 'str', - 'technology_type': 'TechnologyType', - 'highlights': 'list[Highlight]' + "id": "str", + "production": "bool", + "name": "str", + "description": "str", + "type": "str", + "mechanism": "str", + "country": "str", + "state": "str", + "latitude": "float", + "longitude": "float", + "developer": "str", + "photos": "list[Photo]", + "average_price_per_tonne_cents_usd": "int", + "remaining_mass_g": "int", + "verifier": "str", + "standard": "Standard", + "sdgs": "list[Sdg]", + "tagline": "str", + "technology_type": "TechnologyType", } attribute_map = { - 'id': 'id', - 'production': 'production', - 'name': 'name', - 'description': 'description', - 'type': 'type', - 'mechanism': 'mechanism', - 'country': 'country', - 'state': 'state', - 'latitude': 'latitude', - 'longitude': 'longitude', - 'developer': 'developer', - 'photos': 'photos', - 'average_price_per_tonne_cents_usd': 'average_price_per_tonne_cents_usd', - 'remaining_mass_g': 'remaining_mass_g', - 'verifier': 'verifier', - 'standard': 'standard', - 'sdgs': 'sdgs', - 'tagline': 'tagline', - 'technology_type': 'technology_type', - 'highlights': 'highlights' + "id": "id", + "production": "production", + "name": "name", + "description": "description", + "type": "type", + "mechanism": "mechanism", + "country": "country", + "state": "state", + "latitude": "latitude", + "longitude": "longitude", + "developer": "developer", + "photos": "photos", + "average_price_per_tonne_cents_usd": "average_price_per_tonne_cents_usd", + "remaining_mass_g": "remaining_mass_g", + "verifier": "verifier", + "standard": "standard", + "sdgs": "sdgs", + "tagline": "tagline", + "technology_type": "technology_type", } - def __init__(self, id=None, production=None, name=None, description=None, type=None, mechanism=None, country=None, state=None, latitude=None, longitude=None, developer=None, photos=None, average_price_per_tonne_cents_usd=None, remaining_mass_g=None, verifier=None, standard=None, sdgs=None, tagline=None, technology_type=None, highlights=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + production=None, + name=None, + description=None, + type=None, + mechanism=None, + country=None, + state=None, + latitude=None, + longitude=None, + developer=None, + photos=None, + average_price_per_tonne_cents_usd=None, + remaining_mass_g=None, + verifier=None, + standard=None, + sdgs=None, + tagline=None, + technology_type=None, + local_vars_configuration=None, + ): # noqa: E501 """Project - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -104,7 +124,6 @@ def __init__(self, id=None, production=None, name=None, description=None, type=N self._sdgs = None self._tagline = None self._technology_type = None - self._highlights = None self.discriminator = None self.id = id @@ -130,7 +149,6 @@ def __init__(self, id=None, production=None, name=None, description=None, type=N if tagline is not None: self.tagline = tagline self.technology_type = technology_type - self.highlights = highlights @property def id(self): @@ -152,7 +170,9 @@ def id(self, id): :param id: The id of this Project. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and id is None + ): # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -177,8 +197,12 @@ def production(self, production): :param production: The production of this Project. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 - raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and production is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `production`, must not be `None`" + ) # noqa: E501 self._production = production @@ -202,8 +226,12 @@ def name(self, name): :param name: The name of this Project. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501 - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and name is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `name`, must not be `None`" + ) # noqa: E501 self._name = name @@ -227,8 +255,12 @@ def description(self, description): :param description: The description of this Project. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and description is None: # noqa: E501 - raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and description is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `description`, must not be `None`" + ) # noqa: E501 self._description = description @@ -276,10 +308,14 @@ def mechanism(self, mechanism): :type: str """ allowed_values = ["removal", "avoidance"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and mechanism not in allowed_values: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mechanism not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `mechanism` ({0}), must be one of {1}" # noqa: E501 - .format(mechanism, allowed_values) + "Invalid value for `mechanism` ({0}), must be one of {1}".format( # noqa: E501 + mechanism, allowed_values + ) ) self._mechanism = mechanism @@ -304,8 +340,12 @@ def country(self, country): :param country: The country of this Project. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and country is None: # noqa: E501 - raise ValueError("Invalid value for `country`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and country is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `country`, must not be `None`" + ) # noqa: E501 self._country = country @@ -398,8 +438,12 @@ def developer(self, developer): :param developer: The developer of this Project. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and developer is None: # noqa: E501 - raise ValueError("Invalid value for `developer`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and developer is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `developer`, must not be `None`" + ) # noqa: E501 self._developer = developer @@ -446,8 +490,13 @@ def average_price_per_tonne_cents_usd(self, average_price_per_tonne_cents_usd): :param average_price_per_tonne_cents_usd: The average_price_per_tonne_cents_usd of this Project. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and average_price_per_tonne_cents_usd is None: # noqa: E501 - raise ValueError("Invalid value for `average_price_per_tonne_cents_usd`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and average_price_per_tonne_cents_usd is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `average_price_per_tonne_cents_usd`, must not be `None`" + ) # noqa: E501 self._average_price_per_tonne_cents_usd = average_price_per_tonne_cents_usd @@ -471,8 +520,13 @@ def remaining_mass_g(self, remaining_mass_g): :param remaining_mass_g: The remaining_mass_g of this Project. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and remaining_mass_g is None: # noqa: E501 - raise ValueError("Invalid value for `remaining_mass_g`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and remaining_mass_g is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `remaining_mass_g`, must not be `None`" + ) # noqa: E501 self._remaining_mass_g = remaining_mass_g @@ -586,36 +640,16 @@ def technology_type(self, technology_type): :param technology_type: The technology_type of this Project. # noqa: E501 :type: TechnologyType """ - if self.local_vars_configuration.client_side_validation and technology_type is None: # noqa: E501 - raise ValueError("Invalid value for `technology_type`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and technology_type is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `technology_type`, must not be `None`" + ) # noqa: E501 self._technology_type = technology_type - @property - def highlights(self): - """Gets the highlights of this Project. # noqa: E501 - - An array of objects containing the highlight's slug and title. A highlight's title is a short string that spotlights a characteristic about the project. # noqa: E501 - - :return: The highlights of this Project. # noqa: E501 - :rtype: list[Highlight] - """ - return self._highlights - - @highlights.setter - def highlights(self, highlights): - """Sets the highlights of this Project. - - An array of objects containing the highlight's slug and title. A highlight's title is a short string that spotlights a characteristic about the project. # noqa: E501 - - :param highlights: The highlights of this Project. # noqa: E501 - :type: list[Highlight] - """ - if self.local_vars_configuration.client_side_validation and highlights is None: # noqa: E501 - raise ValueError("Invalid value for `highlights`, must not be `None`") # noqa: E501 - - self._highlights = highlights - def to_dict(self): """Returns the model properties as a dict""" result = {} @@ -623,18 +657,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/project_list_response.py b/patch_api/models/project_list_response.py index 7b627cd..466d482 100644 --- a/patch_api/models/project_list_response.py +++ b/patch_api/models/project_list_response.py @@ -34,20 +34,27 @@ class ProjectListResponse(object): and the value is json key in definition. """ openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'list[Project]', - 'meta': 'MetaIndexObject' + "success": "bool", + "error": "object", + "data": "list[Project]", + "meta": "MetaIndexObject", } attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data', - 'meta': 'meta' + "success": "success", + "error": "error", + "data": "data", + "meta": "meta", } - def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + success=None, + error=None, + data=None, + meta=None, + local_vars_configuration=None, + ): # noqa: E501 """ProjectListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -82,8 +89,12 @@ def success(self, success): :param success: The success of this ProjectListResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -126,8 +137,12 @@ def data(self, data): :param data: The data of this ProjectListResponse. # noqa: E501 :type: list[Project] """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -149,8 +164,12 @@ def meta(self, meta): :param meta: The meta of this ProjectListResponse. # noqa: E501 :type: MetaIndexObject """ - if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 - raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and meta is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `meta`, must not be `None`" + ) # noqa: E501 self._meta = meta @@ -161,18 +180,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/project_response.py b/patch_api/models/project_response.py index 25a1b93..3de074c 100644 --- a/patch_api/models/project_response.py +++ b/patch_api/models/project_response.py @@ -33,19 +33,13 @@ class ProjectResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'Project' - } - - attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data' - } - - def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"success": "bool", "error": "object", "data": "Project"} + + attribute_map = {"success": "success", "error": "error", "data": "data"} + + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 """ProjectResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +72,12 @@ def success(self, success): :param success: The success of this ProjectResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -122,8 +120,12 @@ def data(self, data): :param data: The data of this ProjectResponse. # noqa: E501 :type: Project """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -134,18 +136,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/sdg.py b/patch_api/models/sdg.py index 0faebdd..9c3e143 100644 --- a/patch_api/models/sdg.py +++ b/patch_api/models/sdg.py @@ -34,20 +34,27 @@ class Sdg(object): and the value is json key in definition. """ openapi_types = { - 'title': 'str', - 'number': 'int', - 'description': 'str', - 'url': 'str' + "title": "str", + "number": "int", + "description": "str", + "url": "str", } attribute_map = { - 'title': 'title', - 'number': 'number', - 'description': 'description', - 'url': 'url' + "title": "title", + "number": "number", + "description": "description", + "url": "url", } - def __init__(self, title=None, number=None, description=None, url=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + title=None, + number=None, + description=None, + url=None, + local_vars_configuration=None, + ): # noqa: E501 """Sdg - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -84,8 +91,12 @@ def title(self, title): :param title: The title of this Sdg. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and title is None: # noqa: E501 - raise ValueError("Invalid value for `title`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and title is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `title`, must not be `None`" + ) # noqa: E501 self._title = title @@ -109,8 +120,12 @@ def number(self, number): :param number: The number of this Sdg. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and number is None: # noqa: E501 - raise ValueError("Invalid value for `number`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and number is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `number`, must not be `None`" + ) # noqa: E501 self._number = number @@ -134,8 +149,12 @@ def description(self, description): :param description: The description of this Sdg. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and description is None: # noqa: E501 - raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and description is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `description`, must not be `None`" + ) # noqa: E501 self._description = description @@ -159,8 +178,12 @@ def url(self, url): :param url: The url of this Sdg. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and url is None: # noqa: E501 - raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and url is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `url`, must not be `None`" + ) # noqa: E501 self._url = url @@ -171,18 +194,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/standard.py b/patch_api/models/standard.py index 42c874d..40f18a1 100644 --- a/patch_api/models/standard.py +++ b/patch_api/models/standard.py @@ -33,19 +33,13 @@ class Standard(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'type': 'str', - 'acronym': 'str', - 'description': 'str' - } - - attribute_map = { - 'type': 'type', - 'acronym': 'acronym', - 'description': 'description' - } - - def __init__(self, type=None, acronym=None, description=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"type": "str", "acronym": "str", "description": "str"} + + attribute_map = {"type": "type", "acronym": "acronym", "description": "description"} + + def __init__( + self, type=None, acronym=None, description=None, local_vars_configuration=None + ): # noqa: E501 """Standard - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -80,8 +74,12 @@ def type(self, type): :param type: The type of this Standard. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501 - raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and type is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `type`, must not be `None`" + ) # noqa: E501 self._type = type @@ -105,8 +103,12 @@ def acronym(self, acronym): :param acronym: The acronym of this Standard. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and acronym is None: # noqa: E501 - raise ValueError("Invalid value for `acronym`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and acronym is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `acronym`, must not be `None`" + ) # noqa: E501 self._acronym = acronym @@ -130,8 +132,12 @@ def description(self, description): :param description: The description of this Standard. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and description is None: # noqa: E501 - raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and description is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `description`, must not be `None`" + ) # noqa: E501 self._description = description @@ -142,18 +148,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/technology_type.py b/patch_api/models/technology_type.py index c8ca3e2..9f59dac 100644 --- a/patch_api/models/technology_type.py +++ b/patch_api/models/technology_type.py @@ -34,18 +34,24 @@ class TechnologyType(object): and the value is json key in definition. """ openapi_types = { - 'slug': 'str', - 'name': 'str', - 'parent_technology_type': 'ParentTechnologyType' + "slug": "str", + "name": "str", + "parent_technology_type": "ParentTechnologyType", } attribute_map = { - 'slug': 'slug', - 'name': 'name', - 'parent_technology_type': 'parent_technology_type' + "slug": "slug", + "name": "name", + "parent_technology_type": "parent_technology_type", } - def __init__(self, slug=None, name=None, parent_technology_type=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + slug=None, + name=None, + parent_technology_type=None, + local_vars_configuration=None, + ): # noqa: E501 """TechnologyType - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -81,8 +87,12 @@ def slug(self, slug): :param slug: The slug of this TechnologyType. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and slug is None: # noqa: E501 - raise ValueError("Invalid value for `slug`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and slug is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `slug`, must not be `None`" + ) # noqa: E501 self._slug = slug @@ -106,8 +116,12 @@ def name(self, name): :param name: The name of this TechnologyType. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501 - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and name is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `name`, must not be `None`" + ) # noqa: E501 self._name = name @@ -139,18 +153,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/models/technology_type_list_response.py b/patch_api/models/technology_type_list_response.py index 4037ed3..a6d3d18 100644 --- a/patch_api/models/technology_type_list_response.py +++ b/patch_api/models/technology_type_list_response.py @@ -34,18 +34,16 @@ class TechnologyTypeListResponse(object): and the value is json key in definition. """ openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'list[TechnologyType]' + "success": "bool", + "error": "object", + "data": "list[TechnologyType]", } - attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data' - } + attribute_map = {"success": "success", "error": "error", "data": "data"} - def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 """TechnologyTypeListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +76,12 @@ def success(self, success): :param success: The success of this TechnologyTypeListResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -122,8 +124,12 @@ def data(self, data): :param data: The data of this TechnologyTypeListResponse. # noqa: E501 :type: list[TechnologyType] """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -134,18 +140,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value diff --git a/patch_api/rest.py b/patch_api/rest.py index 96b66ec..20090ee 100644 --- a/patch_api/rest.py +++ b/patch_api/rest.py @@ -20,6 +20,7 @@ import ssl import certifi + # python 2 and python 3 compatibility library import six from six.moves.urllib.parse import urlencode @@ -33,7 +34,6 @@ class RESTResponse(io.IOBase): - def __init__(self, resp): self.urllib3_response = resp self.status = resp.status @@ -50,7 +50,6 @@ def getheader(self, name, default=None): class RESTClientObject(object): - def __init__(self, api_key, configuration, pools_size=4, maxsize=None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 @@ -75,10 +74,12 @@ def __init__(self, api_key, configuration, pools_size=4, maxsize=None): addition_pool_args = {} if configuration.assert_hostname is not None: - addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + addition_pool_args[ + "assert_hostname" + ] = configuration.assert_hostname # noqa: E501 if configuration.retries is not None: - addition_pool_args['retries'] = configuration.retries + addition_pool_args["retries"] = configuration.retries if maxsize is None: if configuration.connection_pool_maxsize is not None: @@ -117,31 +118,39 @@ def recursive_urlencode(self, d): >>> recursive_urlencode(data) u'a=b%26c&j=k&d[e][f%26g]=h%2Ai' """ + def recursion(d, base=[]): pairs = [] for key, value in d.items(): new_base = base + [key] - if hasattr(value, 'values'): + if hasattr(value, "values"): pairs += recursion(value, new_base) else: new_pair = None if len(new_base) > 1: first = urllib.parse.quote(new_base.pop(0)) rest = map(lambda x: urllib.parse.quote(x), new_base) - new_pair = "%s[%s]=%s" % (first, ']['.join(rest), urllib.parse.quote(str(value))) + new_pair = "%s[%s]=%s" % ( + first, + "][".join(rest), + urllib.parse.quote(str(value)), + ) else: - new_pair = "%s=%s" % (urllib.parse.quote(str(key)), urllib.parse.quote(str(value))) + new_pair = "%s=%s" % ( + urllib.parse.quote(str(key)), + urllib.parse.quote(str(value)), + ) pairs.append(new_pair) return pairs - return '&'.join(recursion(d)) + return "&".join(recursion(d)) def encoded_query_params(self, query_params): if not query_params: - return '' + return "" - final_query_params = '' + final_query_params = "" for key, value in query_params: if isinstance(value, dict): nested_param = {} @@ -154,11 +163,19 @@ def encoded_query_params(self, query_params): final_query_params += "&" final_query_params += urlencode(query_params) - return '?' + final_query_params - - def request(self, method, url, query_params=None, headers=None, - body=None, post_params=None, _preload_content=True, - _request_timeout=None): + return "?" + final_query_params + + def request( + self, + method, + url, + query_params=None, + headers=None, + body=None, + post_params=None, + _preload_content=True, + _request_timeout=None, + ): """Perform requests. :param method: http request method @@ -178,8 +195,7 @@ def request(self, method, url, query_params=None, headers=None, (connection, read) timeouts. """ method = method.upper() - assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', - 'PATCH', 'OPTIONS'] + assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"] if post_params and body: raise ApiValueError( @@ -191,64 +207,76 @@ def request(self, method, url, query_params=None, headers=None, timeout = None if _request_timeout: - if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 + if isinstance( + _request_timeout, (int,) if six.PY3 else (int, long) + ): # noqa: E501,F821 timeout = urllib3.Timeout(total=_request_timeout) - elif (isinstance(_request_timeout, tuple) and - len(_request_timeout) == 2): + elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: timeout = urllib3.Timeout( - connect=_request_timeout[0], read=_request_timeout[1]) + connect=_request_timeout[0], read=_request_timeout[1] + ) - if 'Content-Type' not in headers: - headers['Content-Type'] = 'application/json' + if "Content-Type" not in headers: + headers["Content-Type"] = "application/json" - if 'Authorization' not in headers: - headers['Authorization'] = 'Bearer ' + self.api_key + if "Authorization" not in headers: + headers["Authorization"] = "Bearer " + self.api_key try: # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]: url += self.encoded_query_params(query_params) - if re.search('json', headers['Content-Type'], re.IGNORECASE): + if re.search("json", headers["Content-Type"], re.IGNORECASE): request_body = None if body is not None: request_body = json.dumps(body) r = self.pool_manager.request( - method, url, + method, + url, body=request_body, preload_content=_preload_content, timeout=timeout, - headers=headers) - elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + headers=headers, + ) + elif ( + headers["Content-Type"] == "application/x-www-form-urlencoded" + ): # noqa: E501 r = self.pool_manager.request( - method, url, + method, + url, fields=post_params, encode_multipart=False, preload_content=_preload_content, timeout=timeout, - headers=headers) - elif headers['Content-Type'] == 'multipart/form-data': + headers=headers, + ) + elif headers["Content-Type"] == "multipart/form-data": # must del headers['Content-Type'], or the correct # Content-Type which generated by urllib3 will be # overwritten. - del headers['Content-Type'] + del headers["Content-Type"] r = self.pool_manager.request( - method, url, + method, + url, fields=post_params, encode_multipart=True, preload_content=_preload_content, timeout=timeout, - headers=headers) + headers=headers, + ) # Pass a `string` parameter directly in the body to support # other content types than Json when `body` argument is # provided in serialized form elif isinstance(body, str) or isinstance(body, bytes): request_body = body r = self.pool_manager.request( - method, url, + method, + url, body=request_body, preload_content=_preload_content, timeout=timeout, - headers=headers) + headers=headers, + ) else: # Cannot generate the request from given parameters msg = """Cannot prepare a request message for provided @@ -258,10 +286,13 @@ def request(self, method, url, query_params=None, headers=None, # For `GET`, `HEAD` else: url += self.encoded_query_params(query_params) - r = self.pool_manager.request(method, url, - preload_content=_preload_content, - timeout=timeout, - headers=headers) + r = self.pool_manager.request( + method, + url, + preload_content=_preload_content, + timeout=timeout, + headers=headers, + ) except urllib3.exceptions.SSLError as e: msg = "{0}\n{1}".format(type(e).__name__, str(e)) raise ApiException(status=0, reason=msg) @@ -272,7 +303,7 @@ def request(self, method, url, query_params=None, headers=None, # In the python 3, the response.data is bytes. # we need to decode it to string. if six.PY3: - r.data = r.data.decode('utf8') + r.data = r.data.decode("utf8") # log response body logger.debug("response body: %s", r.data) @@ -282,67 +313,139 @@ def request(self, method, url, query_params=None, headers=None, return r - def GET(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None): - return self.request("GET", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def HEAD(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None): - return self.request("HEAD", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def OPTIONS(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("OPTIONS", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def DELETE(self, url, headers=None, query_params=None, body=None, - _preload_content=True, _request_timeout=None): - return self.request("DELETE", url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def POST(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("POST", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def PUT(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("PUT", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def PATCH(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("PATCH", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + def GET( + self, + url, + headers=None, + query_params=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "GET", + url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params, + ) + + def HEAD( + self, + url, + headers=None, + query_params=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "HEAD", + url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params, + ) + + def OPTIONS( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "OPTIONS", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def DELETE( + self, + url, + headers=None, + query_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "DELETE", + url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def POST( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "POST", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def PUT( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "PUT", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def PATCH( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "PATCH", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) diff --git a/setup.py b/setup.py index ea9ff3a..016ea3e 100644 --- a/setup.py +++ b/setup.py @@ -21,9 +21,9 @@ # http://pypi.python.org/pypi/setuptools REQUIRES = [ - "urllib3 >= 1.25.3", - "python-dateutil", - "certifi", + "urllib3 >= 1.25.3", + "python-dateutil", + "certifi", ] setup( @@ -40,5 +40,5 @@ include_package_data=True, long_description="""\ The core API used to integrate with Patch's service # noqa: E501 - """ + """, ) From 633b5e40f642a82a7bb90189853c23d6d3f45447 Mon Sep 17 00:00:00 2001 From: Aliana Melendez Date: Tue, 9 Nov 2021 17:53:38 -0500 Subject: [PATCH 5/6] Reran makefile to pull additional model changes --- patch_api/models/__init__.py | 1 + patch_api/models/project.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/patch_api/models/__init__.py b/patch_api/models/__init__.py index 1bb69c1..20091c3 100644 --- a/patch_api/models/__init__.py +++ b/patch_api/models/__init__.py @@ -37,6 +37,7 @@ from patch_api.models.estimate import Estimate 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.meta_index_object import MetaIndexObject from patch_api.models.order import Order from patch_api.models.order_list_response import OrderListResponse diff --git a/patch_api/models/project.py b/patch_api/models/project.py index eea2f86..e1b8b2c 100644 --- a/patch_api/models/project.py +++ b/patch_api/models/project.py @@ -53,6 +53,7 @@ class Project(object): "sdgs": "list[Sdg]", "tagline": "str", "technology_type": "TechnologyType", + "highlights": "list[Highlight]", } attribute_map = { @@ -75,6 +76,7 @@ class Project(object): "sdgs": "sdgs", "tagline": "tagline", "technology_type": "technology_type", + "highlights": "highlights", } def __init__( @@ -98,6 +100,7 @@ def __init__( sdgs=None, tagline=None, technology_type=None, + highlights=None, local_vars_configuration=None, ): # noqa: E501 """Project - a model defined in OpenAPI""" # noqa: E501 @@ -124,6 +127,7 @@ def __init__( self._sdgs = None self._tagline = None self._technology_type = None + self._highlights = None self.discriminator = None self.id = id @@ -149,6 +153,7 @@ def __init__( if tagline is not None: self.tagline = tagline self.technology_type = technology_type + self.highlights = highlights @property def id(self): @@ -650,6 +655,35 @@ def technology_type(self, technology_type): self._technology_type = technology_type + @property + def highlights(self): + """Gets the highlights of this Project. # noqa: E501 + + An array of objects containing the highlight's slug and title. A highlight's title is a short string that spotlights a characteristic about the project. # noqa: E501 + + :return: The highlights of this Project. # noqa: E501 + :rtype: list[Highlight] + """ + return self._highlights + + @highlights.setter + def highlights(self, highlights): + """Sets the highlights of this Project. + + An array of objects containing the highlight's slug and title. A highlight's title is a short string that spotlights a characteristic about the project. # noqa: E501 + + :param highlights: The highlights of this Project. # noqa: E501 + :type: list[Highlight] + """ + if ( + self.local_vars_configuration.client_side_validation and highlights is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `highlights`, must not be `None`" + ) # noqa: E501 + + self._highlights = highlights + def to_dict(self): """Returns the model properties as a dict""" result = {} From 88c06499ec921579a2fd194d14f2025c3a2e79ab Mon Sep 17 00:00:00 2001 From: Aliana Melendez Date: Fri, 12 Nov 2021 10:12:39 -0500 Subject: [PATCH 6/6] Add icon_url --- patch_api/models/highlight.py | 41 ++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/patch_api/models/highlight.py b/patch_api/models/highlight.py index d33d028..e4a801d 100644 --- a/patch_api/models/highlight.py +++ b/patch_api/models/highlight.py @@ -33,12 +33,12 @@ class Highlight(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {"slug": "str", "title": "str"} + openapi_types = {"slug": "str", "title": "str", "icon_url": "str"} - attribute_map = {"slug": "slug", "title": "title"} + attribute_map = {"slug": "slug", "title": "title", "icon_url": "icon_url"} def __init__( - self, slug=None, title=None, local_vars_configuration=None + self, slug=None, title=None, icon_url=None, local_vars_configuration=None ): # noqa: E501 """Highlight - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: @@ -47,16 +47,18 @@ def __init__( self._slug = None self._title = None + self._icon_url = None self.discriminator = None self.slug = slug self.title = title + self.icon_url = icon_url @property def slug(self): """Gets the slug of this Highlight. # noqa: E501 - A unique identifier for each highlight # noqa: E501 + A unique identifier for each highlight. # noqa: E501 :return: The slug of this Highlight. # noqa: E501 :rtype: str @@ -67,7 +69,7 @@ def slug(self): def slug(self, slug): """Sets the slug of this Highlight. - A unique identifier for each highlight # noqa: E501 + A unique identifier for each highlight. # noqa: E501 :param slug: The slug of this Highlight. # noqa: E501 :type: str @@ -110,6 +112,35 @@ def title(self, title): self._title = title + @property + def icon_url(self): + """Gets the icon_url of this Highlight. # noqa: E501 + + A URL for the corresponding icon. # noqa: E501 + + :return: The icon_url of this Highlight. # noqa: E501 + :rtype: str + """ + return self._icon_url + + @icon_url.setter + def icon_url(self, icon_url): + """Sets the icon_url of this Highlight. + + A URL for the corresponding icon. # noqa: E501 + + :param icon_url: The icon_url of this Highlight. # noqa: E501 + :type: str + """ + if ( + self.local_vars_configuration.client_side_validation and icon_url is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `icon_url`, must not be `None`" + ) # noqa: E501 + + self._icon_url = icon_url + def to_dict(self): """Returns the model properties as a dict""" result = {}