Skip to content

Commit da9b23a

Browse files
authored
Add technology_type index method (#42)
1 parent 06ac4b7 commit da9b23a

12 files changed

+482
-62
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.15.0] - 2021-10-04
9+
10+
### Added
11+
12+
- Added the ability to fetch project technology types via `api_client.technology_types.retrieve_technology_types()`
13+
814
## [1.14.0] - 2021-09-27
915

1016
### Added

patch_api/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from __future__ import absolute_import
1717

18-
__version__ = "1.14.0"
18+
__version__ = "1.15.0"
1919

2020
# import ApiClient
2121
from patch_api.api_client import ApiClient

patch_api/api/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
from patch_api.api.orders_api import OrdersApi
88
from patch_api.api.preferences_api import PreferencesApi
99
from patch_api.api.projects_api import ProjectsApi
10+
from patch_api.api.technology_types_api import TechnologyTypesApi

patch_api/api/technology_types_api.py

+194
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# coding: utf-8
2+
3+
"""
4+
Patch API V1
5+
6+
The core API used to integrate with Patch's service # noqa: E501
7+
8+
The version of the OpenAPI document: v1
9+
10+
Generated by: https://openapi-generator.tech
11+
"""
12+
13+
14+
from __future__ import absolute_import
15+
16+
import re # noqa: F401
17+
18+
# python 2 and python 3 compatibility library
19+
import six
20+
21+
from patch_api.exceptions import ApiTypeError, ApiValueError
22+
23+
24+
class TechnologyTypesApi(object):
25+
"""NOTE: This class is auto generated by OpenAPI Generator
26+
Ref: https://openapi-generator.tech
27+
28+
Do not edit the class manually.
29+
"""
30+
31+
ALLOWED_QUERY_PARAMS = [
32+
"mass_g",
33+
"total_price_cents_usd",
34+
"project_id",
35+
"page",
36+
"distance_m",
37+
"transportation_method",
38+
"package_mass_g",
39+
"create_order",
40+
"model",
41+
"make",
42+
"year",
43+
"transaction_value_btc_sats",
44+
"transaction_value_eth_gwei",
45+
"gas_used",
46+
"average_daily_balance_btc_sats",
47+
"average_daily_balance_eth_gwei",
48+
"timestamp",
49+
"origin_aiport",
50+
"destination_aiport",
51+
"aircraft_code",
52+
"cabin_class",
53+
"passenger_count",
54+
]
55+
56+
def __init__(self, api_client=None):
57+
self.api_client = api_client
58+
59+
def retrieve_technology_types(self, **kwargs): # noqa: E501
60+
"""Retrieves the list of technology_types # noqa: E501
61+
62+
Retrieves a list of all technology_types. # noqa: E501
63+
This method makes a synchronous HTTP request by default. To make an
64+
asynchronous HTTP request, please pass async_req=True
65+
>>> thread = api.retrieve_technology_types(async_req=True)
66+
>>> result = thread.get()
67+
68+
:param async_req bool: execute request asynchronously
69+
:param _preload_content: if False, the urllib3.HTTPResponse object will
70+
be returned without reading/decoding response
71+
data. Default is True.
72+
:param _request_timeout: timeout setting for this request. If one
73+
number provided, it will be total request
74+
timeout. It can also be a pair (tuple) of
75+
(connection, read) timeouts.
76+
:return: TechnologyTypeListResponse
77+
If the method is called asynchronously,
78+
returns the request thread.
79+
"""
80+
kwargs["_return_http_data_only"] = True
81+
return self.retrieve_technology_types_with_http_info(**kwargs) # noqa: E501
82+
83+
def retrieve_technology_types_with_http_info(self, **kwargs): # noqa: E501
84+
"""Retrieves the list of technology_types # noqa: E501
85+
86+
Retrieves a list of all technology_types. # noqa: E501
87+
This method makes a synchronous HTTP request by default. To make an
88+
asynchronous HTTP request, please pass async_req=True
89+
>>> thread = api.retrieve_technology_types_with_http_info(async_req=True)
90+
>>> result = thread.get()
91+
92+
:param async_req bool: execute request asynchronously
93+
:param _return_http_data_only: response data without head status code
94+
and headers
95+
:param _preload_content: if False, the urllib3.HTTPResponse object will
96+
be returned without reading/decoding response
97+
data. Default is True.
98+
:param _request_timeout: timeout setting for this request. If one
99+
number provided, it will be total request
100+
timeout. It can also be a pair (tuple) of
101+
(connection, read) timeouts.
102+
:return: tuple(TechnologyTypeListResponse, status_code(int), headers(HTTPHeaderDict))
103+
If the method is called asynchronously,
104+
returns the request thread.
105+
"""
106+
107+
local_var_params = locals()
108+
109+
all_params = [] # noqa: E501
110+
all_params.append("async_req")
111+
all_params.append("_return_http_data_only")
112+
all_params.append("_preload_content")
113+
all_params.append("_request_timeout")
114+
all_params.append("mass_g")
115+
all_params.append("total_price_cents_usd")
116+
all_params.append("project_id")
117+
all_params.append("metadata")
118+
all_params.append("distance_m")
119+
all_params.append("transportation_method")
120+
all_params.append("package_mass_g")
121+
all_params.append("create_order")
122+
all_params.append("make")
123+
all_params.append("model")
124+
all_params.append("year")
125+
all_params.append("transaction_value_btc_sats")
126+
all_params.append("transaction_value_eth_gwei")
127+
all_params.append("gas_used")
128+
all_params.append("transaction_value_btc_sats")
129+
all_params.append("average_daily_balance_btc_sats")
130+
all_params.append("average_daily_balance_eth_gwei")
131+
all_params.append("timestamp")
132+
all_params.append("origin_airport")
133+
all_params.append("destination_airport")
134+
all_params.append("aircraft_code")
135+
all_params.append("cabin_class")
136+
all_params.append("passenger_count")
137+
138+
for key, val in six.iteritems(local_var_params["kwargs"]):
139+
if key not in all_params:
140+
raise ApiTypeError(
141+
"Got an unexpected keyword argument '%s'"
142+
" to method retrieve_technology_types" % key
143+
)
144+
local_var_params[key] = val
145+
del local_var_params["kwargs"]
146+
147+
collection_formats = {}
148+
149+
path_params = {}
150+
151+
query_params = []
152+
153+
# do not add duplicate keys to query_params list
154+
existing_keys = []
155+
for param in query_params:
156+
existing_keys.append(param[0])
157+
158+
for key in kwargs:
159+
if key not in existing_keys:
160+
query_params.append([key, kwargs.get(key)])
161+
162+
header_params = {}
163+
164+
form_params = []
165+
local_var_files = {}
166+
167+
body_params = None
168+
# HTTP header `Accept`
169+
header_params["Accept"] = self.api_client.select_header_accept(
170+
["application/json"]
171+
) # noqa: E501
172+
173+
# Authentication setting
174+
auth_settings = ["bearer_auth"] # noqa: E501
175+
176+
return self.api_client.call_api(
177+
"/v1/projects/technology_types",
178+
"GET",
179+
path_params,
180+
query_params,
181+
header_params,
182+
body=body_params,
183+
post_params=form_params,
184+
files=local_var_files,
185+
response_type="TechnologyTypeListResponse", # noqa: E501
186+
auth_settings=auth_settings,
187+
async_req=local_var_params.get("async_req"),
188+
_return_http_data_only=local_var_params.get(
189+
"_return_http_data_only"
190+
), # noqa: E501
191+
_preload_content=local_var_params.get("_preload_content", True),
192+
_request_timeout=local_var_params.get("_request_timeout"),
193+
collection_formats=collection_formats,
194+
)

