Skip to content

Commit 8fec6da

Browse files
authored
update sdks (#15)
1 parent 19d1cb8 commit 8fec6da

File tree

9 files changed

+319
-8
lines changed

9 files changed

+319
-8
lines changed

Diff for: CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ 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.4.0] - 2021-02-15
9+
10+
### Added
11+
12+
- Adds Sustainable Development Goals (SDGs) field to projects
13+
14+
### Changed
15+
16+
- vehicle estimates now support optional `make`, `model` and `year` fields.
17+
818
## [1.3.1] - 2021-02-09
919

1020
### Fixed

Diff for: README.md

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
11
# Patch Python SDK
2+
23
![Test](https://github.com/patch-technology/patch-python/workflows/Test/badge.svg)
34
[![PyPI version](https://badge.fury.io/py/patch-api.svg)](https://badge.fury.io/py/patch-api)
45
[![Discord](https://img.shields.io/discord/733029448558837792)](https://discord.gg/AU8543D)
56

67
The official Python library for the [Patch API](https://www.usepatch.com).
78

89
## Documentation
10+
911
For a complete API reference, check out [Patch's API Reference.](https://docs.usepatch.com/).
1012

1113
## Installation
1214

1315
Add the library to your `requirements.txt` file:
16+
1417
```txt
15-
patch_api >= 1.3.1
18+
patch_api >= 1.4.0
1619
```
1720

1821
Then run:
22+
1923
```shell
2024
pip install -r requirements.txt
2125
```
2226

2327
Or install it directly with
28+
2429
```shell
2530
pip install patch-api
2631
```
2732

2833
### Requirements
29-
- Python 3.6.0
34+
35+
- Python 3.6.1
3036

3137
## Usage
3238

@@ -42,6 +48,7 @@ orders = patch.orders.retrieve_orders()
4248
```
4349

4450
### Orders
51+
4552
In Patch, orders represent a purchase of carbon offsets or negative emissions by mass. Place orders directly if you know the amount of carbon dioxide you would like to sequester. If you do not know how much to purchase, use an estimate.
4653

4754
In Patch, orders represent a purchase of carbon offsets or negative emissions by mass.
@@ -53,6 +60,7 @@ fulfill the order for you.
5360
[API Reference](https://docs.usepatch.com/#/?id=orders)
5461

5562
#### Examples
63+
5664
```python
5765
import patch_api
5866

@@ -94,11 +102,13 @@ patch.orders.retrieve_orders(page=page)
94102
```
95103

96104
### Estimates
105+
97106
Estimates allow API users to get a quote for the cost of compensating a certain amount of CO2. When creating an estimate, an order in the `draft` state will also be created, reserving the allocation of a project for 5 minutes. If you don't place your draft order within those 5 minutes, the order will automatically be cancelled.
98107

99108
[API Reference](https://docs.usepatch.com/#/?id=estimates)
100109

101110
#### Examples
111+
102112
```python
103113
import patch_api
104114

@@ -139,11 +149,13 @@ patch.estimates.retrieve_estimates(page=page)
139149
```
140150

141151
### Projects
152+
142153
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.
143154

144155
[API Reference](https://docs.usepatch.com/#/?id=projects)
145156

146157
#### Examples
158+
147159
```python
148160
import patch_api
149161

@@ -159,11 +171,13 @@ patch.projects.retrieve_projects(page=page)
159171
```
160172

161173
### Preferences
174+
162175
Preferences are how you route your orders in Patch. If you don't have a preference, Patch will allocate your order to the least expensive option. If you do have a preference, all of your orders will be sent to that project. You can set your preferences via API, or through the [Patch Dashboard](https://dashboard.usepatch.com/projects).
163176

164177
[API Reference](https://docs.usepatch.com/#/?id=preferences)
165178

166179
#### Examples
180+
167181
```python
168182
import patch_api
169183

@@ -192,23 +206,27 @@ patch.preferences.retrieve_preferences(page=page)
192206
### Running tests
193207

194208
Set up the required environment variable:
209+
195210
```
196211
$ export SANDBOX_API_KEY=<SANDBOX API KEY>
197212
```
198213

199214
Run tests:
215+
200216
```
201217
$ make test
202218
```
203219

204220
To run an individual test:
221+
205222
```
206223
$ python -m unittest
207224
```
208225

209226
### Testing the built package locally
210227

211228
To build the library locally, run:
229+
212230
```
213231
$ make build
214232
```
@@ -221,11 +239,13 @@ $ pip install ../patch-python
221239
```
222240

223241
Set up the required environment variable:
242+
224243
```
225244
$ export SANDBOX_API_KEY=<SANDBOX API KEY>
226245
```
227246

228247
To test the package locally, create a python file in a sibling directory and add the following:
248+
229249
```python
230250
import os
231251
import patch_api

Diff for: 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.3.1"
18+
__version__ = "1.4.0"
1919

2020
# import ApiClient
2121
from patch_api.api_client import ApiClient

Diff for: patch_api/api_client.py

+1-1
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.4.0/python"
9595

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

Diff for: 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.3.1".format(env=sys.platform, pyversion=sys.version)
344+
"SDK Package Version: 1.4.0".format(env=sys.platform, pyversion=sys.version)
345345
)
346346

347347
def get_host_settings(self):

Diff for: patch_api/models/project.py

+28
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)