Skip to content

Commit 7f5bcaf

Browse files
committed
Add country/type filtering for Projects
1 parent 19d1cb8 commit 7f5bcaf

12 files changed

+374
-27
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ 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.3.2] - 2021-02-16
9+
10+
### Added
11+
12+
- Adds filtering on type/country for Projects.
13+
14+
815
## [1.3.1] - 2021-02-09
916

1017
### Fixed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ patch.estimates.retrieve_estimates(page=page)
141141
### Projects
142142
Projects are the ways Patch takes CO2 out of the air. They can represent reforestation, enhanced weathering, direct air carbon capture, etc. When you place an order via Patch, it is allocated to a project.
143143

144+
When fetching projects, you can supply filters to the query to narrow your result. Currently supported filters are:
145+
- `country`
146+
- `type`
147+
144148
[API Reference](https://docs.usepatch.com/#/?id=projects)
145149

146150
#### Examples
@@ -156,6 +160,12 @@ patch.projects.retrieve_project(id=project_id)
156160
# Retrieve a list of projects
157161
page = 1 # Pass in which page of projects you'd like
158162
patch.projects.retrieve_projects(page=page)
163+
164+
# Retrieve a list of biomass projects
165+
patch.projects.retrieve_projects(type="biomass")
166+
167+
# Retrieve a list of projects from Canada
168+
patch.projects.retrieve_projects(country="CA")
159169
```
160170

161171
### Preferences

patch_api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from __future__ import absolute_import
1717

18-
__version__ = "1.3.1"
18+
__version__ = "1.3.2"
1919

2020
# import ApiClient
2121
from patch_api.api_client import ApiClient

patch_api/api/estimates_api.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ class EstimatesApi(object):
4040
"model",
4141
"make",
4242
"year",
43+
"type",
44+
"country",
4345
]
4446

4547
def __init__(self, api_client=None):
@@ -119,6 +121,8 @@ def create_flight_estimate_with_http_info(
119121
all_params.append("make")
120122
all_params.append("model")
121123
all_params.append("year")
124+
all_params.append("type")
125+
all_params.append("country")
122126

123127
for key, val in six.iteritems(local_var_params["kwargs"]):
124128
if key not in all_params:
@@ -262,6 +266,8 @@ def create_mass_estimate_with_http_info(
262266
all_params.append("make")
263267
all_params.append("model")
264268
all_params.append("year")
269+
all_params.append("type")
270+
all_params.append("country")
265271

266272
for key, val in six.iteritems(local_var_params["kwargs"]):
267273
if key not in all_params:
@@ -405,6 +411,8 @@ def create_shipping_estimate_with_http_info(
405411
all_params.append("make")
406412
all_params.append("model")
407413
all_params.append("year")
414+
all_params.append("type")
415+
all_params.append("country")
408416

409417
for key, val in six.iteritems(local_var_params["kwargs"]):
410418
if key not in all_params:
@@ -548,6 +556,8 @@ def create_vehicle_estimate_with_http_info(
548556
all_params.append("make")
549557
all_params.append("model")
550558
all_params.append("year")
559+
all_params.append("type")
560+
all_params.append("country")
551561

552562
for key, val in six.iteritems(local_var_params["kwargs"]):
553563
if key not in all_params:
@@ -685,6 +695,8 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501
685695
all_params.append("make")
686696
all_params.append("model")
687697
all_params.append("year")
698+
all_params.append("type")
699+
all_params.append("country")
688700

689701
for key, val in six.iteritems(local_var_params["kwargs"]):
690702
if key not in all_params:
@@ -812,6 +824,8 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501
812824
all_params.append("make")
813825
all_params.append("model")
814826
all_params.append("year")
827+
all_params.append("type")
828+
all_params.append("country")
815829

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

patch_api/api/orders_api.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ class OrdersApi(object):
4040
"model",
4141
"make",
4242
"year",
43+
"type",
44+
"country",
4345
]
4446

4547
def __init__(self, api_client=None):
@@ -113,6 +115,8 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501
113115
all_params.append("make")
114116
all_params.append("model")
115117
all_params.append("year")
118+
all_params.append("type")
119+
all_params.append("country")
116120

117121
for key, val in six.iteritems(local_var_params["kwargs"]):
118122
if key not in all_params:
@@ -242,6 +246,8 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa:
242246
all_params.append("make")
243247
all_params.append("model")
244248
all_params.append("year")
249+
all_params.append("type")
250+
all_params.append("country")
245251

246252
for key, val in six.iteritems(local_var_params["kwargs"]):
247253
if key not in all_params:
@@ -379,6 +385,8 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501
379385
all_params.append("make")
380386
all_params.append("model")
381387
all_params.append("year")
388+
all_params.append("type")
389+
all_params.append("country")
382390

383391
for key, val in six.iteritems(local_var_params["kwargs"]):
384392
if key not in all_params:
@@ -506,6 +514,8 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501
506514
all_params.append("make")
507515
all_params.append("model")
508516
all_params.append("year")
517+
all_params.append("type")
518+
all_params.append("country")
509519

510520
for key, val in six.iteritems(local_var_params["kwargs"]):
511521
if key not in all_params:
@@ -633,6 +643,8 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501
633643
all_params.append("make")
634644
all_params.append("model")
635645
all_params.append("year")
646+
all_params.append("type")
647+
all_params.append("country")
636648

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

patch_api/api/preferences_api.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ class PreferencesApi(object):
4040
"model",
4141
"make",
4242
"year",
43+
"type",
44+
"country",
4345
]
4446

4547
def __init__(self, api_client=None):
@@ -117,6 +119,8 @@ def create_preference_with_http_info(
117119
all_params.append("make")
118120
all_params.append("model")
119121
all_params.append("year")
122+
all_params.append("type")
123+
all_params.append("country")
120124

121125
for key, val in six.iteritems(local_var_params["kwargs"]):
122126
if key not in all_params:
@@ -254,6 +258,8 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501
254258
all_params.append("make")
255259
all_params.append("model")
256260
all_params.append("year")
261+
all_params.append("type")
262+
all_params.append("country")
257263

258264
for key, val in six.iteritems(local_var_params["kwargs"]):
259265
if key not in all_params:
@@ -381,6 +387,8 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501
381387
all_params.append("make")
382388
all_params.append("model")
383389
all_params.append("year")
390+
all_params.append("type")
391+
all_params.append("country")
384392

385393
for key, val in six.iteritems(local_var_params["kwargs"]):
386394
if key not in all_params:
@@ -508,6 +516,8 @@ def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501
508516
all_params.append("make")
509517
all_params.append("model")
510518
all_params.append("year")
519+
all_params.append("type")
520+
all_params.append("country")
511521

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

patch_api/api/projects_api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ class ProjectsApi(object):
4040
"model",
4141
"make",
4242
"year",
43+
"type",
44+
"country",
4345
]
4446

4547
def __init__(self, api_client=None):
@@ -113,6 +115,8 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501
113115
all_params.append("make")
114116
all_params.append("model")
115117
all_params.append("year")
118+
all_params.append("type")
119+
all_params.append("country")
116120

117121
for key, val in six.iteritems(local_var_params["kwargs"]):
118122
if key not in all_params:
@@ -240,6 +244,8 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501
240244
all_params.append("make")
241245
all_params.append("model")
242246
all_params.append("year")
247+
all_params.append("type")
248+
all_params.append("country")
243249

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

patch_api/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(
9191
self.default_headers[header_name] = header_value
9292
self.cookie = cookie
9393
# Set default User-Agent.
94-
self.user_agent = "OpenAPI-Generator/1.3.1/python"
94+
self.user_agent = "OpenAPI-Generator/1.3.2/python"
9595

9696
def __del__(self):
9797
if self._pool:

patch_api/models/project.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Project(object):
4545
"average_price_per_tonne_cents_usd": "int",
4646
"remaining_mass_g": "int",
4747
"standard": "Standard",
48+
"sdgs": "list[Sdg]",
4849
}
4950

5051
attribute_map = {
@@ -59,6 +60,7 @@ class Project(object):
5960
"average_price_per_tonne_cents_usd": "average_price_per_tonne_cents_usd",
6061
"remaining_mass_g": "remaining_mass_g",
6162
"standard": "standard",
63+
"sdgs": "sdgs",
6264
}
6365

6466
def __init__(
@@ -74,6 +76,7 @@ def __init__(
7476
average_price_per_tonne_cents_usd=None,
7577
remaining_mass_g=None,
7678
standard=None,
79+
sdgs=None,
7780
local_vars_configuration=None,
7881
): # noqa: E501
7982
"""Project - a model defined in OpenAPI""" # noqa: E501
@@ -92,6 +95,7 @@ def __init__(
9295
self._average_price_per_tonne_cents_usd = None
9396
self._remaining_mass_g = None
9497
self._standard = None
98+
self._sdgs = None
9599
self.discriminator = None
96100

97101
self.id = id
@@ -106,6 +110,7 @@ def __init__(
106110
self.average_price_per_tonne_cents_usd = average_price_per_tonne_cents_usd
107111
self.remaining_mass_g = remaining_mass_g
108112
self.standard = standard
113+
self.sdgs = sdgs
109114

110115
@property
111116
def id(self):
@@ -425,6 +430,29 @@ def standard(self, standard):
425430

426431
self._standard = standard
427432

433+
@property
434+
def sdgs(self):
435+
"""Gets the sdgs of this Project. # noqa: E501
436+
437+
An array returning the UN Sustainable Development Goals associated with this project. # noqa: E501
438+
439+
:return: The sdgs of this Project. # noqa: E501
440+
:rtype: list[Sdg]
441+
"""
442+
return self._sdgs
443+
444+
@sdgs.setter
445+
def sdgs(self, sdgs):
446+
"""Sets the sdgs of this Project.
447+
448+
An array returning the UN Sustainable Development Goals associated with this project. # noqa: E501
449+
450+
:param sdgs: The sdgs of this Project. # noqa: E501
451+
:type: list[Sdg]
452+
"""
453+
454+
self._sdgs = sdgs
455+
428456
def to_dict(self):
429457
"""Returns the model properties as a dict"""
430458
result = {}

0 commit comments

Comments
 (0)