patch_api/api_client.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from patch_api.api.orders_api import OrdersApi
3030
from patch_api.api.preferences_api import PreferencesApi
3131
from patch_api.api.projects_api import ProjectsApi
32+
from patch_api.api.technology_types_api import TechnologyTypesApi
3233

3334
from patch_api import rest
3435
from patch_api.exceptions import ApiValueError
@@ -91,7 +92,7 @@ def __init__(
9192
self.default_headers[header_name] = header_value
9293
self.cookie = cookie
9394
# Set default User-Agent.
94-
self.user_agent = "patch-python/1.14.0"
95+
self.user_agent = "patch-python/1.15.0"
9596

9697
def __del__(self):
9798
if self._pool:
@@ -105,6 +106,7 @@ def __getattr__(self, method):
105106
"orders": OrdersApi,
106107
"preferences": PreferencesApi,
107108
"estimates": EstimatesApi,
109+
"technology_types": TechnologyTypesApi,
108110
}[method]
109111
return resource(api_client=self)
110112

patch_api/configuration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def to_debug_report(self):
341341
"OS: {env}\n"
342342
"Python Version: {pyversion}\n"
343343
"Version of the API: v1\n"
344-
"SDK Package Version: 1.14.0".format(
344+
"SDK Package Version: 1.15.0".format(
345345
env=sys.platform, pyversion=sys.version
346346
)
347347
)

patch_api/models/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@
5252
from patch_api.models.sdg import Sdg
5353
from patch_api.models.standard import Standard
5454
from patch_api.models.technology_type import TechnologyType
55+
from patch_api.models.technology_type_list_response import TechnologyTypeListResponse

0 commit comments

Comments
 (0)